2

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?

zhirsch
  • 233
  • 1
  • 3
  • 13

2 Answers2

2

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.

Tim Banks
  • 7,099
  • 5
  • 31
  • 28
  • 1
    This is the correct method of doing this, using SSML is a bit overkill when you can just use the liquid syntax, thanks! – Tomas Crofty Jun 27 '22 at 19:38
0

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

Alan
  • 10,465
  • 2
  • 8
  • 9