Context variables

Last Updated: 25.10.2019

Overview

A context variable is a variable that you define in a node. You can specify a default context variable values in the root node, or you can create the context variables during the conversation with the user. Those context variables can be in use in any dialog nodes of the skill.

Basically the context variable is the information or values that you want to keep and reuse during the conversation.

You also can use context variables as a condition for triggering the nodes.

System context variables

By default, the system has the next context variables:

System variable

Description

user.firstName

Includes the first name of the authorized user

user.lastName

Includes the last name of the authorized user

user.email

Includes the email of the authorized user

context.formResult

The context is using in the forms that can be added in output. The context context.formResult will include all the information that the user will provide during the form filling.

context.formCanceled

In case of user will cancel the form filling, the information about this action will be stored in the context context.formCanceled

Accessing the context variables

To include a context variable value in the output, use the syntax {{context.variable_name}} to specify it. For example, in the system by default, you have the context variable user.firstName and user.lastName. You can use these context variables or any of your custom context variables in the output.

Example 1 - system context variables

You will see the following results in the chat:

Example 2 - custom context variables

The end-user will get next response in the chat:

Last updated