This topic explains how to link the chat history of an audio/video (A/V) call with an existing message conversation when the call is initiated.
Overview
In a message conversation, you can consolidate the chat history between a user and A/V call agents with the history from chatbot agents to form a complete chat log.
Feature description
In Real-time Conversational AI, a Session ID identifies the conversational relationship between a user and an agent, ensuring every interaction is fully recorded and traceable. Using this unique identifier, the system can recognize and organize multiple turns of dialogue initiated by the same user at different times, creating a coherent chat history. You can also use the Session ID to link all chat records between a user and both A/V call agents and chatbot agents.
Link message and A/V call chat history
Business flow
Real-time Conversational AI uses a single SessionID to link all chat records for a user with both chatbot agents and A/V call agents (such as voice call, avatar call, and vision call). To merge the chat history from a message conversation with a subsequent A/V call, you must pass the ChatSyncConfig field, containing the chatbot agent's ID and the Session ID, when initiating the A/V call.
Code implementation
Initiate the A/V call via the client-side AICallKit SDK and configure the ARTCAICallChatSyncConfig parameter in ARTCAICallConfig. Sample code:
Android
//Create ARTCAICallConfig, configure ARTCAICallConfig and ARTCAICallChatSyncConfig parameters.
ARTCAICallEngine.ARTCAICallConfig artcaiCallConfig = new ARTCAICallEngine.ARTCAICallConfig();
//Configure ARTCAICallChatSyncConfig parameters.
artcaiCallConfig.mAiCallChatSyncConfig.chatBotAgentId = "XXX";// ID of the associated chatbot agent.
artcaiCallConfig.mAiCallChatSyncConfig.sessionId = "XXX";// The SessionID provided by your application.
artcaiCallConfig.mAiCallChatSyncConfig.receiverId = "XXX";// User ID: The unique identifier for the user in your system.
// Configuration of ARTCAICallConfig parameters and initiation process are omitted
iOS
// Create ARTCAICallChatSyncConfig object and set parameters.
let agentId = "xxx" // ID of the associated chatbot agent
let sessionId = "xxx" // The SessionID provided by your application.
let receiverId = "xxxx" // User ID: The unique identifier for a user in your system.
let chatSyncConfig = ARTCAICallChatSyncConfig(sessionId: sessionId, agentId: agentId, receiverId: receiverId)
// If you use the integration solution with UI, set config.chatSyncConfig when you start a call.
let controller = AUIAICallStandardController(userId: userId)
controller.config.chatSyncConfig = chatSyncConfig
...
// If you use the integration solution without UI, convert chatSyncConfig to a json string and use it with sessionId as request parameters for starting an AI call (StartAIAgentInstance or GenerateAIAgentCall).
let chatSyncConfigJsonString = chatSyncConfig.getConfigString()
let sessionId = chatSyncConfig.sessionId
...
Web
// Create ARTCAICallChatSyncConfig object and set parameters.
const sessionId = 'xxx'; // The SessionID provided by your application
const agentId = 'xxx'; // ID of the associated chatbot agent.
const receiverId = 'xxxx'; // User ID: The unique identifier for a user in your system.
const chatSyncConfig = new AICallChatSyncConfig(sessionId, agentId, receiverId);
// Create ARTCAICallConfig object, set interruptWords parameter.
let callConfig = new ARTCAICallConfig();
callConfig.chatSyncConfig = chatSyncConfig;
// If you use the integration solution with UI, modify src/runConfig.ts.
const runConfig: AICallRunConfig = {
// ...
callAgentConfig: callConfig,
// ...
};
// If you use the integration solution without UI, convert chatSyncConfig to a json string and use it with sessionId as request parameters for starting an AI call (StartAIAgentInstance or GenerateAIAgentCall).
const chatSyncConfigJsonString = chatSyncConfig.getConfigString();
const sessionId = chatSyncConfig.sessionId;
...