Reconnecting IFTTT

In LightSaga, Technology

Last week we delivered a couple of LightSagas to some of our earliest customers. Everyone was very happy with a product we feel proud of. Work however continues and one thing that was bugging us from the start of the prototype run was the problem we have in that we would like to keep the delivered LightSagas in the prototype run connected to our Particle.io account so that we can remotely update them. This is working fine but the problem lies in that connecting to IFTTT is impossible then unless everyone shared one IFTTT account, something we obviously don’t want.

But let’s backtrack a little; What is this IFTTT anyway? IFTTT is a free web-based service that allows users to create chains of simple conditional statements, called “recipes”, which are triggered based on changes to other web services such as Gmail, Facebook, Instagram, and Pinterest. IFTTT is an abbreviation of “If This Then That”. An example “recipe” might consist of sending an e-mail message if the IFTTT user tweets using a certain hashtag. Or, if the user is tagged by someone on Facebook, then that photo will be added to the user’s cloud-based photo archive.

A better example might however be something like “If the ISS passes over my house then show a purple notification on my LightSaga”. So, how can we do this without using the Particle channel? Easy, we expose a function in the firmware that takes in a hexadecimal color format and we call that function as the “then that” part of a recipe.

If you’re one of the lucky few that already took delivery of their LightSaga prototype you must be itching to try this! Let’s show you how, it’s not as hard as it sounds. First create an IFTTT account if you haven’t done so already. Login and hit the big Create a recipe button.

First you will need to fill the “This” part of the recipe. When clicking on “This” it will open up a gigantic list of channels to choose from. These are all inputs you can use in your recipe and feel free to discover them all. For our example we will search for “Space” for now and click on the “Space” channel. A new overview of all kinds of different triggers will load and you could trigger on any one of them, but for now we will just choose “ISS passes over a specific location”. After searching and selecting a location in the world (I would suggest wherever your LightSaga is located), you can hit “Create trigger”.

Now we created the “This” part, let’s hook it up to the LightSaga in the “That” part. When clicking on “That” it will again allow you to choose a channel and for LightSaga integration you want to select the “Maker” channel. This has only one action after selecting it; “Make a web request”. After selecting that action it will show you some text boxes that you will need to fill. At URL you should fill in the API endpoint to call https://api.particle.io/v1/devices/<Your DeviceID>/notification (your DeviceID is in the email we’ve sent you when we came to install your LightSaga, be sure to put it in the URL). The method should be POST, the Content Type needs to be set to application/x-www-form-urlencoded. The body needs some work. In essence it would be something like access_token=<Your AccessToken>&args=<Color>, your AccessToken is also in the email we’ve sent you when we came to install your LightSaga and the color can be any rgb hexadecimal color for example 00FF00 for green or FF00FF for purple.

Screen Shot 2016-05-09 at 21.30.13After creating the action you’re all set. The recipe will automatically run somewhere in the cloud and should be active. Keep an eye on your LightSaga to see it in action every now and then and explore the vast number of channels to cook up your own awesome recipes. We’d love to hear what you created!

We will roll out the update making this all possible soon to the prototype owners along with a personal email to them describing what other changes we’ve made over last week. Stay tuned for more updates!