There are a lot of great use cases and business applications of our Inbound Parse Webhook. But sometimes you just want to hack for fun. Since the Parse Webhook is interactive and real-time, it’s a good one for hacking. In this blog post we are going to mashup some Python, the Parse Webhook, ngrok and osascript to make your Mac speak incoming emails.
Set Up Incoming Emails
The general idea is: receive an email, have your machine speak the subject. To achieve the first part, we need to receive emails in our application, which is easy with the Parse Webhook.
The incoming email settings let SendGrid know which application we can point your emails to. You can put any hostname here as long as the MX records of your domain point to mx.sendgrid.net.
As this Parse Webhook tutorial points out, there’s a five minute solution that’s handy for quick hacking. Just use username.bymail.in.
The URL you include can be any server where you have access, but since this example is using your Mac, you’ll need to connect the webhook to ngrok, which allows you to route calls to your local machine’s web server.
Create a Python App
We need to create a python app that can receive email posted by SendGrid and then speak the subject.
The above video shows in detail how I created the Python application.
Create Your ngrok Tunnel
Download ngrok if you haven’t already. We need this server to be accessible by SendGrid, so ngrok will open up our laptop to the internet. Just point the ngrok application to your local web server port.
To complete the connection to the Parse Webhook, be sure the public web URL in the “forwarding” section of ngrok is listed as the URL in your Parse Webhook settings.
Hungry for more Parse Webhook information? Join Kunal and our Director of Developer Communications, Adam DuVander, on April 29th (at 1 PM EDT) for a free webcast on all things parse! They’ll share common use cases for incoming email, such as social, customer support, and content management. For more information and registration details click here!