IFTTT is awesome. If you haven’t used it stop what you’re doing and check it out right now. It’s exciting to see what can be done by glueing together the most popular APIs on the web. However, as a developer, I was disappointed to find out there’s no easy way to integrate it my own applications.

Mailgun to the rescue!

Luckily IFTTT does support e-mail actions. My first thought was to implement my own little SMTP server using haraka but lucky for me Mailgun makes this unnecessary. Mailgun will receive e-mails for us and send them to our application via a simple HTTP POST callback. It’s even free for under 300 requests a day, nice!

Setting up routes

Let’s set up Mailgun to trigger our applications callbacks. Create a new route with the settings below

For our example we will match any recipient address to this callback but you can change this to forward different addresses/domains to different callbacks.

Handling the callback

Mailgun will to the heavy lifting and provide the message in a convienent standard format. Now we are free to interpret the message/subject/etc in anyway we want. If you’re using [Node] you have instant access to the nearly limitless supply of libraries on NPM to play with. Control your bitcoin client or transmission. Use FFMPEG to transcode podcasts into a mobile-friendly format. The possibilities are endless!

Example application with Node/Express

That’s all folks!

Now you have an easy way to create custom actions for your IFTTT recipes. Happy hacking!