IFTTT Makes Your Making Better

Geek Culture Internet Software
Photo by Melissa Schneider
Photo by Melissa Schneider

You’ve just finished your Arduino-powered soap dispenser made of LEGO, and you’re ready to share it with the world. It just needs one more feature: Tweeting to you when it’s low on soap.

Your child has built a webcam-enabled birdhouse and wants a text message when a bird arrives. You tell her, “Okay, let’s figure out how to do that.”

At some point, you learn that making your DIY showpiece into an Internet-of-Things device can be a chore. Your Arduino GSM shield isn’t going to help you tweet, for instance. And using Internet APIs requires developer keys and documentation that don’t transfer between sites.

IFTTT.com, the web service that glues together other web services, has reduced the IoT friction to almost zero with their new Maker channel. Enable it, and get a simple URL you can use to trigger an action. The channel also gives you an action that will connect to some other public URL.

Here’s how I recently used this new feature. I have a Raspberry Pi set up to capture Internet radio via Streamripper into a podcast. It’s mostly touchless at this point, but occasionally it has issues. Since many of the radio programs I capture run late into the night, I don’t notice those issues until the next day when it’s too late to fix them.

Once I activated the Maker channel, I wrote a script on my Pi that runs periodically. If it notices that StreamRipper has started to run, it does this:

curl https://maker.ifttt.com/trigger/streamripper_running/with/key/my_private_key

That triggers a recipe that sends me a text message. That’s it. The Pi doesn’t know anything about sending texts. I don’t know anything about sending texts. IFTTT does all the work. That means that the systems are what programmers call decoupled. I could change my phone number on IFTTT without touching my Pi or any other device talking to the web. I could switch to using Twitter for notifications with a few clicks on a website, half a world away from my Pi.

While I used a simple Unix command, touching a URL is at this point a basic feature in any mainstream programming language you or your youngest makers might be using.

The other end of my process, when Streamripper is no longer running, is only a bit more complex.

curl -X POST -H "Content-Type: application/json" -d "{\"value1\": \"`ls -lh /radio_captures | awk '/mp3/ {buffer = (buffer $9 \",\" $5 \",\")} END {print buffer}'`\"}" https://maker.ifttt.com/trigger/streamripper_stopped/with/key/my_private_key

If you don’t read shell script, that line just sends data to IFTTT that includes a directory listing. The recipe for that URL grabs that directory listing from the data and texts it to me. The end result? I get a text telling me the process has stopped with a list of the files it created.

If my script doesn’t start when I expect, I’ll know because I won’t get a text. If my script stops earlier than I expect, I’ll know because I’ll get a text at the wrong time. Either way, I’ll know to hop on and try to fix it before I lose too much of the stream. With about half an hour of work and testing, IFTTT’s new channel gave me a monitoring system tailored to my needs.

Liked it? Take a second to support GeekDad and GeekMom on Patreon!
Become a patron at Patreon!