Context variables
Create custom context for values to use across intent flows in NLX
Last updated
Create custom context for values to use across intent flows in NLX
Last updated
Context variables allow for conversational AI to retain context about something without the need to repeatedly run API calls or ask the user questions in order to recall the information. These are intended to be collected in a flow once and used throughout a session to better route users or personalize the conversation, including context passed along during escalation events.
Within the Context variables resource, you create the name and define the data type of the context variable, allowing you to reference it in any flow across your workspace as you design your conversations.
For example, after authenticating a user, you can reference a context variable that sets their authentication status as "true." In any intent flow that requires an authenticated person to complete a process, conditional logic can simply check the context variable rather than re-running a series of steps with the user to determine this context.
Other examples that may be collected once from user input or an API call and set for the duration of the conversation session:
User information, including name, address, ID, email, reward/member tier, DOB, etc.
Device/phone type
Issue, topic, or reason
Confirmation to a specific Yes/No question
A counter (keeping track of retries, etc.)
To access context variables, click Resources in your workspace menu and choose Context variables:
To create transient context that is not shared across flows or retained for escalation, consider using the Define node.
Begin by selecting + Add context variable from the Context variables resource:
Expand new variable > Enter name
Expand Schema section > Select type from the dropdown*
Click Save
*You may also select the <> Auto-generate schema option to input sample JSON for easily constructing your variable's schema structure.
Need to edit or delete a context variable?
After creating your context variable, you may expand its details to edit or delete your variable.
Once a context variable has been created, you may reference it easily in nodes when building a flow by selecting it from placeholder dropdowns or entering an open curly brace { in any message field. All context variables in your workspace are color-coded pink: