Send SMS Messages From Your IoT Projects Using Wia & Twilio
Tags: internetofthings, wia, twilio, tutorials
Published: 2018-01-03 10:32:13

---
title: Send SMS Messages From Your IoT Projects Using Wia & Twilio
published: true
description: Start sending SMS messages from any IoT device using the Wia cloud and Twilio.
tags: internet of things, wia, twilio, tutorials
---
Hi All,  
Today we're going to look at sending SMS messages from your IoT devices using [Wia](https://www.wia.io "Wia") and [Twilio](https://www.twilio.com "Twilio"). 

P.S. If you want to see your devices on iOS and Android, pre-register [here](https://wia.io/beta "Wia iOS and Android Beta") for our beta.  

### Create Your Wia Account
If you haven't already got one, [click here](https://dashboard.wia.io/signup "Create your Wia account") 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](//images.contentful.com/i5evrz7h2uo7/1bfPDxMf4s0SyaOSkCEsum/f0dc8f7ebe0076a222b495d36376f4f7/Screen_Shot_2018-01-01_at_12.38.44.png)

### 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](//images.contentful.com/i5evrz7h2uo7/2VTGU7kVDayOGikwUUm6iO/5a16cc0c4d5b2ac0cee1027a4e75155e/Screen_Shot_2018-01-01_at_12.50.12.png)

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

![Screen Shot 2018-01-01 at 12.50.16](//images.contentful.com/i5evrz7h2uo7/3BLByHGp6gc46eQGw0O0aM/f846a3dbdbf6f1a5201d17c216e5bb6f/Screen_Shot_2018-01-01_at_12.50.16.png)

### Get Your Twilio API Keys
If you don't already have a Twilio account, [click here](https://www.twilio.com/try-twilio "Try Twilio") to set one up for free.  

- Go to the [Twilio Console](https://www.twilio.com/console "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](//images.contentful.com/i5evrz7h2uo7/2q7P7Y0hxCgGE04IgyqeEu/3d3b4168d3522bf98ce36b4947e65285/Screen_Shot_2018-01-01_at_12.38.54.png)

You will need to setup a phone number before you can setup SMS. Go to [Phone Numbers](https://www.twilio.com/console/phone-numbers/incoming "Twilio Phone Numbers") and check you have one setup.  

![Screen Shot 2018-01-01 at 12.39.11](//images.contentful.com/i5evrz7h2uo7/2Cbtk7RoEUsguIoWeAeSoE/b5d450e480584a1439c5bd54d9f525ff/Screen_Shot_2018-01-01_at_12.39.11.png)

### 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](//images.contentful.com/i5evrz7h2uo7/3QkJqW7Oh2AGmEY0kMc68G/c7b43c184778c7b2bbcfd9a34927afad/Screen_Shot_2018-01-01_at_12.49.23.png)

### 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](//images.contentful.com/i5evrz7h2uo7/4Ytayplm4E2AWAmKYmkyic/d628ec1f07899fb9d158b70a442f0acc/Screen_Shot_2018-01-01_at_13.12.56.png)  

### 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](//images.contentful.com/i5evrz7h2uo7/531iBToQbeE4gGsAgu2OoG/bbf306d36b0cb73a8377d7ec4881e247/Screen_Shot_2018-01-01_at_12.51.40.png)

### 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](//images.contentful.com/i5evrz7h2uo7/f36FnnptaoKgsKYgEoWQa/11fdf042fd9eb92efb982876173f5899/Screen_Shot_2018-01-01_at_12.51.46.png)

### 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](//images.contentful.com/i5evrz7h2uo7/Zd25BuY6QMmyG2UwSaSCc/93c1a284b52c19935ee97a0a02c5d08d/Screen_Shot_2018-01-01_at_12.56.00.png)

### 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](https://twitter.com/wiaio) or email [support@wia.io](mailto:support@wia.io)


*References*  
[Twilio](https://www.twilio.com "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.