variablestwiliotwilio-studiotwiliosms

Twilio Studio - Retrieve Variable Issue


I am trying to use variables for the first time and in my first test this hasn't worked. Can anybody please offer any advice, I'm sure it's something silly on my behalf.

enter image description here

Firstly, I ask the user their child's name and their response should be captured as a variable. Then, for better CX, I ask what their child's class is, referring to their actual name.

I tried setting a variable where: Key is "2Child1Name" Value is "{{widgets.Absent_2Children_Child1Name.inbound.Body}}"

I then tried to recall this variable in the subsequent widget: What is {{flow.variables.2Child1Name}}'s class? Eg 2K.

When I test this, I received no variable, simply the exact same text the same as above including the brackets.

Thank you in advance.

Regards, Brendan


Solution

  • This issue might be caused by the variable name, specifically that it starts with a number. Try using "Child1Name" or "SecondChild1Name" and it should work.

    From the docs:

    Liquid variables are named like Ruby variables: they should consist of alphanumeric characters and underscores, should always start with a letter, and do not have any kind of leading sigil (that is, they look like var_name , not $var_name ).