api classes. These functions are also available in Extension Nodes. For example, you can use the api object to execute api.say().
actions and api. Now, only api is supported. Use api functions for all implementations.CognigyScript
Use these functions to parse and evaluate CognigyScript expressions in text or conditions at run-time.api.parseCognigyScript
api.parseCognigyScript
Promise<any>Exampleapi.parseCognigyScriptCondition
api.parseCognigyScriptCondition
true or false value.CognigyScript allows you to embed expressions like {{context.value > 5}} within strings. This function extracts and evaluates such an expression, used in logic checks for Flows, conditions, or custom functions.This function is useful for dynamically checking conditions at run-time based on session data and information from the Input, Context, or Profile objects.ParametersPromise<string>Exampleapi.parseCognigyScriptText
api.parseCognigyScriptText
{{cc.userName}}, is evaluated using the current execution context.ParametersPromise<string>ExampleContact Profiles
Use these functions to activate, deactivate, delete, merge, and update Contact Profiles during a conversation.api.activateProfile
api.activateProfile
Promise<any>Exampleapi.addContactMemory
api.addContactMemory
api.deactivateProfile
api.deactivateProfile
Promise<any>Exampleapi.deleteProfile
api.deleteProfile
Promise<any>Exampleapi.mergeProfile
api.mergeProfile
Promise<any>Exampleapi.updateProfile
api.updateProfile
Promise<any>ExampleContext Object
Use these functions to read, write, and reset the Context object so you can store and manipulate conversation-scoped data across Nodes.api.addToContext
api.addToContext
voidExampleapi.deleteContext
api.deleteContext
voidExampleapi.getContext
api.getContext
any: The requested context data.Exampleapi.getConversationTranscript
api.getConversationTranscript
api.removeFromContext
api.removeFromContext
voidExampleapi.resetContext
api.resetContext
voidExampleapi.setContext
api.setContext
voidExampleEncoding and Decoding
Use these functions to handle string encoding and decoding, such as converting text to Base64 for safe transmission or decoding Base64 strings back to UTF-8.api.base64Decode
api.base64Decode
string: The decoded string as UTF-8.Exampleapi.base64Encode
api.base64Encode
string: The base64 encoded string.ExampleExecution Control
Use these functions to control Flow execution, including adding conditional Entrypoints, jumping to specific Nodes or Flows, resetting overrides, stopping execution, and simulating new inputs.api.addConditionalEntrypoint
api.addConditionalEntrypoint
{condition} is met within the next {retentionTime} inputs, Flow execution starts at {entrypoint}.ParametersvoidExampleapi.resetNextNodes
api.resetNextNodes
api.setNextNode function, and you want to return to the default Flow behavior.ParametersNoneReturnsvoidExampleapi.setNextNode
api.setNextNode
nodeId to be executed immediately after the current one.
This function is used by If and Lookup Nodes to select child Nodes based on their configuration.ParametersvoidExampleapi.stopExecution
api.stopExecution
voidExampleapi.thinkV2
api.thinkV2
voidExampleInput and Output
Use these functions to enrich the Input object and send text or data responses to the user from a Code or Extension Node.api.addToInput
api.addToInput
voidExampleapi.output / api.say
api.output / api.say
_cognigy is an internal parameter and not part of the public API. This parameter is unsupported and may change without notice.voidExampleLogging and Monitoring
Use these functions to write Project logs, send debug messages, inspect LLM token usage, track analytics steps, and configure sensitive logging behavior.api.completeGoal
api.completeGoal
Promise<void>Exampleapi.emitToOpsCenter
api.emitToOpsCenter
Flow and the subcomponent to FlowNodeExecution.ParametersvoidExampleapi.getLLMTokenUsageForSession
api.getLLMTokenUsageForSession
api.log
api.log
voidExampleapi.logDebugMessage / api.logDebugError
api.logDebugMessage / api.logDebugError
voidExampleapi.setSensitiveLoggingSettings
api.setSensitiveLoggingSettings
voidExampleapi.trackAnalyticsStep
api.trackAnalyticsStep
voidExampleStates (deprecated)
Use these functions to get, set, and reset the conversation State of a Flow.api.getState
api.getState
stringExampleapi.resetState
api.resetState
Promise<string>Exampleapi.setState
api.setState
voidExamplexApps
Use these functions to manage conversations with xApps.api.setAppState
api.setAppState
voidExampleOther
Use these functions to manage conversation behavior, such as adding Keyphrases, handling handovers, and localization settings.api.addLexiconKeyphrase
api.addLexiconKeyphrase
Promise<string>Exampleapi.evaluateRule
api.evaluateRule
left, operand, right pattern. This function works similarly to the If Node. The left value is compared with the right value using the specified operator, for example, !=, >, includes. If the condition evaluates to true, the associated logic or transition is executed.ParametersPromise<boolean>Exampleapi.handover
api.handover
Promise<void>Exampleapi.setLocaleReferenceId
api.setLocaleReferenceId
voidExampleapi.setRating
api.setRating
voidExampleapi.setTimezoneOffset
api.setTimezoneOffset
input.currentTime.timezoneOffset.ParametersvoidExample