How to Get SMS Alerts When a User Opens an Email


Posted on

Email to SMSHas there ever been a time when you wanted to know if someone opened up an important email? Maybe you want to get a real-time alert when people mark your email as spam. Or perhaps get immediately notified if a user clicks on your email’s unsubscribe link.

This is possible with our Event Webhook plus an SMS API of your choosing. In this example, I will showcase a small Python program that will receive event data from SendGrid and SMS alert a user with the Twilio API.

Easy as One, Two, Three

    1. Log in to SendGrid and go to your apps page. Click on the settings link for the Event Notification app.Event notification app
    2. Put in the URL of the program where your application will reside.Event notification app settingsFor this example, we are creating a Python application. For testing, this can be run on your computer and opened up to the internet with ngrok. (We have a great ngrok tutorial if this is new to you).
    3. Here’s the bulk of the Python program that receives an event and sends an SMS.Feel free to customize this for your specific use case. I am using Twilio for the SMS API, you can visit their website for more info.

If you have questions or get stuck, I’m @Kunal732 on Twitter.

For more information on the Event Webhook and to see what other pieces of data SendGrid sends, check out the documentation or our Event Webhook Guide.


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.

Kunal Batra on Twitter
Have thoughts on this post?
Chat with us about it on Twitter and Google+