Studio uses Widgets to represent various parts of Twilio's functionality that can then be stitched together in your Studio Flow to build out robust applications that require no coding on your part.
New to Twilio Studio? Check out our Getting Started Guide!
The Gather Input on Call Widget allows you to gather a user's keypress or voice input while they are on a call. This Widget will collect DTMF keypresses or text from speech recognition, which you can then save for your own data purposes or send along to another Widget to send your user down the right path.
There is no required configuration for the Gather Input on Call Widget. However, to make the best use of this Widget, we recommend configuring at least a few of the available configuration options listed in the next section.
The Gather Input on Call Widget accepts a number of configuration options that you can use to customize the message your Flow says to callers and the way(s) you may wish to collect data.
See the Say/Play widget for more details of these options.
Name | Description | Supported Values | Default |
---|---|---|---|
Say or Play a Message | "Say a Message" will read a message via text-to-speech. "Play a Message" will play a pre-recorded message. | Select Say a Message or Play a Message from the dropdown | Say a Message |
Text to say | The text to say on the call if you selected "Say a Message" | Strings like "Welcome!", templates like Hello {{first_name}} , and SSML like <emphasis level="strong">Thanks for calling!</emphasis> . | N/A |
Language | Language and regional dialect for the message being said if you selected "Say a Message" | Select a supported language from the dropdown, or enter a Liquid variable for dynamic selection | en-US (U.S. English) |
Message voice | The voice that will read your message on the call | Select a supported voice from the dropdown or enter a Liquid variable for dynamic selection. Note that the dropdown will not populate until you select a language | Alice |
URL of audio file | The URL of media to play, if you selected "Play a Message" | https://api.twilio.com/cowbell.mp3 | N/A |
Number of loops | The number of times your message will loop | Any positive integer between 1 and 99 | 1 |
Studio Say/Play and Gather widgets now support SSML.
For a list of supported Amazon Polly and Neural voices and dialects that you can reference with Liquid variables when setting Message Language and Voice, see this list.
A number of additional options are available when configuring the Gather Input on Call Widget to accept DTMF keypresses as input.
Name | Description | Supported Values | Default |
---|---|---|---|
Stop gathering after __ seconds | Time in seconds that the Flow will wait for a caller to press a key | 0 - 30 seconds | 5 seconds |
Stop gathering on keypress? | Stop gathering digits after a user presses a specific key. If "no," the Widget will gather and submit all keypresses when the Stop Gathering After timeout is reached or the expected Number of Digits are collected | Yes or No | Yes |
Stop gathering on keypress ___ | The key that triggers data submission of a user's input | Digits 0-9, #, * | # |
Stop gathering after number of digits | The number of digits you are expecting from a caller. A caller's input will be submitted as soon as this number of keypresses has been reached. | 0-30 | N/A |
Note that the value set for Stop Gathering Keypress is a control key, meaning that its value is not submitted with the rest of the gathered digits. For example, if your Stop Gathering On Keypress is # and a user enters 123#, only 123 will be submitted with your data.
Consider the following options when configuring the Gather Input on Call Widget to accept a caller's speech as input:
Name | Description | Supported Values | Default |
---|---|---|---|
Speech recognition language | The language Twilio's speech engine will try to recognize | Select a supported language from the dropdown, or enter a Liquid variable for dynamic selection | en-US (U.S. English) |
Speech recognition hints | A list of comma-separated values that give Twilio's speech engine specific words you expect to hear from your callers | comma-separated list of words (e.g., "sales, reservations, hours") | N/A |
Profanity filter | Redact profanity from speech results | True or False | True |
You may choose to enable a few advanced speech settings in the Gather Input on Call Widget by expanding the Advanced speech settings box in the Widget configuration panel.
The advanced speech settings of Gather should be used carefully, as certain combinations are incompatible with each other. Please consult the Voice <Gather> docs for full details of the options and how to use them.
Name | Description | Supported Values | Default |
---|---|---|---|
Speech timeout | The limit (in seconds) that Twilio will wait before it stops speech recognition. | auto, or any integer | auto |
Speech model | Which model the recognition engine should use to interpret speech | Select None, Default, Numbers & Commands,or Phone Call from the drop-down. Alternatively, you may enter a Liquid variable for dynamic selection | N/A |
When Speech timeout is set to auto, Twilio will stop speech recognition when there is a pause in speech and return the results immediately.
The Gather Input on Call Widget has three possible transition states that can lead to any other Widget in your Flow. For more information on working with Studio transitions, see this guide.
Name | Description |
---|---|
User pressed keys | The user pressed digits while on the call. |
User said something | The user spoke a message while on the call. |
No input | The user did not perform any input while on the call. |
When the Gather Input on Call Widget executes, it will have stored the following variables for use throughout your Studio Flow. When accessing these variables, make sure you replace MY_WIDGET_NAME
with the name of your Widget. For more information on working with variables in Studio, see this guide.
Find definitions and examples for Gather variables such as SpeechResult, Confidence, or Digits at the TwiML Voice: <Gather> page.
Find definitions and examples for Call variables at the Call Resource page.
Name | Liquid Template Language |
---|---|
Account SID | {{widgets.MY_WIDGET_NAME.AccountSid}} |
API Version | {{widgets.MY_WIDGET_NAME.ApiVersion}} |
Called | {{widgets.MY_WIDGET_NAME.Called}} |
Caller | {{widgets.MY_WIDGET_NAME.Caller}} |
Call Status | {{widgets.MY_WIDGET_NAME.CallStatus}} |
Caller City | {{widgets.MY_WIDGET_NAME.CallerCity}} |
Caller Country | {{widgets.MY_WIDGET_NAME.CallerCountry}} |
Caller State | {{widgets.MY_WIDGET_NAME.CallerState}} |
Caller ZIP | {{widgets.MY_WIDGET_NAME.CallerZip}} |
Call SID | {{widgets.MY_WIDGET_NAME.CallSid}} |
Called City | {{widgets.MY_WIDGET_NAME.CalledCity}} |
Called Country | {{widgets.MY_WIDGET_NAME.CalledCountry}} |
Called State | {{widgets.MY_WIDGET_NAME.CalledState}} |
Called ZIP | {{widgets.MY_WIDGET_NAME.CalledZip}} |
Confidence | {{widgets.MY_WIDGET_NAME.Confidence}} |
Digits | {{widgets.MY_WIDGET_NAME.Digits}} |
Direction | {{widgets.MY_WIDGET_NAME.Direction}} |
From | {{widgets.MY_WIDGET_NAME.From}} |
From City | {{widgets.MY_WIDGET_NAME.FromCity}} |
From Country | {{widgets.MY_WIDGET_NAME.FromCountry}} |
From State | {{widgets.MY_WIDGET_NAME.FromState}} |
From ZIP | {{widgets.MY_WIDGET_NAME.FromZip}} |
Speech Result | {{widgets.MY_WIDGET_NAME.SpeechResult}} |
To | {{widgets.MY_WIDGET_NAME.To}} |
To City | {{widgets.MY_WIDGET_NAME.ToCity}} |
To Country | {{widgets.MY_WIDGET_NAME.ToCountry}} |
To State | {{widgets.MY_WIDGET_NAME.ToState}} |
To ZIP | {{widgets.MY_WIDGET_NAME.ToZip}} |
Find more details about Confidence and Speech Result at the TwiML Voice: <Gather> page.
There are many real-world applications for using the Gather Input on Call Widget. One common example is creating an IVR, or Interactive Voice Response to help route callers to the correct number or extension.
Here we can see a Studio Flow that takes an incoming call and asks the caller to press a number or say a keyword to reach either a Sales or Support department. When the caller says "sales" or presses 1, the Widget will transition to a Split Based On… Widget, passing along the number pressed or keyword spoken so that we can then route the call accordingly.
Want to go more in-depth with Gather Input on Call? Follow along with one of these step-by-step tutorials that show how to create real-world applications that leverage this Widget
We can't wait to see what you build!