Variable is named piece of data that can be used in your bot's scenario. Any data can be stored to variables - the user's query, result of HTTP request or an entity value extracted from the user's input.

There are two types of variables in Aimylogic - System variables (managed by Aimylogic) and regular variables (you can create and manage them in your scenario).

How to create varialbes

Once the user sends a query to your bot, Aimylogic automatically creates a set of System variables that can be used in your scenario.

If there are some entities in the user's query that can be extracted, Aimylogic extracts them and creates variable for each extracted entity.

IF your scenario executes some HTTP request to external web service, it can produce a set of variables parsing an HTTP response.

All these cases generate named variables and then you can use it in any block of your scenario to perform some actions.

How to use variables

Once your bot has generated variables, it can be used in scenario.

Variables in Text output

You can use variables in the Text block to generate dynamic outputs. Just place the name of variable with prepended $ symbol, and Aimylogic will replace it with actual variable's value before rendering.



Note that you can use variables in the speech synthesis markup as well

Variables in Links

Aimylogic enables you to append buttons and links to the bot's replies. If you'd like to generate some dynamic link to the external website, you can add variable to the URL of the link the same way you've seen it above in the example with text block.

Variables in Conditions

Conditions block enables your bot to branch it's logic according to Javascript conditions. You can use variables in such conditions. For example



Here you can see how we used lastSeen system variable. Bot will jump to the different screens depending on the time passed from the last user's query.

Note that you can use much complex Javascript expressions using variables to build conditions

Variables in HTTP requests

Variables can be used in HTTP requests to send some data to the external web services. Please refer to the HTTP Request block page to learn more about variables usage.
Was this article helpful?
Thank you!