Hitchhiker’s Guide to Twilio Programmable Voice
Time to read: 3 minutes
The Programmable Voice Guide is jam packed with volumes of amazing information about Twilio Programmable Voice. In this post I’m going to introduce you to three topics that are personal favorites:
- Getting input during a call,
- Recording calls and
- Modifying in-progress calls
Let’s go!
Gather Input
Phone calls don’t have to be a one-way conversation and the Guide can show you how. By using the <Gather>
TwiML verb you can have Twilio listen for a caller to press the buttons on their phone’s dial pad and report which buttons they pressed via a webhook request.
Your application can generate new TwiML commands based on the button press info to create a dynamic experience for each caller. For example, using <Gather>
you can create selection menus a caller can use to navigate to different functions in your app (called an “IVR” or “Phone Tree”) or accept information such as a passcode or account number.
Record Calls
Ask my wife, I forget stuff all the time. Honestly, most days I can’t remember what I had for breakfast so I’ve learned to write down everything. Of course, I also forget to bring along pen and paper. That’s where the <Record>
TwiML verb comes to your rescue. The Voice Guide shows you how to record a phone call until a number of seconds pass or a key on the dial pad is pressed.
When the recording is done Twilio lets your app know by making a webhook request so you can download the audio and store it for later playback. Voice notes are just one way that you can use <Record>
. Create a custom voicemail system, allow customers to leave product feedback or record customer support calls as part of a training program.
Modify an In-progress Call
You’ve dropped a caller into a <Conference>
so your agent can chat with them but once that conversation is done, then what? Did the service the agent provided meet your standards? Before the caller hangs up why not ask them to give you some feedback.
Moving the caller to this different experience means telling Twilio that you have a URL with new TwiML that you want it to execute. This is done using the REST API, and it’s really easy to do when you the Twilio Ruby helper library and follow the Modify Calls In Progress with Ruby guide.
Notice that the code uses a Call Sid to get a reference to a specific Call, then updates the url
parameter if that Call. Twilio will immediately make a POST
request to that URL letting your application give Twilio some different TwiML to execute for the caller.
In our case we could use some <Say>
, <Play>
and <Gather>
TwiML verbs to create a survey soliciting feedback from the caller on their experience with the agent.
Wrapping it up
The Programmable Voice Quickstart gives you that first taste of making your phone ring and does it fast. The Programmable Voice Guides pick up where the quickstart leaves off, getting you moving towards your bigger goal whether that’s an advanced IVR, custom voicemail system or entire call center.
Programmable Voice not your thing? That’s OK, give the Programmable SMS guide a spin and keep your eye out for more guides coming soon!
I’m stoked to see what your building and to hear how Guides helped you get there. Drop me a line via Twitter and let me know how it’s going.
Related Posts
Related Resources
Twilio Docs
From APIs to SDKs to sample apps
API reference documentation, SDKs, helper libraries, quickstarts, and tutorials for your language and platform.
Resource Center
The latest ebooks, industry reports, and webinars
Learn from customer engagement experts to improve your own communication.
Ahoy
Twilio's developer community hub
Best practices, code samples, and inspiration to build communications and digital engagement experiences.