Make Calls with Twilio using the ThingHTTP App

Twilio is a cloud communications platform for phone calls and SMS messages. They have an API that you can send HTTP requests to and place phone calls. The API requires HTTPS and Basic Authentication which is perfect for high-level devices like phones and computers, but nearly impossible for an embedded device like the Arduino, Netduino, and mbed. The ThingHTTP App from ThingSpeak allows a device to make a simple API call over HTTP that gets relayed to any web service or API. The App supports HTTPS and is perfect to interface with the Twilio API with your device. Now, your thing can really speak…

Setup Twilio

Twilio is a paid service. At the time of this tutorial, your account will start with some funds to play in the sandbox. You will also have access to a phone number to use. You can take the service further by adding more funds and buying a dedicated phone number.

  • Sign up for Twilio
  • Find your API Credentials [AccountSid and Auth Token] under the Developer Tools section of the Twilio Dashboard

Setup ThingHTTP Request

  • Sign into ThingSpeak
  • Click Apps
  • Select  ThingHTTP
  • Click Create New Request
  • Enter a Name for your new request: Twilio Test
  • Enter the Making Calls API URL:{AccountSid}/Calls.json
  • Enter your AccountSid under HTTP Auth Username
  • Enter your Auth Token under HTTP Auth Password
  • Select POST method
  • Enter Content Type: application/x-www-form-urlencoded
  • Under Body enter the required parameters of From, To, and Url: From={sandbox_number}&To=%%number%%&{link_to_Twilio_formated_document}
  • Click Save ThingHTTP

Example Body:
This example body will speak the last light level on the “my_house” public feed.


Send Request to ThingHTTP

POST /apps/thinghttp/send_request HTTP/1.1
Connection: close
Content-Type: application/x-www-form-urlencoded
Content-Length: (number of characters in message)


  • The formats for the phone number used by Twilio follows the E.164 format, such as +13215551212
  • The Twilio formatted document can be any Url that outputs TwiML format (based on XML) – whatever this URL contains will be read back by Twilio
  • “&” must be encoded in the Twilio return Url with “%26”
  • Using the %%number%% in the ThingHTTP request allows you to dynamically change what number is called by the Twilio  request by passing the number in the request