num to $var
The num to $var block is used to receive an integer number from the client and save it to a variable.
How to add it?
To add the block, select Add block → More blocks → num to $var.
The values of the variable received by the bot can be used in subsequent steps of the script (for example, to address the client by name), exported to .csv
or submitted to an external system (such as your database).
How does the block work?
The num to $var block expects the client to enter a number (including its text representation). The block will understand “5”, “five” or even options like “I believe it’s 5”.
You can use the $NUMBER
system variable in the Intents block to accept a number.
How to use it?
The num to $var block contains fields that can be filled out depending on your requirements.
HTML markup
You can use HTML markup in the bot messages. To do this, activate the Use HTML markup in the message toggle.
Message
This field contains the “Enter a number” text by default. You can put any message here, such as a question or a prompt to input some data. For example, “How old are you?”, “How many kids are you going to take with you?”, “How many pets do you have?”, etc.
Variable name
You can enter the name of the variable that will be used to store the client response in this field.
The variable name can be just about any string, but there are certain rules: use the Aa-Zz, _, 0-9 characters. Start the name with Aa-Zz. You may not use reserved JS words.
Learn more here. You can also find some info about JavaScript variables.