Triggering SMS And Voice Notifications For IoT Devices

People throw around the term “the internet of things” as if there’s an internet essence in all devices that you unlock via secret code. The truth is connecting one device to another and building a truly awesome bit of IoT hacking takes some engineering. But after that engineering you get sofas vibrating to music, and IoT connected boxing gloves.

Getting up and running with connected IoT devices isn’t as simple as setting up your dev environment. Marc Pous of knows that, and hopes his platform can take some of that work off of devs’ plates so they can focus on shipping code. helps you manage those nagging dependencies, interoperability worries, and libraries. It also gives you monitoring reports and data analytics. So if you need to monitor your sofa that vibrates based on the vibe of a music festival, you can do that. Or if you need to get data from the Electric Imp installed inside the boxing glove you outfitted with a force sensor to see who punches the hardest, you can do that too.

For now, we’ll focus on setting up SMS alerts for IoT devices. Let’s say you have a trigger set for temperature monitoring. If your device gets too hot, you’ll get a text  or call so you can tend to the issue immediately. In the following example, originally published on’s blog, they’ll show you how to set that up. (Read their original blog post here)

Let’s Get Coding

You’ll need to have a account and a Twilio account to make this jam work. Once you’ve got both of those things sorted, go to the Cloud Code feature on and click on the ‘Cloud code’ link at the left sidebar.


Create a trigger at the ‘Add Trigger‘ button. A form to create a trigger will appear. You have to name the trigger, link it to a product and insert the Javascript code that will be executed.

Triggers are executed when an event occurs like a thingWrite (when your thing post a value). So, we are going to code a script that sends an SMS when the temperature of a thing is up to 50. Here there is the JS code:

Blam, now you have SMS and Voice alerts in 32 lines of Javascript.

If you prefer to receive a voice call instead an SMS, you only have to change the twilio.sendMessage to twilio.makeCall as in the following example:

Here are a few resources if you need any help getting this up and running.

Twilio API & Docs
Learn more about cloud code
Learn more about triggers