1
votes

I'm looking for the reverse of LIQUID TEMPLATE LANGUAGE Twilio Studio Variables. I'm fine setting liquid variables, and can check for them within the same widget using liquid. But they appear to be scoped to just the current widget, and are not included as part of the flow.

So I need either a way to reference an earlier liquid variable, or to assign a liquid variable to a widget/studio variable or something else which can be used further down the line.

I could kludge my way through using http request or run function widgets just to get that variable back, but that seems like a poor way to do it when I already know which value I want from within Studio.

An example of where this would come in handy would be for an IVR where you want to retry things on wrong answers, but after "n" wrong answers you want to break out of the flow with a "contact customer service" response. A simple increment for wrong answers would be trivial, if you could set and use variables.

Thanks

2

2 Answers

1
votes

Twilio developer evangelist here.

The liquid tags are only run in the context of the widget, so you cannot set persistent variables within them.

It may sound like a kludge, but using a Twilio Function is the way to run code (which you need to do to increment a counter) and then store data that can be used by other widgets, so that is what I would recommend.

I wouldn't bother with an HTTP request, as that is overkill for this situation.