Skip to main content

Description

This Node stores information in the Context object, so that it can be used throughout the session on subsequent user inputs.

Parameters

ParameterTypeDescription
KeyCognigyScriptThe key where to store in the context. This can be a key nested with dot, for example my.first.key. Note that dashes or hyphens cannot be added to the key’s value.
ValueCognigyScriptThe value to store in the context.
ModeSelect
  • Simple — stores the value directly against the Key.
  • Array — stores the value into an Array on the key.
If you want to store an object in the context, use .preserveType() at the end in order to keep it an object. Example: input.slots.city[0].preserveType() would store the full slot object for the first found city entity in the context.
When adding a value to an array by using the addToContext Node, the value is not added if it already exists in the array. If you need to add a value to an array, no matter if the value already exists in the array, then you can use the .push() function in a Code Node.
I