Inserting variables inside text

variables in text – The message can be formatted to include the value of variable_name (2.4.1). This is helpful if we want to confirm the input entered by the user in any variable or if we want to display the details entered by the user at the end. The format to include variable is {{vars.<variable_name>}}. For instance, if the Text field contains “You entered {{vars.input}}”. The bot will replace the {{vars.input}} with the actual value of the variable input before sending the message to the user.

Example:

ID Type Text Goto
1.1 TextWidget-Name Hi. My name is BotGenuis. What’s yours?
1.2 Dialogue Hello {{vars.Name}}, Nice to meet you. 2
2.1 Dialogue What would you like to do today?

If the variable contains a data array, you can use index to load row and column of the data array to point to a specific data. Index can be specified like this: variable_name.0.1, where 0 is row and 1 is column number.

Here is a sample chatbot spreadsheet that uses variables within the text. Here is another that loads a data array within the text.

Carousel:

  • To render HTML inside Carousel, use jsonEscape and removeHtml functions. For eg., say a variable var1 contains HTML, then use{{#jsonEscape}}{{#removeHtml}}{{{vars.var1}}}{{/removeHtml}}{{/jsonEscape}} to render it properly.
  • If a variable contains a URL, then use triple curly braces ({{{}}}) instead of double curly braces ({{}}) to unescape the URL characters. For eg., if var1 is a URL to an image, then write it as {{{vars.var1}}} for the URL to load properly.
Request Demo