Code Challenge: Listen to Incoming Emails with TwilioSendGrid Team
A lot of cars now provide you with Bluetooth connections to your mobile phone. This gives you the ability to play music from your phone as well as make and answer phone calls. This made me think, what if we could extend this ability to listen and respond to incoming emails? I found it’s actually possible by turning on email forwarding and implementing the SendGrid Parse Webhook and the Twilio API.
- Twilio Account: Twilio is a voice and messaging API service. We use their service to call our phone and dictate the email.
- SendGrid Account: We use the Parse Webhook to create an email address in which all data of emails gets POSTED to our application.
- Mobile Phone: The number that Twilio will call.
The first thing we are going to do is create accounts on Twilio and SendGrid. For a SendGrid account just visit www.sendgrid.com/free.
Get a phone number on Twilio.
Set an incoming email route at https://sendgrid.com/developer/reply
- Hostname: Callme.bymail.in (any email like firstname.lastname@example.org will be broken down into individual components and posted to the URL in the field below).
- URL: The url of my application that gets the Posted data and takes some action.
Run the Python Flask code below:
This code gets the email and calls my cell whenever an incoming email happens.
Now you have the ability to listen to emails while driving! Whenever you’re going on a long journey and want to be apprised of whats happening with your email, you can just turn your email forwarding on and have email that would normally be sent to your inbox, sent to the specific email address that calls your phone.