Book Image

Twilio Best Practices

Book Image

Twilio Best Practices

Overview of this book

Table of Contents (15 chapters)
Twilio Best Practices
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Mastering messaging APIs


We've now seen how easy it is to make phone calls and work with them. Similar concepts work in order to send SMS and MMS messages, so we'll look at those next.

Sending your first SMS

To send an SMS, make a POST request to https://api.twilio.com/2010-04-01/Accounts/<your account SID>/Messages.json with the following parameters:

Parameter

Explanation

From

The phone number to be used as the caller ID for this message (it must be one of your Twilio numbers or another one you own and have verified with Twilio)

To

The phone number to send the message to

Body

The text you'd like to send in the SMS

Note

As you might be aware, a single SMS can contain a maximum of 160 characters. If you include more than this in the Body parameter, Twilio will automatically segment and concatenate your messages so that they arrive on the recipient's device as one (although you'll have to pay for the number of messages actually sent) as long as this is supported by their carrier...