DEV Community

Conall Laverty
Conall Laverty

Posted on

Send SMS Messages From Your IoT Projects Using Wia & Twilio

Hi All,

Today we're going to look at sending SMS messages from your IoT devices using Wia and Twilio.

P.S. If you want to see your devices on iOS and Android, pre-register here for our beta.

Create Your Wia Account

If you haven't already got one, click here to sign up.

Setup a Space

Once logged in, setup a new Space for your devices. I'm going to call mine My Devices. When your Space is ready, you should see a screen like the one below.

Screen Shot 2018-01-01 at 12.38.44

Start Setting Up Integration

Open the Space dropdown, by clicking on the Space name in the top left corner, and click Settings. Select Integrations in the sidebar.

Screen Shot 2018-01-01 at 12.50.12

On the Twilio row, click Setup to begin setting up the integration.

Screen Shot 2018-01-01 at 12.50.16

Get Your Twilio API Keys

If you don't already have a Twilio account, click here to set one up for free.

  • Go to the Twilio Console and login.
  • In the Project Info panel, copy and paste Account Sid and Auth Token into the integration panel in Wia and click Create Integration.

Screen Shot 2018-01-01 at 12.38.54

You will need to setup a phone number before you can setup SMS. Go to Phone Numbers and check you have one setup.

Screen Shot 2018-01-01 at 12.39.11

Create a Flow

  • Go to the Flows and click Create Flow.
  • Enter a name for your Flow. I'm going to call mine Send SMS For Temperature.
  • You will then be redirected to the Flow Studio.

Screen Shot 2018-01-01 at 12.49.23

Add a Trigger Node

  • In the Flow Studio, drag over an Event trigger node from the panel on the left.
  • Select the node, enter temperature as the name of the Event in the panel on the right and click Update.

Screen Shot 2018-01-01 at 13.12.56

Add an Output Node

  • Drag over an SMS output node from the Twilio section in the panel on the left.
  • Select the node, then on the panel on the right, do the following:
  • Choose your From phone number
  • Enter your To phone number (NOTE: enter the country code and have no spaces i.e. +14568893405).
  • Enter your Body message. I'm going to set mine as Temperature is ${event.data}. This takes the temperature data from the Event. we are going to send. You can see more variables by clicking the Show variables panel link.
  • Click Update to save your changes.

Screen Shot 2018-01-01 at 12.51.40

Connect the Nodes

  • Click on the white diamond shape at the bottom of the Event node and drag the line to the input of the Output node.

Screen Shot 2018-01-01 at 12.51.46

Add Flow to Your Device

  • Go to Devices and select the Device your would like to add the Flow to.
  • Click on Flows in the subnav then click on Enable beside the Flow.

Screen Shot 2018-01-01 at 12.56.00

Run the Flow

Publish an Event from the Device and you will see the SMS message come through.

That's all folks!

P.S. If you need any help with getting setup, tweet us or email support@wia.io

References

Twilio is a developer platform for communications. Software teams use Twilio API to add capabilities like voice, video, and messaging to their applications. This enables businesses to provide the right communications experience for their customers.

Top comments (2)

Collapse
 
philnash profile image
Phil Nash

Hey Conall, great quick tutorial here! I hadn't heard of Wia before, but that looks like a really easy way to set up IoT flows. I love how easy it is to connect with Twilio too!

Collapse
 
conalllaverty profile image
Conall Laverty

Hey Phil! Thanks for the nice words!