Skip to main content

Variables

Variables are placeholders for content that you can then use anywhere in the Hoorybot. It's a very important concept to understand to truly create a customized experience for the user.

Save an answer in a variable

You can tell your input step to save the answer into a variable and reuse then in a further bubble for example:

Iframe preview

Advanced concepts

Here is a quick video that showcases advanced concepts about variables:

Prefilled variables

By default, any declared variables in the bot can be prefilled by passing initial values in the URL.

Let's say my hoorybot contains these variables:

  • "Email"
  • "First name"

Then the variables will be prefilled as following:

Prefilling variables using the embed library is even easier. You need to add an object named prefilledVariables that contains a dictionary of your values. For example:

Hoorybot.initBubble({
hoorybot: `my-bot`,
prefilledVariables: {
Email: '[email protected]',
'First name': 'John',
},
})

(Note that if your variable name contains spaces, it needs to be surrounded by quotes.)

Hidden variables

Your hoorybot's variables don't have to be displayed to the user. You could create variables that are only used internally by the bot and displayed in your results. This allows you to add some context to a session for example a User ID, a utm_source parameter (in the case of a marketing campaign), or anything else.

You just have to make sure that the variables exist in the variables dropdown:

Iframe preview

(This dropdown can be found in any place where you can add variables. It is global to your bot flow.)

Then the values will be available on the Results page in specific columns:

Iframe preview