Pinterest Stumbleupon Whatsapp
Advertisement

If you’re not using IFTTT, you’re seriously missing out. If This Then That allows you to combine different services with your own custom logic. You define what should happen when a condition is met. For example: if an RSS feed updates, send an email. If the traffic is bad, wake you up early.

The potential uses for IFTTT are endless. But until now, it’s been difficult to interface it with your own hardware projects. Today, that’s all changed.

Meet Your Maker (Channel)

Channels are the fundamental building blocks of IFTTT. They represent web services that provide data sources or even physical devices like fitness wearables.

There are well over 200 channels available, and they’re a diverse bunch, ranging from Android battery statuses, to RSS feeds, as well as content from publishers like BuzzFeed and the New York Times. Now, they’ve added the Maker Channel.

ifttt-channels

This allows you to build recipes that use data from projects you’ve personally built, which can then be used to trigger actions elsewhere. Whether that’s from your Arduino-based alarm system How To Make a Simple Arduino Alarm System How To Make a Simple Arduino Alarm System Detect movement, then scare the heck out of an intruder with a high pitched alarm sounds and flashing lights. Does that sound fun? Of course it does. That's the goal of today's Arduino project, suitable... Read More , or from your Raspberry Pi powered motion tracker Build a Motion Capture Security System Using a Raspberry Pi Build a Motion Capture Security System Using a Raspberry Pi Of the many projects that you can build with the Raspberry Pi, one of the most interesting and permanently useful is the motion capture security system. Read More  – or your own web project. Anything, really.

Advertisement

It’s also bi-directional too. You can send messages to your projects straight from IFTTT.

So, for example, you could have an LED companion cube How to Build a Companion Cube Mood Lamp (For Absolute Arduino Beginners) How to Build a Companion Cube Mood Lamp (For Absolute Arduino Beginners) Read More that flashes when you receive an email, or an automated laser turret Pew Pew! How To Build A Laser Turret With An Arduino Pew Pew! How To Build A Laser Turret With An Arduino Are you bored? Might as well build a laser turret. Read More that shoots a beam of light whenever BuzzFeed posts a new article.

The possibilities are endless.

One of my favorite things about IFTTT is the fact that many people choose to share their recipes with the public, for free. There are thousands of IFTTT recipes, ripe for the taking. This is ideal if you’re looking for some inspiration for a project. At the time of writing, there are hundreds of example recipes available for your perusal at hackster.io.

Getting Started

There are some key differences with how recipes are built with the Maker Channel compared to other channels. But that shouldn’t deter you.

First, when you sign up for the makers channel, you’re given a secret key. This string of characters is what identifies you to the IFTTT servers. Given that you’re going to be using this with real-world IoT (Internet of Things) devices in your home, you should take good care of this. Don’t share it, and keep it in a safe place.

ifttt-secret-key

Once you’re all signed-up, you’re going to want to start incorporating it into your projects. Using it is simply a matter of using GET and POST requests. These are an open web technology, meaning you’re not just limited to using it with Arduino and Raspberry Pi. You can also use it with anything that supports HTTP, like the Tessel board Building The Internet of Things, With Tessel: The Node.js Development Board Building The Internet of Things, With Tessel: The Node.js Development Board Tessel is a new breed of development board that runs entirely on Node.js, and after a successful Kickstarter, they’ve now the reached the point of being available to everyone. Read More , the .Net Gadgeteer, and even standard web applications.

If you’re using Arduino, the official documentation will tell you everything you need to know about making HTTP requests. But if you’re using Raspberry Pi, you’ve got a lot of choices when it comes to how you use it. You could use Curl, but if you’re using Python, you can use the delightfully simple to use Requests library.

Creating Your Recipe

So, let’s start off by making our recipe. This is actually surprisingly simple. First, create a new recipe using the Maker channel. Then, you’ll be prompted to define an event name that triggers this recipe (like “button_pressed”, or “motion_made”). If you plan on having lots of custom events, make sure they aren’t too generic.

