Cognigy

Cognigy.AI Docs

COGNIGY.AI is the Conversational AI Platform focused on the needs of large enterprises to develop, deploy and run Conversational AI’s on any conversational channel.

Given the arising need of voice interfaces as the most natural way of communicating with brands, Cognigy was founded in 2016 by Sascha Poggemann and Phil Heltewig. Our mission: to enable all devices and applications to intelligently communicate with their users via naturally spoken or written dialogue.

Get Started

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 is sent to the contact

data

any

the output data which is sent 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 the will be added to the completedGoals array

Returns

Promise

actions.setTimezoneOffset


Sets the timezone offset from UTC.

Parameters

Parameter

Type

Description

offset

number

The time 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

actions.removeFromContext


Removes information from the conversation's Context.

Parameters

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.

Returns

void

actions.deleteContext


Deletes the key and its values from the conversation's Context.

Parameters

Parameter

Type

Description

key

string

The key in the Context to remove information from

Returns

void

State

actions .setState


Is used to set the current State of this Conversation.

Parameters

Parameter

Type

Description

state

string

The State that should be activated.

Returns

void

actions .getState


Returns the current state.

Parameters

none

Returns

string : The current state.

actions .resetState


Resets the state of the flow to the default state

Parameters

none

Returns

Promise

Lexicon

actions .setKeyphrase


Parameters

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

Returns

void

actions .addLexiconKeyphrase


Adds a new keyphrase to a lexicon.

Parameters

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

Returns

Promise

Profile

actions .activateProfile


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.

Parameters

None

Returns

Promise

actions .updateProfile


Is used to update the users' Contact Profile.

Parameters

Parameter

Type

Description

key

string

Which field in the user's Contact Profile to update.

value

string

The value you want to set.

Returns

Promise

actions .mergeProfile


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.

Parameters

Parameter

Type

Description

contactId

string

The id of the contact you want to merge with the current contact who hit the Node.

Returns

Promise

actions .deactivateProfile


Is used to deactivate a specific contact profile in case a contact requests it.

Parameters

None

Returns

Promise

Updated 2 months ago


What's Next

Modules

Actions


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.