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

The callback request tool


First up, we're going to build a callback request tool that is suitable for any website.

Popular across the Internet, such tools are great for small businesses that want to let their customers get in touch with them without the annoying need to wait on hold.

There are four components of this tool:

  1. A simple website with a form for collecting customer details

  2. A PHP page that initiates a call to the customer who requested it when a member of staff clicks on a link

  3. A short piece of TwiML to power this call

  4. A status callback page that listens for a request from Twilio to let it know that a call was answered so the database can be updated

Let's get started.

Preparing the project

To start, we'll need to get some dependencies in order and prepare a configuration and setup file that can be included in all of our pages.

Installing the Twilio API library

First, we'll install the Twilio PHP library using Composer.

To do that, first install Composer on your machine (if you don't have it...