Posted on

Concept Map

You have a Twilio account with which one or more phone numbers are associated. These associated numbers are the ones you can send messages from. Your account has an Auth token that you will use to confirm ownership of a given telephone number when making an API request to Twilio servers to send a text using one of your numbers. This account ID and token should only be used in testing. For production you need to create an API key to use instead. Twilio also provides a virtual phone that you can view in their test interface, this allows easy texting, but also avoids any permission/licensing/etc issues with sending automated texts for the sake of testing.

The web interface that Twilio provides is called the Twilio console in their documentation. It holds API information, Access to the virtual phone for testing, etc.

Important Notes

Before you can send messages you must verify your given toll-free number, this requires providing legal identifying information for the entity that is using the service (your company or you personally).

Basic message request

You can send a text via a simple http request containing the message, the target number, and your authorization. From their tutorial:

curl 'https://api.twilio.com/2010-04-01/Accounts/[Account ID]/Messages.json' -X POST \
--data-urlencode 'To=+<NUMBER>' \
--data-urlencode 'From=+<NUMBER>' \
--data-urlencode 'Body=Hello, World!' \
-u [Account ID]:[Auth Token]

receiving messages

When Twilio gets a message to your number it will make a webhook request to your applicationa. In order for Twilio to call a webhook you need to provide a webhook url to associate with your number which can be done in the number's configuration settings in the Twilio console.

Flow Charts

Twilio supports a flowchart automation system that allows you to build complex sms response systems, including making http requests to set up appointments etc.