Our Parse webhook lets your application receive inbound email. The common use cases for this tend to be web app related. It’s awesome for creating applications like a support ticketing system or receiving data for a social or content management site. In this post, I’ll share how well it also works to control web-enabled hardware.

Specifically, I’ll be using inbound email to control home lighting with the Philips Hue light bulbs. For the next few days, anyone can control the lights in my apartment and I’ve set up a livestream (embedded above) to show the current status. There is a 20-30 second delay in the stream, but you’ll get an idea for how it works.

Control My Lights

Update: When I first wrote this post, I let people control the lights in my apartment and view a livestream. For obvious reasons, I can’t continue this in perpetuity. You can see an example in the video embedded above and continue along to see how it worked and get the code to try it yourself.

Send an email to: change@lights.bymail.in

The subject can be any of the options below:

  • on
  • off
  • an integer between 0 and 65535

A subject of 0 will change the lights to red. Here are the other settings:

  • 12750 = Yellow
  • 25500 = Green
  • 46920 = Blue
  • 56100 = Pink
  • 65280 = Red

How It Works

The Philips bulbs come with a bridge that communicates with the bulbs over a protocol called ZigBee Light Link. We just need to create an application on our local network which can make PUT requests to the bridge.

I decided to use MeteorJS, a real-time JavaScript framework. You can find an my earlier introduction to receiving email with Meteor.

Here’s an example call from Meteor to the Philips bridge:
Meteor.http.call('PUT','', {data: {"on": true}})

That line of code will turn on the light bulb. We can change that payload to change colors, turn off the bulb, or schedule lighting as well. Philips has full documentation on its developer site.

To connect to inbound emails, I am running ngrok on my local machine to open up my Meteor application to the internet and use the URL the service provides as the route SendGrid will post email data.

Thanks to a web-enabled light bulb, the Inbound Parse Webhook and some Internet plumbing, anyone can control my lights. And if you check out the source code on GitHub, you can control your own lights this way, too.

For more details on the feature behind this tool, download the Parse Webhook Guide for free now.

Expert advice and insight about all things email including best practices tips, examples, and advice for marketers, developers, and everyone in between.