Using global variables

You can define global variables in the bot configuration. You can use these in any interactions belonging to the bot. For example, multiple interactions referencing a URL can be updated once and the update will populate all interactions using this variable. This is useful where you have multiple domains for testing and production.

The globals object holds an array of any global variables defined in the bot configuration.

To define a global variable:

  1. In Designer, click Config and then go to the Defaults tab.
  2. Under Global variables:
    1. Enter the variable name. For example host.
    2. Enter the value. For example http://example.com.
    3. Click +Add to add the global variable.

To use a global variable in URL fields, messages and so on, enter the variable like this:

{globals.<variable name>}

For example:

{globals.host}/path/to/image
The globals object is read-only. In action interactions, on the Set Variable page, you can access global variables like this:
var myserver = globals.myserver