I'm building an SMS bot using Twilio Studio flows. I've added a Set Variables widget with the following liquid code in the variable value:
{% capture address %}{{widgets.request_address.inbound.Body | lower | strip}}{% endcapture %}
{% if address == "yes" %}{{ flow.data.address }}{% else %}{{ widgets.request_address.inbound.Body }}{% endif %}
The documentation suggests this should work:
Variables can have static values like a single number or string, or dynamic values set via the Liquid templating language.
However the code isn't being parsed and instead it's being saved as a string into the variable.
Am I missing something? Does Twilio studio just not support this despite what the documentation says?
Update:
I think the widget might only allow a single Liquid block. Later in the docs it says:
This can be a number or string value, or a liquid template block like the example above.
The following code works (but is obviously not as flexible about the input)
{% if widgets.request_address.inbound.Body == "yes" or widgets.request_address.inbound.Body == "Yes" %}{{ flow.data.address }}{% else %}{{ widgets.request_address.inbound.Body }}{% endif %}