Introduction

Twilio is a developer platform for communications. Twilio’s programmable application program interfaces are a set of building blocks developers can use to build the exact customer experience they want.

Twilio allows you to build a digital experience using capabilities including programmable messages and programmable voice. With Twilio, you can quickly make and receive voice calls in your application. Twilio makes your calls easy to any country with few lines of code. With Twilio, we can build Interactive Voice Response (IVR) systems.

Over 190,000 businesses use Twilio to improve their communication system. From customer service and healthcare to enterprises use Twilio to increase their customer interactions.

What does Twilio do

Twilio works in the background to bridge the gap between web-based applications and telephones.

Provide communication APIs that enable voice, messaging, and video conversation within, web and mobile apps.

Programmable connectivity options provide virtual phone numbers, SIP trunking, message connectivity, and cellular connectivity within devices.

 Steps involved in making a call

  • Create a Twilio account
  • Purchase Twilio mobile Number: To purchase a Twilio number just you need to select a number, add card information and within a few steps you would have one
  • Verify the number you are calling when you are using the trial account
  • Check the geographic access for the country you are calling & enable if not
  • Include Twilio SDK in your project
  • Make your first call
  •  Track your call through the Twilio console

Setup

When you start your application, you can start with a trial account and once you’re comfortable with the environment you can upgrade your account to paid ones. Twilio gives you a pay-as-you-go option. Calls are charged per minute.

Then when you start with your trial account you need to first verify your caller ID under Phone numbers > Manage > Verified Caller IDs.

Then you need to enable geo permission for the country you are calling from Twilio under Voice > Settings > Geo permissions.

Finally, you need to install Twilio sdk based on which language you are developing the application. 

https://www.twilio.com/docs/libraries

Important keys

Here important keys you need to secure are the account SID and auth token.

ACCOUNT SID: AC******************************

AUTH TOKEN: *******************************

Best practices to protect your account.

Twilio console

The Twilio console allows you to track each of your calls and debug. Also, you can make all your settings related to your call through this console.

Making your first call

To make an outgoing call, you must make an HTTP POST request to the account’s call resource.

The POST request should include From and To parameters in order for Twilio to know where to direct the call and what to use as caller ID.

Then you need to specify what action Twilio must take by providing an URL parameter in your request. Basically, that URL must return the instructions in a form called TwiML (Twilio Markup Language) to handle the call.

First endpoint that triggers the call

The URL we provide must be an absolute URL at this point and must be hosted. You can use Ngrok to expose local server ports to the internet and then include them in your application during development.

Providing a TwiML to handle the call request

In this piece of code, we provide instructions on what Twilio needs to say. We provide a gather verb in order to gather the user’s response. Then we provide the URL where we need to pass the user response through the action URL. The URL we provide can be an absolute URL or relative URL

Get the user response and give custom messages

The number the user enters is passed as Digits parameter to the third end point in our case. Then we can say custom voice messages based on the number which the user enters.

Great! Now your application should be able to make phone calls and say custom voice messages based on user response.

Use cases

Twilio provides many services, but most of the use cases are based on programmable voice and message communication.

Twilio messaging service can be used to send an OTP as a form of authentication when a user interacts with your application.

Imagine a healthcare application Twilio programmable voice can be used to call the patients and get their response from their dial pad in order to provide a different experience for the user. Also, to be more interactive.

Trulia uses Twilio to track and connect real estate agents with home buyers.

Lyft enables users to communicate directly with each other without revealing their phone numbers.

At Coca-Cola field technicians receive automated alerts as soon as vending machines need maintenance.

Conclusion

Twilio does an awesome job by being a bridge between web-based applications and telephones. This makes the business to concentrate more on their core business values than spending time on setting up a communication platform. Also, this allows businesses to expand their service by interacting more with people.

Kawsikan kumaralingam

Kawsikan kumaralingam