Skip to main content

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:

VariableDescription
$clientA storage for persistent data related to the current bot user.
$contextA 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.
$entitiesThe list of all NLU entities recognized in the user request.
$injectorThe set of properties specified during bot deployment or script connection.
$parseTreeAn object representing the result of matching the input phrase against named patterns and entities, as well as the results of value conversions.
$requestAn object containing the user request data.
$responseAn object for forming the bot response.
$sessionA storage for data related to the current session.
$tempA storage for temporary data which only exists while processing a single user request.

You can access any built-in variable in a JS file by removing the $ prefix and prepending its name with $jsapi.context(). For example, $session can be referenced as $jsapi.context().session, and this value can be assigned to a local variable with the same name:

var $session = $jsapi.context().session;