Built-in variables
The following variables can be referenced in script extensions specified after the if
, else
, elseif
, script
tags and string substitutions {{}}
in reactions:
Variable | Description |
---|---|
$client | A storage for persistent data related to the current bot user. |
$context | A structure which represents the current runtime context of the request and contains references to all the other built-in variables, as well as a few special fields. |
$entities | The list of all NLU entities recognized in the user request. |
$injector | The set of properties specified during bot deployment or script connection. |
$parseTree | An object representing the result of matching the input phrase against named patterns and entities, as well as the results of value conversions. |
$request | An object containing the user request data. |
$response | An object for forming the bot response. |
$session | A storage for data related to the current session. |
$temp | A storage for temporary data which only exists while processing a single user request. |
Access variables in JS files and JS actions
You cannot access the built-in variables directly:
- in JS actions;
- in JS files if the functions will be executed in the ECMAScript 5 runtime.
In these cases, use the $jsapi.context
method.
ECMAScript 6
You can access the built-in variables directly in JS files if the functions are synchronous and will be executed in the ECMAScript 6 runtime.