Email

Extracta.ai revolutionizes the way businesses handle email data through our Email Parsing API. By automating the extraction of text, attachments, and other relevant information from emails, we empower businesses to streamline their workflows, improve data management, and enhance business intelligence. This guide provides you with the essentials for integrating email parsing into your applications using our API.

Why Extracta.ai for Email Parsing?

  • Comprehensive Data Extraction: From body text to attachments, capture every piece of valuable information.

  • High Precision: Benefit from Extracta.ai’s advanced OCR and text processing technologies for accurate data extraction.

  • Custom Workflows: Easily integrate extracted data into your CRM, database, or custom workflow for immediate use.

Getting Started

Integrating email parsing into your system starts with a simple POST request to our /createExtraction endpoint, utilizing a request body designed for email data. Below, we provide a JSON template tailored for email parsing, highlighting the key information segments typically extracted from emails.

Body Example for Email

JSON Body
{
    "extractionDetails": {
        "name": "Email Data Extraction",
        "language": "English",
        "fields": [
            {
                "key": "email_info",
                "type": "object",
                "properties": [
                    {
                        "key": "Subject Line",
                        "description": "The subject of the email"
                    },
                    {
                        "key": "Email Date",
                        "description": "The date the email was sent",
                        "example": "February 20, 2024"
                    }
                ]
            },
            {
                "key": "sender_info",
                "type": "object",
                "properties": [
                    {
                        "key": "Sender Name",
                        "description": "The name of the person who sent the email"
                    },
                    {
                        "key": "Sender Email",
                        "description": "The email address of the sender"
                    },
                    {
                        "key": "Sender's Position",
                        "description": "The job title of the sender",
                        "example": "Project Manager"
                    },
                    {
                        "key": "Sender's Contact Number",
                        "description": "The phone number of the sender"
                    }
                ]
            },
            {
                "key": "recipient",
                "type": "object",
                "properties": [
                    {
                        "key": "Recipient Name",
                        "description": "The name of the email's recipient"
                    },
                    {
                        "key": "Recipient Email",
                        "description": "The email address of the recipient"
                    }
                ]
            },
            {
                "key": "cc",
                "description": "Carbon copy recipients of the email",
                "type": "array",
                "items": {
                    "type": "string",
                    "example": "test@gmail.com"
                }
            },
            {
                "key": "bcc",
                "description": "Blind carbon copy recipients of the email",
                "type": "array",
                "items": {
                    "type": "string",
                    "example": "test@gmail.com"
                }
            },
            {
                "key": "meeting_info",
                "description": "Information about the meeting",
                "type": "object",
                "properties": [
                    {
                        "key": "Meeting Date",
                        "example": "February 25, 2024"
                    },
                    {
                        "key": "Meeting Time",
                        "example": "10:00 AM"
                    },
                    {
                        "key": "Meeting Location",
                        "example": "Bucharest, Romania"
                    }
                ]
            },
            {
                "key": "project_name",
                "description": "The name of the project being discussed"
            },
            {
                "key": "proposal_equirements",
                "description": "Specific requirements or topics requested in the proposal",
                "type": "array",
                "items": {
                    "type": "string",
                    "example": "Integration of AI technologies"
                }
            }
        ]
    }
}

How to Implement

  1. API Key Generation: First, sign up at https://app.extracta.ai and create an API key on the /api page.

  2. API Request: Use the JSON template in a POST request to /createExtraction, including your API key in the header for authentication.

  3. Data Integration: The API's response will contain structured data extracted from the email, ready for integration into your system.

Code Example

const axios = require('axios');

/**
 * Initiates a new document extraction process with the provided details.
 * 
 * @param {string} token - The authorization token for API access.
 * @param {Object} extractionDetails - The details of the extraction to be created.
 * @returns {Promise<Object>} The promise that resolves to the API response with the new extraction ID.
 */
async function createExtraction(token, extractionDetails) {
    const url = "https://api.extracta.ai/api/v1/createExtraction";

    try {
        const response = await axios.post(url, {
            extractionDetails
        }, {
            headers: {
                'Content-Type': 'application/json',
                'Authorization': `Bearer ${token}`
            }
        });

        // Handling response
        return response.data; // Directly return the parsed JSON response
    } catch (error) {
        // Handling errors
        throw error.response ? error.response.data : new Error('An unknown error occurred');
    }
}

async function main() {
    const token = 'apiKey';
    const extractionDetails = {}; // the json body from the example

    try {
        const response = await createExtraction(token, extractionDetails);
        console.log("New Extraction Created:", response);
    } catch (error) {
        console.error("Failed to create new extraction:", error);
    }
}

main();

Maximize Your Data Potential

With Extracta.ai, transforming unstructured email data into actionable insights has never been easier. Our Email Parsing API is a powerful tool for businesses looking to automate data extraction from emails for CRM updates, database enrichment, batch processing, or business intelligence analysis.

Explore further details on our API’s capabilities by visiting our API Endpoints and our 1. Create extraction pages.

Last updated