Using variables in your WhatsApp flow

If you’d like to reference a variable that is obtained from a step within the Whatsapp flow, such as a user response or a validation status, you can save and reuse a contact response to a previous step as a variable in the following steps of your flow.

Accessing and using variables

The notation for variables is as follows:

{{.<block_name>.<variable_name>.value}}

To access the content inside the brackets:

  1. Select the Open Question box in Truora’s dashboard. This action will automatically open a panel on the right side. Scroll down to the Variables section, locate the desired variable (as highlighted in the red rectangle), and click the copy icon to copy the reference of the variable you want to your clipboard. In the case shown in the image, the variable will contain the answer of the user to the displayed question:

    new flow option
  2. Paste the copied variable into the block where you want to use it. The text editor will automatically detect the variable reference and display a pill with the block title:

    sample image

    Note: You cannot use variables in button names.

  3. Save, publish and test your flow. The image below is an example of how it would work on WhatsApp:

sample image

Include Variables in a Conditional box

  1. Drag the Condition box from Advanced Blocks and drop it into the Truora dashboard. Click on it to open the panel on the right side.
  2. In the If this… field select the Variable option.
  3. Paste the value of the copied variable in the With value field. The system will immediately recognize the variable.
  4. In Has the following condition field, select one of the following conditions:
  • is equal to
  • is different to
  • contains
  • contains one of
  • is greater than
  • is greater than or equal to
  • is less than
  • is less than or equal to
  • is empty
  • is not empty
  1. In the Fulfills field, type the value of the open question that fulfills the condition.

    sample image

    Note: Each conditional logic block has two outputs, green and one red.

    • Green output is triggered if the condition is true (in the example above, if greeting.value equals “John Doe”).
    • Red output will be triggered if the condition is false.
  2. In the Add condition option, you may create up to 9 different conditions.

  3. Finally, test your flow!

Use the variables of an outbound message in the flow

You can use the variables of an outbound message inside a flow as inputs for any block.

sample image

To call the variables use the following syntax: {{.start.<variable_name>.value}}. For example, using the variable name from the previous image, you can call the variable as follows: {{.start.name.value}}.

sample image