Using SendGrid’s Webhooks for Fun and Profit


Posted on

SendGrid has some amazing email APIs and libraries that help simplify developers lives. Of all the services we make available, my favorites are our webhooks. They allow you to dynamically interact with email and its data. In this post I hope to stimulate your curiosity and think of new ways to use email as a tool to delight your customer’s experiences.

Event Webhook

The Event Webhook allows us to push data to a URL of your choice in near real-time. We provide event data (e.g. emails delivered, bounced, open, etc.), email parameters (e.g. user agent, IP, etc.) and unique/custom arguments and categories that you specify. For a detailed listing, please see our Event Webhook reference documentation.

Stop Parsing and Automate

The fine folks over at TeamSnap discovered that by using the Event Webhook, previously manual processes became auto-magic. Before using our Event Webhook, their mail server logs were parsed to find bounced email and spam complaint information. Resolving these issues became a largely manual process. Enter the Event Webhook to the rescue! After implementing an Event Webhook-based solution, deliverability went to 99.8% (on ~2.5 million emails) and nearly zero developer time has been spent since the original implementation. TeamSnap was gracious enough to provide a guest blog post where they described their process. Check it out to get all the details.

Supercharge your Email Analytics

Through an integration with Keen IO, the API for custom analytics, it’s now possible to access some amazing data analysis APIs and data visualization tools. Because the Event Webhook operates in near real-time, this data is available to you on the fly. With a little programming logic, you can trigger actions such as an alert to make a follow up phone call or SMS. Get the details on Keen IO’s integration with SendGrid.

Getting Started

Download our Event Webhook Guide: The Next Level of Email Sophistication. This details the use cases for this webhook, as well as technical details.

If you’re ready to dive in, the steps are outlined in the Setup section of our Event Webhook documenation. You will also save large amounts of developer time by reading our how to debug webhooks guide.

Inbound Parse Webhook

With the Inbound Parse Webhook we post incoming emails to a URL of your choice as a parsed JSON object. We include data such as the raw headers, SPF verification, spam score and attachments. A full listing of all the data that can be retrieved is available at our documentation.

Voting via Email

When turning 21, choosing your first alcoholic beverage is an important decision that will effect your destiny. Well, maybe not, but our awesome Developer Evangelist Nick decided he would make that experience as geeky as possible. He asked Battle Hack participants to send him their votes via email, after using Foursquare’s API to generate the venues to vote on. You can check out all the details, including the source code in his post Choosing My First Drink with SendGrid, foursquare, Node JS and Socket.io.

OCR via Email

We were very lucky to grab Kunal out of NYC to join us as a Developer Evangelist. He promptly created an awesome text recognition app using the Incoming Parse Webhook. You email a photo that includes some text, and then his app uses OCR (optical character recognition) to extract the text and send it back to you in a .rtf file. Magic! The source code is also available on Github.

Getting Started

To get started with integrating the Inbound Parse Webhook into your application, check out this Parse Webhook tutorial by Developer Evangelist extraordinaire Scott.

We hope you create some amazing experiences for your customers using these tools. As always, we’re here to help if you run into any issues or have any ideas for improvement. If you create a cool app using either of these webhooks, please join our developer community so that we can highlight your awesomeness. Happy hacking!


Elmer Thomas is SendGrid's Hacker in Residence. His mission is to help SendGrid live up to its slogan: "Email Delivery. Simplified" by improving the lives of developers, both internally and externally. Via all sorts of hackery, of course. Follow his exploits on Twitter and GitHub.

Elmer Thomas on Twitter

One thought on “Using SendGrid’s Webhooks for Fun and Profit

  1. Pingback: Four Things to Do With Webhooks

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>