ifttt-event

Then, move on to defining what you want to happen when an event happens.

ifttt-event2

I decided to send myself an email alert.

ifttt-alert

If it all looks good, press “Create Recipe”. Then you’re ready to start using the IFTTT Makers Channel.

ifttt-confirm

 

Triggering Events

Communicating with your recipe is easy. You simply need send a special POST or GET request to the following URL.

https://maker.ifttt.com/trigger/{event}/with/key/{secret_key}

Here, we’ve got a couple of variables in curly braces. Event is simply the event name, and secret_key is your secret key. If you were to call this in Curl, you’d be looking at something like this.

ifttt-curl-nopayloads

$ curl -X POST https://maker.ifttt.com/trigger/MakeUseOf_IFTTT_Test/with/key/{secret_key}

With Python’s Requests Library, this is even simpler.

ifttt-requests-nopayload

import requests
requests.post("https://maker.ifttt.com/trigger/MakeUseOf_Test/with/key/{secret_key}")

Including Payloads

When triggering IFTTT, you can also include include up to three variables, which can then be used in your recipes. These are stored as a JSON object (What is JSON? What Is JSON? A Layman's Overview What Is JSON? A Layman's Overview Whether you plan to be a web developer or not, it's a good idea to at least know what is JSON, why it's important, and why it's used all around the web. Read More ). Here’s how you’d include three variables in Curl:

ifttt-curl-payload

curl -X POST -H "Content-Type: application/json" -d '{"value1":"test","value2":"test","value3":"test"}' https://maker.ifttt.com/trigger/{event}/with/key/{secret_key}

And in Python:

ifttt-requests-payload

import requests
payload = "{ 'value1' : 'hello', 'value2' : 'hello', 'value3' : 'hello'}" requests.post("https://maker.ifttt.com/trigger/MakeUseOf_Test/with/key/{secret_key}", data=payload)

Note that the variable names (“value1”, “value2”, “value3”) are fixed; you can only include up to three variables, and they must be named like that.

Inbound Traffic

As previously mentioned, IFTTT’s Makers Channel is bi-directional. Not only can it receive messages and triggers, but it can also send them.

This shouldn’t be too difficult. You just need to set up an endpoint, and provide IFTTT with the URL for it. You can also specify the body of the content sent to that URL, as well as the type of request sent.

ifttt-url

This means that you can use the Makers Channel with an application you’ve hosted on the cloud (for example, on a Virtual Private Server What Is A Virtual Server, And What Can You Do With One? What Is A Virtual Server, And What Can You Do With One? Virtual machines and virtual servers — what are they and how do they differ? Read More ). If you’re fortunate enough to have a static IP, or have a dynamic DNS service 5 Best Dynamic DNS Providers You Can Lookup for Free Today 5 Best Dynamic DNS Providers You Can Lookup for Free Today DynDNS was always a top mention when free dynamic DNSes were brought up. But now that it's gone, are there any good alternatives? There sure are. Read More like DynDNS, you could feasibly use it at home with your own creations.

If you go down the path of using a VPS, both Digital Ocean and Linode come highly recommended.

IFTTT Your Smart Home

It’s probably worth noting that this isn’t IFTTT’s first foray into the Internet of Things. They already support an expansive range of Smart Home devices, ranging from the Nest Protect Nest Protect Review and Giveaway Nest Protect Review and Giveaway Read More , to the Philips Hue lightbulb Light Your Home the Smart Way With Philips Hue Light Your Home the Smart Way With Philips Hue If you can afford the initial expenditure, you won't find a better-supported and more user-friendly smart lighting system on the market. Read More , and everything in between.

But this marks the first time where developers can easily integrate their own creations with IFTTT. And that, to me, is really damn cool.

But what do you think? Have you got a burning idea for a creation you want to build? Let me know in the comments below, and we’ll chat.

Leave a Reply

Your email address will not be published. Required fields are marked *