New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@sharpapi/sharpapi-node-detect-emails

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sharpapi/sharpapi-node-detect-emails

SharpAPI.com Node.js SDK for detecting email addresses in text

latest
Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
1
-50%
Maintainers
1
Weekly downloads
 
Created
Source

SharpAPI GitHub cover

Email Detector API for Node.js

🎯 Detect and extract email addresses from text — powered by SharpAPI AI.

npm version License

SharpAPI Email Detector parses text content and extracts any email addresses found within. Perfect for data validation, content moderation, and lead extraction from unstructured text.

📋 Table of Contents

Requirements

  • Node.js >= 16.x
  • npm or yarn

Installation

Step 1. Install the package via npm:

npm install @sharpapi/sharpapi-node-detect-emails

Step 2. Get your API key

Visit SharpAPI.com to get your API key.

Usage

const { SharpApiDetectEmailsService } = require('@sharpapi/sharpapi-node-detect-emails');

const apiKey = process.env.SHARP_API_KEY; // Store your API key in environment variables
const service = new SharpApiDetectEmailsService(apiKey);

const text = `
For support inquiries, please contact support@example.com or sales@example.com.
You can also reach our CEO at john.doe@company.org for partnership opportunities.
`;

async function detectEmails() {
  try {
    // Submit detection job
    const statusUrl = await service.detectEmails(text);
    console.log('Job submitted. Status URL:', statusUrl);

    // Fetch results (polls automatically until complete)
    const result = await service.fetchResults(statusUrl);
    console.log('Detected emails:', result.getResultJson());
  } catch (error) {
    console.error('Error:', error.message);
  }
}

detectEmails();

API Documentation

Methods

detectEmails(text: string): Promise<string>

Detects and extracts email addresses from the provided text.

Parameters:

  • text (string, required): The text content to scan for email addresses

Returns:

  • Promise: Status URL for polling the job result

Example:

const statusUrl = await service.detectEmails(textWithEmails);
const result = await service.fetchResults(statusUrl);

Response Format

The API returns detected emails in a structured format:

{
  "emails": [
    {
      "email": "support@example.com",
      "confidence": 1.0,
      "domain": "example.com",
      "username": "support"
    },
    {
      "email": "john.doe@company.org",
      "confidence": 1.0,
      "domain": "company.org",
      "username": "john.doe"
    }
  ]
}

Examples

Basic Email Detection

const { SharpApiDetectEmailsService } = require('@sharpapi/sharpapi-node-detect-emails');

const service = new SharpApiDetectEmailsService(process.env.SHARP_API_KEY);

const sampleText = `
Contact our team at hello@startup.io or reach out to
the marketing department at marketing@startup.io.
`;

service.detectEmails(sampleText)
  .then(statusUrl => service.fetchResults(statusUrl))
  .then(result => {
    const emails = result.getResultJson();
    console.log(`Found ${emails.length} email addresses:`);
    emails.forEach((email, index) => {
      console.log(`${index + 1}. ${email.email}`);
    });
  })
  .catch(error => console.error('Detection failed:', error));

Custom Polling Configuration

const service = new SharpApiDetectEmailsService(process.env.SHARP_API_KEY);

// Customize polling behavior
service.setApiJobStatusPollingInterval(5);  // Poll every 5 seconds
service.setApiJobStatusPollingWait(120);    // Wait up to 2 minutes

const statusUrl = await service.detectEmails(text);
const result = await service.fetchResults(statusUrl);

Use Cases

  • Lead Generation: Extract email addresses from web pages, documents, or social media
  • Data Validation: Verify and extract emails from user-submitted forms
  • Content Moderation: Detect email addresses in user-generated content
  • Email Harvesting: Collect contact information from business cards or documents
  • Spam Detection: Identify suspicious email patterns in text
  • Contact Management: Parse unstructured text to build contact databases

API Endpoint

POST /content/detect_emails

For detailed API specifications, refer to:

License

This project is licensed under the MIT License. See the LICENSE.md file for details.

Support

Powered by SharpAPI - AI-Powered API Workflow Automation

Keywords

sharpapi

FAQs

Package last updated on 09 Jan 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts