Twilio Studio - how to play back gathered digits individually?

Viewed 520

In Twilio Studio, I am attempting to play back digits gathered by a "Gather Input On Call" widget. I have the following text specified to be spoken aloud: "You entered {{widgets.GatherPIN.Digits}}."

When this message plays, I hear something like: "You entered one thousand three hundred twenty four," rather than, "You entered one - three - two - four."

How can I specify that each digit should be read aloud individually?

2 Answers

You can use liquid syntax to accomplish this.

{{widgets.gather_1.Digits | split: "" | join: " "}}

This will split the digits into an array and then join it back together with a space in between each digit.

SSML in Studio is currently not officially supported by Twilio, so it may break at some future date, but it is the easiest way to show it.

A supported way would be to use the Studio TwiML Redirect Widget and return TwimML which uses SSML as shown below. You could below TwiML in a TwiML Bin, for example.

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Say>You entered<say-as interpret-as="digits"> {{Digits}}.</say-as></Say>
</Response>

enter image description here

enter image description here

Related