This article explains how to access the session ID in Kore.ai for both chat and call interactions.
Chat Interactions:
For chat interactions, the session ID can be retrieved directly from the context object using the following JSON path:
Copy
{{JSON.stringify(context.BotUserSession.channels[0].sessionId)}}
Experience flow:
Interaction screenshot:
For call interactions, the context object structure is different, and the session ID cannot be accessed directly.
Here’s what you need to do:
Users will need to use the below setCallFlowVariable utils script so that you can access the context object.
Here’s the script:
Copy
setCallFlowVariable('sessionID',context.BotUserSession.conversationSessionId);
var sessionID = getCallFlowVariable('sessionID');
userSessionUtils.put("sessionID", sessionID);
Now we can access the session ID directly from SmartAssist or bot builder (XO).
To access the session ID from the SmartAssist message node use the below code in the message node.
below is the working sample of accessing the session ID in the call.
Content by @praveen.adari