Passing Information From Twilio Widgets to Twilio Functions

330
February 13, 2020, at 02:50 AM

I have a flow setup in Twilio studio. The flow asks for an extension. That information is then passed through a conditional block. If the person presses 1, it goes somewhere specifc, the same if 2 is pressed, and all the rest are transitioned to a script. How do I get the pressed value?

Answer 1

What you can do, is add parameters in the function, and pass the parameters through the flow.

Answer 2

Twilio developer evangelist here.

To get the pressed button value, you can use the Gather Input on Call widget (more info on that here). Your flow may look something like this then:

Let me know if this helps at all! :D

Answer 3

The first response is correct with the addition of adding the parameters to the Twilio Studio Run Function widget using the syntax in the 2nd response, widgets.gather_1.Digits (assuming your Widget is named gather_1) as the value for your key.

In the Twilio function, you can pull in this value using the event object and the key you used for the widgets.gather_1.Digits value. You can print it out in your Twilio function using

console.log(event.myKeyName);
READ ALSO
What is a revocable proxy in JavaScript for?

What is a revocable proxy in JavaScript for?

Why would you want to revoke a proxy? Could you provide a practical application of Proxyrevocable()?

171
Querying the Stripe API for all charges per customer?

Querying the Stripe API for all charges per customer?

Is it possible to query the Stripe API for all charges for a specific customer or do we need to retrieve all charges, and then filter them for the customer?

92
Pop up Menu getting cut off at the bottom of the page

Pop up Menu getting cut off at the bottom of the page

I have a playlist and once the playlist items hit near the bottom of the screenthe pop up menu gets cut off as i'm using the x and y mouse coordinates to display the menu i guess from the upper left hand corner

70
Can we upload PDF generated from react-pdf to server?

Can we upload PDF generated from react-pdf to server?

We are using @react-pdf/renderer to generate pdf documents in our application, is there a way to upload those generated documents to backend server?

63