Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: (Classic)

...

Anyone can create an account and provision phone numbers using the Twilio service. When someone calls or sends a text message to one of these numbers, Twilio uses a Web hook to call a RESTful Web service that the account owner has set up.  The response from the service should be an XML file that tells Twilio what to do.  The Twilio docs can be found here.

Events From Voice

Once you've signed up for a Twilio account, you can provision phone numbers and associate them with callback URLs, or Web hooks.  When one of your phone numbers is called, the Twillio service will POST to the Web hook associated with that number.  You can create and ESL to serve as the Webhook for the pico that is running responding to Twilio. 

The Twilio Module

A Twilio Module has been built. This module makes working with Twilio simple. 

The Twilio Library

One of the built-in libraries in Kynetx supports Twilio directly.  This makes sending Twilio directives easier.  As mentioned, you can control Twilio by sending back XML files the instruct the Twilio engine on what to do next.  The Twilio XML format is called TwilML.

...

Any response from a gather action will have an event attribute called Digits that contains user input. The rule simply says it back to the caller, but you could store it in an entity variable for later use and, for example display it on a Web page for the monkey to see.

Call Event Parameters

ParameterDescriptionExample Value

CallStatus

Status of the call.ringing
CalledThe number called.8019917544
CalledCityThe city called.MIDVALE
CalledCountryThe country called.UT
CalledStateThe state called.US
CalledZipThe zip code called.84058
CallerThe number of the caller.18019919911
CallerCityThe caller's city.OGDEN
CallerStateThe caller's state.UT

CallerCountry

The caller's country.US
CallerZipThe caller's zip.84058
DirectionThe call's direction.inbound
FromThe caller's number18019919911
FromCityThe caller's city.OGDEN
FromCountryThe caller's country.US
FromStateThe caller's state.UT
FromZipThe caller's zip.84754
ToThe number called.8019917544
ToCityThe city called.OGDEN
ToCountryThe country called.US
ToStateThe state called.UT
ToZipThe zip code called.84754
appidThe app id to which the event was raiseda1299x21

Anchor
send_sms
send_sms
Sending SMS

You can use the send_sms() action to send an SMS message using Twilio. The action takes three parameters:

...

The ruleset loads the Twilio module using the keys you create in your Twilio account. 

Receiving SMS Events

Using Twilio to add SMS message capabilities to your rule set is simple.  Every Twilio number has an associated Web hook for voice calls and one for SMS messages.  If you've configured Twilio with an SMS webhook that is an ESL, rulesets installed in that pico will receive events from Twilio when your account receives an SMS. 

...