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 call-related APIs


Now that we know in more abstract terms how the Twilio API works and have had an introduction to the PHP library and Postman, let's try our hand at playing with the API for real, starting with the Call resource.

All of our examples will include the URL and parameters you can use with Postman, plus a code sample for the PHP library.

Making a call

To make a call, we'll need to make a POST request to https://api.twilio.com/2010-04-01/Accounts/<your account SID>/Calls.json with the following parameters:

Parameter

Explanation

From

This refers to the phone number that will be used as the caller ID for this call (this must be one of your Twilio numbers or another one you own and have verified with Twilio).

To

This refers to the phone number you need to dial.

Url

This refers to a URL that serves TwiML, which should be used to handle this call. Either this or ApplicationSid must be specified.

ApplicationSid

This refers to the SID of an application that...