How to Get SMS Alerts When a User Opens an EmailSendGrid Team
Has 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
- Log in to SendGrid and go to your apps page. Click on the settings link for the Event Notification app.
- Put in the URL of the program where your application will reside.For 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).
- 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 our documentation.