Overview
Tag conversations with auserId to track per-user chat history. Once a conversation is associated with a user, you can list all of that user’s conversations and continue any of them by passing the conversationId.
Setting a User ID
PassuserId when creating a new conversation. The ID must follow these constraints:
userId:
Continuing a Conversation
To send follow-up messages in the same conversation, pass theconversationId from a previous response:
If the conversation has ended (e.g. after a human takeover), the API returns a
CHAT_CONVERSATION_NOT_ONGOING error. Start a new conversation instead.Listing a User’s Conversations
Retrieve all conversations for a specific user withGET /api/v2/agents/{agentId}/users/{userId}/conversations.
Path Parameters
Query Parameters
Response
Response Fields
Pagination Examples
Full Example
1
Start a conversation with a user ID
Send the first message with a Save the
userId to associate the conversation:conversationId from the finish event.2
Send a follow-up message
Continue the conversation by passing the
conversationId:3
List the user's conversations
Retrieve all conversations for the user:
Exporting All Conversations
The Export conversations endpoint returns all conversations with full message history, regardless of source. This is different from the list endpoints above, which only return API-created conversations.Key differences from list endpoints
Conversation sources
Exported conversations include asource field indicating where the conversation originated:
API, WhatsApp, Messenger, Instagram, Slack, Salesforce, Zendesk, Zendesk Messaging, Widget or Iframe, Iframe, Email, Agent page, Phone, Android SDK, iOS SDK, Chatbase site, Playground, and others.
Message format
Each conversation includes amessages array. Messages contain parts, which can be:
Tool result output shape
All tool results in the export follow a unified shape, so you can handle them with a singleswitch on status:
Example response
Paginating through all exports
Related
Streaming
Learn about streaming responses and event types.
Pagination
How cursor-based pagination works across all list endpoints.
Export Conversations
Full API reference for the export endpoint.
Client Actions
How tool calls and tool results work in conversations.
