Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Set Variables

Set Variables Widget


Set Variables allows you to save key/value pairs in the global context of the flow execution. Variables set via the widget are accessible throughout your flow via other widgets under the key {{flow.variables.<key>}}. This allows you to enable use cases such as counters that are dynamically updated as your flow executes.

Optional Configuration:

You can add any number of Variables. Variables can have static values like a single number or string, or dynamic values set via the Liquid templating language.

Example that sets a variable called count to 0 if not set and increments it if it exists.

Tip: Be sure to use the hyphen in your Liquid tags to remove the whitespace generated by the template.

{%- if flow.variables.count -%}
  {{flow.variables.count | plus: 1}}
{%- else -%}
{%- endif -%}





The name of this variable, once set, will be accessible in liquid via {{flow.variables.<key>}}.

Note: Variable names are case sensitive. Foo is a different variable to foo.


The variable value to set. This can be a number or string value, or a liquid template block like the example above.


There is only one transition from this widget, "Next" which fires once any variables specified are set.

Example Flow

In the call flow screenshot below, the count variable is set to 0 when the flow starts, and the flow will loop until the count variable is equal to 3 and then exit (The set variable widget uses the sample liquid template code from above).

Screen Shot 2018-12-11 at 10.11.23 AM.png

Rate this page:

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.