Email Data Extraction

How You Can use Email Data Extraction to Supercharge Your Product

Enhance user productivity with email data extraction.

Tasia Potasinski | March 25, 2020

No matter what industry your product serves — finance, real estate, law, customer support or anything else, for that matter—there are certain repetitive tasks that demand your users’ attention. Fortunately, the Nylas APIs can help automate these tasks so that your customers’ day-to-day processes proceed more efficiently, allowing them to focus on important tasks while doing less manual work! 

Email Data Extraction for Culling Invoices 

Let’s take one common example: many software companies spend hundreds of hours collectively on invoice processing and expense reporting. Invoices, and the associated attachments, live across hundreds of users’ emails and can be incredibly difficult to find, sort, and organize when expense reporting time rolls around. 

Using the Nylas email API for data extraction, you could pull team or company-wide emails with attachments automatically and send them to a central repository to be processed. 

Let’s take a look at how you can set that up with the Nylas APIs. 

Here, we make a call to our /threads endpoint and make use of the ‘any_email’ parameter to specify the email address.[email protected]

This will return an array of thread objects from [email protected].

A thread object will look something like this – notice it has a `has_attachments` attribute:

        "account_id": "bs07mom9zz8922upk0p",
        "draft_ids": [],
        "first_message_timestamp": 1584385901,
        "has_attachments": true,
        "id": "9isbyk9m8bxmlhiasldkfjwoeijf124",
        "labels": [
                "display_name": "Inbox",
                "id": "8kat5qkqwer13958jfjds",
                "name": "inbox"
        "last_message_received_timestamp": 1584385901,
        "last_message_sent_timestamp": null,
        "last_message_timestamp": 1584385901,
        "message_ids": [
        "object": "thread",

This attribute allows you to iterate through the threads and quickly check for any that have attachments. Once that’s been ascertained, grab the ‘message_id’ and make a call to the /messages/{id} endpoint:{message_id}

The message object returned to you will have a file attribute with the file ID :

    "account_id": "bs07mom9zz8922upk0p",
    "bcc": [],
     "cc": [],
    "date": 1584385901,
    "events": [],
    "files": [
            "content_disposition": "attachment",
            "content_id": "f_k7uua0yg0",
            "content_type": "pdf",
            "filename": "March_Invoice_2020.pdf",
            "id": "64sh71cco8l81vvihjqi3eqp6",
            "size": 19616366
    "from": [
            "email": "[email protected]",
            "name": "Jane Doe"
    "id": "27d9udk4nhxuc7zz8901p1nf",

Email Data Extraction Automatically Creates Contact Profiles

The Nylas email API can also extract contact data from emails and automatically create contacts out of them for your customer’s contact books. This is helpful for making sure that email addresses and first and last names are as up to date as possible. Your users can add information directly into your their contact books such as job titles, phone numbers, and company names, and the Nylas Contacts API will sync this data back into your application on their behalf, so users have the most up to date contact information at their fingertips with little to no administrative overhead.

Imagine Bob is a sales account executive at (an applicant tracking system powered) and he uses Pipedrive (a sales CRM powered by Nylas) to manage his pipeline. Bob has synced his Gmail account with Pipedrive so he can manage his pipeline, send emails, and see the full email transaction history with prospects all in one place.

Bob has been emailing with a mid-level recruiter, Sam, at a health tech company, and receives his first response from Sam – hooray! The Nylas Email API has already created a contact profile in Bob’s Gmail contacts book, and this data was instantly synced into Pipedrive. Now, when Bob goes to schedule a meeting with Sam through the Pipedrive platform, he simply types her name and her email address is automatically added to the calendar event without Bob needing to look up Sam’s email address. This automatic data sync speeds up the sales cycle and reduces administrative efforts for Bob and every sales rep using Pipedrive.

Nylas makes it very easy to extract and modify contact data from Bob’s contact book via the contacts endpoint:{id}

The resulting response includes things like the contact’s phone numbers, job title, company name, addresses, and more.

        "account_id": "x2x2x2x2x2x2x2x2x2x2x2",
        "birthday": "1960-12-31",
        "company_name": "Healthtech",
        "emails": [
                "email": "[email protected]",
                "type": "work"
        "given_name": "Sam",
        "id": "z3z3z3z3z3z3z3z3z3z3z3",
        "job_title": "Recruiter",
        "object": "contact",
        "office_location": "123 North Pole Dr",
        "phone_numbers": [
                "number": "1 800 123 4567",
                "type": "mobile"
        "surname": "Doe",
        "web_pages": [],

These are just a few examples of how email data extraction can boost the productivity of your end-users.

What sets the Nylas APIs apart is the wealth of raw data that’s made available to you – once you’ve integrated with Nylas and authenticated an account, Nylas’ sync engine automatically syncs calendar, inbox, contact data for you, so that you can customize data extraction in whatever configuration you need. Not only does this allow you to customize your workflow now, but this also gives you the power and flexibility to modify what kind of data you’re extracting as your company scales.  


About the Author

Tasia is the Director of Product Marketing at Nylas. She's passionate about communications and helping connect the world through APIs. In her free time, she writes and produces music.

Ready to Start Building?