In my last blog post I walked through TextBlob and showcased a quick app that can be a first-responder to incoming emails. In that example it would respond back differently based on the sentiment of the incoming email.

For this post, I want to dive further into Natural Language Processing and showcase how you can take advantage of the Alchemy API to find out other really interesting parts of your incoming email. This can be used for automatically responding to messages, categorizing messages, classifying messages, and more.

Data that Alchemy API can give you on text:

For the sample app I’m building, we’re going to take advantage of a small portion of the capabilities of Alchemy’s API. I’d like to read the keywords, concepts, and entities of an incoming email before diving into the text.

How do we display the data?

The current solution I’m thinking of is to prepend the Alchemy Analysis to all incoming emails in my personal inbox. This is just to showcase the functionality; you can use that data in any other way that might make sense.

How do we accomplish this ?

If you’re not familiar with our Parse Webhook we have a video walkthrough and great information on our docs on how to use it.


Step 1:

To accomplish this, we can take advantage of the SendGrid Parse Webhook to create our new email address. In this case case we will create the email Anything emailed to that address will be broken down into its individual components and posted to my application.

Step 2:

I made a Python Flask app that gets the parts of the email posted from the Parse Webhook. I then analyze the text with the Alchemy API.

Step 3:

Prepend that data to the original body and send that new email to my personal inbox

Try it yourself!

You can send an email to and it will analyze the body of the email and send you back the analysis.

Over the next few weeks, I’m going to continue writing about different technologies, so check back every Monday, Wednesday, and Friday for new tech posts! You can also visit my intro post that will have an updated list of everything I’ve written.


Meet Kunal, Developer Evangelist at-large for SendGrid and home-grown New Jersey hacker. He previously ran General Machines, which developed Deaftel - a phone service for the deaf that converts voice to text and text back into voice over a phone call. Since March 2013, Kunal has been working as a Developer Evangelist at SendGrid, helping enable developers to get the tools and resources they need to make awesome, creative stuff.