Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Twilio Best Practices

You're reading from   Twilio Best Practices Learn how to build powerful real-time voice and SMS applications with Twilio

Arrow left icon
Product type Paperback
Published in Dec 2014
Publisher
ISBN-13 9781782175896
Length 178 pages
Edition 1st Edition
Tools
Arrow right icon
Toc

Table of Contents (10) Chapters Close

How does Twilio Client work?


There are four steps to follow when working with Twilio Client:

  1. Setting it up with your credentials

  2. Placing outgoing calls

  3. Dealing with incoming calls

  4. Interacting with calls currently in progress

Setting up the client

To get started, you'll use your language's Twilio API library to generate a Capability Token. This gives the client the right to make and/or receive calls using your account.

The following are embedded in this token:

  • Your account credentials, ensuring that only you can give clients the right to make and receive calls using your Twilio credit

  • The identifier that will be used to receive calls (if the client is allowed to receive calls)

  • The Twilio application SID that will be used to place outgoing calls (if the client is allowed to place outgoing calls)

As an example, using the PHP library, we'll generate a Client token like this:

$accountSid = '<your account SID>';
$authToken  = '<your auth token>';
$capability = new Services_Twilio_Capability($accountSid...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime