Actions
Description

Within a Code Node you are able to use the functions of the actions class.
Misc

actions.output / actions.say
Performs a simple output to the contact - similiar to the Say Node.
Parameters
Parameter | Type | Description |
---|---|---|
text | string | The output text which gets send to the contact |
data | any | the output data which gets send to the contact |
Returns
void
actions.completeGoal
Adds a defined goal to the completedGoals array in the Input Object.
Parameters
Parameter | Type | Description |
---|---|---|
key | string | name of the goal to add to the completedGoals array |
Returns
Promise
actions.setTimezoneOffset
Sets the timezone offset from UTC.
Parameters
Parameter | Type | Description |
---|---|---|
offset | number | The offset in hours |
Returns
void
actions.setForwardDatesOnly
Sets the NLU Parser to only detect dates in the future for DATE slots.
Please Note: This setting will take effect on the next input only
Parameters
value | boolean | Whether to only detect future dates for DATE slots |
Returns
void
actions.log
Writes a message to the project logs.
Parameters
Parameter | Type | Description |
---|---|---|
level | string | The log level, e.g. debug or info |
text | string | The message for the logs |
Returns
void
actions.think
Is used to re-execute the Flow within one invocation.
The Flow will stop and then restart executing at the Start Node.
Parameters
Parameter | Type | Description |
---|---|---|
text | string | A simulated message text from the user. |
data | any | Simulated message data from the user. |
Returns
void
Context

actions.setContext
Deprecation Warning
This action will be removed and no longer work in Cognigy.AI Version 4.0. Please use actions.addToContext instead.
Sets the context of a flow to a specified value.
Parameters
Parameter | Type | Description |
---|---|---|
key | string | Where to store the data in the Context. |
*value | any | The value to store in the Context. |
Returns
void
actions.addToContext
Is used to simplify storing information into the conversation's Context.
Parameters
Parameter | Type | Description |
---|---|---|
key | string | Where to store the data in the Context. |
value | string | The value to store in the Context. |
mode | string | In simple mode, will replace existing values, in array mode, it will store information in an array and push new results into that array. |
Returns
void
actions.getContext
Gets the data from the context by the key.
Parameters
Parameter | Type | Description |
---|---|---|
key | string | Where to retrieve the data from the context. |
Returns
any : The requested context data
actions.resetContext
Resets the context.
Parameters
none
Returns
Promise
Removes information from the conversation's Context. void Deletes the key and its values from the conversation's Context. void Is used to set the current State of this Conversation. void Returns the current state. none string : The current state. Resets the state of the flow to the default state none Promise void Adds a new keyphrase to a lexicon. Promise Is used to reactivate a profile that has been deactivated, in case the user disabled data collection by mistake or wants to allow data collection again. None Promise Is used to update the users' Contact Profile. Promise Is used to merge the profile of the contact who hits the node with another contact profile. This is useful in an omni-channel environment, where a contact can talk to your Flow on different platforms, but wants to be recognized as the same person on all platforms. Promise Is used to deactivate a specific contact profile in case a contact requests it. None Promise
Parameter Type Description key string The key in the Context to remove information from value string The value to remove (in array mode) mode string In simple mode will remove the property completely, in array move it will remove matching values from that array.
Parameter Type Description key string The key in the Context to remove information from
Parameter Type Description state string The State that should be activated.
Parameter Type Description keyphrase string The Keyphrase you want to set tags string[] Tags you want to attach to the Keyphrase synonyms (optional) string[] Synonyms you want to attach to the Keyphrase
Parameter Type Description lexiconId string The ID of the Lexicon you want to update keyphrase string The Keyphrase you want to add to the Lexicon tags any Tags you want to attach to the Keyphrase synonyms any Synonyms you want to attach to the Keyphrase
Parameter Type Description key string Which field in the user's Contact Profile to update. value string The value you want to set.
Parameter Type Description contactId string The id of the contact you want to merge with the current contact who hit the Node.
Updated over 3 years ago