Conversation Flows — Script Node
Context: Instance Bot
All{{context.session}} variables from the instance bot are accessible under context.
Example: Access the user ID in a message node:
{{context.user_id}}
Context: Child Bot
Access a child bot’s context using either of the following:Context: Identify Returning Customers Within 24 Hours
This context variable identifies whether a Contact Center AI customer is a returning caller within 24 hours of their previous interaction. It applies to both digital and voice channels. Digital:- Returns
trueif the same user contacts the contact center within 24 hours of their last interaction. - Returns
falsefor first-time or non-returning users.
Content Variables
Access content variables defined in the instance bot using thecontent keyword:
Environment Variables
Access environment variables defined in the instance or parent bot using theenv keyword:
Call Flow Variables
Use these functions to get and set variables within the call flow context, making them available in Split or Message nodes later:Set Voice Chat on Voice Gateway Account
Use this script in a script node to set up voice chat for accounts configured with Voice Gateway:Set Preferred Language for Translation
During automation, the system can detect the user’s language and set it as the preferred translation language. Add this to a script node:Agent Utils
Agent Utils is a library for programmatic modifications to agent and flow behavior.Change SIP URI, Phone Number, and Referred By
Set User Info
Set or add customer information in the instance bot. Add this script inside theconnectToAgent node:
Set / Get Bot Languages
Set Queue
UseagentUtils.setQueue() to assign a queue at any point before agent transfer. Use it in a Script Node within a bot action or a Script Task in a Contact Center AI flow:
Set Live Chat Agent Transfer
Override the agent system for dynamic (multiple) live chat agent transfers:Set Named Agents
Restrict conversation assignment to one or more specific agents. The system assigns the conversation only to the specified agents. You can optionally configure the system to wait for a named agent to become available before falling back to queue routing.| Parameter | Description |
|---|---|
agentIds | Array of agent IDs eligible to receive the conversation. |
options | Optional configuration for wait behavior before queue fallback. |
Optional Wait Configuration
| Option | Description |
|---|---|
waitForAgent | When true, the system waits for a named agent before applying fallback routing. |
waitDurationSeconds | Maximum wait time in seconds. Default maximum is 3600s. If not specified or exceeds 3600s, defaults to 30s. |
- Without wait options: the conversation routes immediately to the queue if no named agent is available.
- With
waitForAgent: true:- The conversation enters a waiting for named agent state.
- It does not route to the queue during the wait period.
- If a named agent accepts within the wait duration, the conversation is assigned to that agent.
- If no named agent accepts in time, the conversation routes via normal queue logic.
- Standard availability rules (login state, capacity) apply.
- A maximum wait duration prevents indefinite waits.
Set Agent Matching Conditions
Add skills, skill groups, and agent groups to the script task to generate a matching set of agent IDs:Set Waiting Experience
Override the waiting experience at runtime:- Waiting experience overridden at the Agent Transfer node
- Waiting experience set via
agentUtils.setWaitingExperience()in the flow - Waiting experience configured within the dialog
Recording Control
Control interaction recordings from a script node:Enable/Disable Transcripts and Recordings
Control transcript and recording availability for agent transfers to the Contact Center AI Desktop.Disable Transcripts
- Transcripts are not accessible to the agent on the Live Interaction or Interactions pages.
- The following note appears near the transcripts widget: “Note: Certain parts of this call weren’t transcribed due to the applied transcription settings.”
Disable Recordings
- Voice call recordings are not generated for that agent interaction.
- The following note appears near the recording widget: “Note: Certain parts of this call were not recorded due to the applied recording settings.”
- If recordings are disabled globally, the existing global note is displayed instead.
Disable Both
- Apply these controls before initiating the agent transfer.
- These functions work only with transfers to Kore Agent Desktop.
- Controls affect only the specified agent interaction, not the entire conversation.
userSessionUtils
Get
Retrieve a value from theuserSession object in the conversation context:
Put
Store a key-value pair in theuserSession object:
Caller to userSession and stores the value of the caller variable.
Delete
Remove a key from theuserSession object:
Pass Data from Experience Flow to Dialog in a Child Bot
Use this script to pass data from an experience flow to a dialog in a child bot. The script node sets a variable using information from the current user session and stores it usinguserSessionUtils.
Access the Variable in a Child Bot Dialog
Reference the stored variable using:Store a Value from a Child Bot Dialog
To transfer data from a child bot dialog back to the experience flow:-
Store a value inside the child bot dialog:
-
Retrieve the context in the experience flow script node: