Using Variables throughout your bot is something an advanced bot can't do without! On the Bot Settings > Variables  section you can add them, name them and connect to a step in your bot or even a custom JavaScript function! Easy as that!

Please note that the Variables are case-sensitive and thus need to be written exactly the same!

Choosing the right Variable type

  • Name your variable and then select the desired variable type and set its settings:
    • Step variable type: Gets the value from the answer of the chosen step:
    • String variable type:
      • Gets the value from the entered static string (for example for storing often used phrases like addresses or company names)
    • Script variable type:

      • Gets the value from the provided javascript function, which can optionally access other variables allowing greater flexibility.

      • In this example custom asynchronous function provides a value for the variable script2:

      • If you need to use other variable's value in your script variable function, use variables argument.

      • In this example script variable named script3 uses value of the other variable named one:

      • If you need the textual value of the variable, not the actual value, you can use variables.<name>.text syntax

      • Please note that in case your script variable needs to use another script variable in order to calculate the result, you need to call the value with a callback.

      • In this example script variable named script uses the value of another variable named script3 to calculate the result:

      • If you need to get values from more than one script variables in order to perform the calculation, you can make use of the quriobot.async utility:

      • function(callback, variables)  {
              script3: variables.script3.value, 
              script4: variables.script4.value
        }, function(getValue, key, cb) {
            getValue(function (res) {
                cb(null, res);
            }, variables)
        }, function(err, results) {
            callback(results.script3 + results.script4)

Important note: Please keep in mind that the script-function scope is limited to it's arguments plus the following utility functions:

  • quriobot.ajax(url, callback, data, headers) - perform http requests (GET if no data parameter is passed)
  • quriobot.dotObject - imported dot-object package
  • quriobot.URL - imported url-parse package
  • quriobot.flatten - imported flat package
  • quriobot.mustache - imported mustache package
  • quriobot.moment - imported moment package
  • quriobot.numeral - imported numeral package
  • quriobot.async - imported async package
  • - storage object for saving persistent values between the visits and pages, if needed:
    • string) - get value by key
    •, value, [expires]) - set value by the key, optional expires parameter is in seconds

Where can you use these Variables? Almost everywhere!

  • Use them in your Chat Messages:
  • Use them as parameters in your redirect URL:
  • Use them within your Script messages or HTML fields:
  • Use them in Action responses to easily connect the bot other services, such as your CRM, Slack,  MailChimp newsletter signup or email automation to name just a few examples! 

How can I store the variable value along with the chat transcript, or use it in the jump  logic?

It is  possible to store the variable value for  the chat transcript and/or the jump logic by adding a Goto step with that variable's in the value setting:

And then you can use it in the jump logic:

Need more help or looking for inspiration? Join the Quriobot community!

Friendly & Fun
Interact & Convert