Skip to main content

Overview

Conversation History lets you retrieve the full record of a single session so you can review past messages, power support workflows, or run analytics. You request history by providing the routerSessionId. This identifier is included with Router traffic, for example when routing messages or events. The API can return just messages, messages with session events, or only events - depending on your query parameters. You can also request a summary in the response metadata and, if needed, delete a session’s history. A separate, paged endpoint is also available to fetch a conversation's transcript on demand, optionally transformed through a configured pipeline (for example to translate it into a language of your choice).

When calling our APIs we require an authentication token to be present. Please refer to our authentication page for details.

Endpoints

Get session history​

This API also supports retrieving session events - you can include events with messages by adding the includeEvents=true query parameter.

You can also only fetch events without messages by adding the includeMessages=false query parameter.

This endpoint also allows you to fetch conversation history including a summary by setting includeSummary=true. You can also specify the language in which the summary should be and the maximum length.

Endpoint: GET https://api.cm.com/router/conversation-history/v1/accounts/{accountId}/session-history?routerSessionId={sessionId}&includeEvents={true/false}&includeMessages={true/false}&includeSummary={true/false}&summaryLanguage={lan}&maxSummaryLength={length}

Header: X-CM-PRODUCTTOKEN: 00000000-0000-0000-0000-000000000000

Permission: ConversationalRouter.SessionHistory_Read

FieldTypeDescription
accountIdGuidThe ID of logical account
routerSessionIdGuidIdentifier of the session
includeEventsbooleanWhen true, session events are included in the response alongside messages. Default value is false
includeMessagesbooleanWhen false, messages are omitted and only events are returned. Default value is true
includeSummarybooleanWhen true, a summary of the conversation is included in the response metadata. Default value is false
summaryLanguagestringThe language the summary should be generated in. Requires includeSummary=true
maxSummaryLengthintThe maximum length of the summary. Default value is 20

📘 Setting parameters

includeEvents and includeMessages cannot both be false — at least one must be requested, otherwise the endpoint returns 400 Bad Request. Setting summaryLanguage without includeSummary=true also returns 400. When the session has no stored history, the endpoint returns 204 No Content.

Response body

FieldTypeDescription
accountIdGuidThe ID of the logical account
sessionIdGuidIdentifier of the session. Also returned as conversationId (the same value)
chatIdGuidThe hashed ID of the chat the session belongs to
conversationHistoryarrayThe messages and/or events for that session, in the TwoWay conversationMessages / conversationEvents format
metadataobjectMetadata about the session history (see below)

Metadata properties:

FieldTypeDescription
summarystringA summary of the conversation’s text messages. Only present when includeSummary=true; if the conversation is too short to summarize, a short explanatory message is returned instead

Get session IDs for a chat​

Returns the IDs of all sessions recorded for a given chat, so you can discover which sessions exist before fetching each session’s history.

Endpoint: GET https://api.cm.com/router/conversation-history/v1/accounts/{accountId}/chats/{chatHashedId}/session-ids

Header: X-CM-PRODUCTTOKEN: 00000000-0000-0000-0000-000000000000

Permission: ConversationalRouter.SessionHistory_Read

FieldTypeDescription
accountIdGuidThe ID of logical account
chatHashedIdGuidThe hashed ID of the chat

Response body

FieldTypeDescription
accountIdGuidThe ID of the logical account
chatIdGuidThe hashed ID of the chat
sessionIdsarray of GuidThe session IDs recorded for this chat. Also returned as conversationIds (the same values)

When the chat has no recorded sessions, the endpoint returns 204 No Content.

Get conversation transcription​

This endpoint returns a conversation's full transcript as a chronological, paged list of messages, intended for handing a conversation over to a human agent or another system - for example when escalating a bot conversation, or archiving it. You provide the conversationId, which is the same identifier the session history endpoint returns as sessionId (also returned there as conversationId).

Optionally, each message can be run through a configured pipeline before it is returned by setting transformWithPipelineId - for example a translation pipeline, so you can fetch an on-demand transcript in a language of your choice by also setting hostLanguage. Per-message pipeline enrichment (detected language, extracted entities, sentiment, translation, redactions) is omitted by default; set includeEnrichment=true to include it.

Endpoint: GET https://api.cm.com/router/conversation-history/v2/accounts/{accountId}/conversations/{conversationId}/transcription?transformWithPipelineId={pipelineId}&hostLanguage={lan}&includeEnrichment={true/false}&cursor={cursor}

Header: X-CM-PRODUCTTOKEN: 00000000-0000-0000-0000-000000000000

Permission: ConversationalRouter.SessionHistory_Read

FieldTypeDescription
accountIdGuidThe ID of logical account
conversationIdGuidIdentifier of the conversation. The same value the session history endpoint returns as sessionId / conversationId
transformWithPipelineIdGuidOptional. ID of a configured pipeline to run over each message before it is returned, for example a translation pipeline. Omit to get the plain transcript
hostLanguagestringOptional. Overrides the pipeline's translation target language for this call (e.g. nl, en). Only meaningful together with transformWithPipelineId; ignored when the pipeline has no translation step
includeEnrichmentbooleanOptional. When true, includes per-message pipeline enrichment (detected language, extracted entities, sentiment, translation, redactions) on each message. Default value is false
cursorstringOptional. Page cursor, as returned in nextCursor by a previous call. Omit to start from the beginning of the conversation

📘 Setting parameters

The response is paged: a page's size is based on how much text it contains rather than a fixed number of messages, so page sizes vary. Repeat the request with the returned nextCursor - keeping the same query parameters - until nextCursor is null to walk the whole conversation. An invalid cursor returns 400 Bad Request.

If the pipeline transformation fails, the transcript is returned untransformed rather than the request failing - the response carries no error marker for this, so a failed transform cannot be detected from the response alone. Only text messages are transformed; other message types (media, carousels, etc.) pass through unchanged.

includeEnrichment defaults to false because enrichment can contain the original values a redaction step removed from the message text - only enable it when your integration needs that detail.

Response body

FieldTypeDescription
accountIdGuidThe ID of the logical account
conversationIdGuidIdentifier of the conversation
entriesarrayThe conversation's messages, in chronological order (see below)
nextCursorstringCursor for the next page, or null when this is the last page

Each entry:

FieldTypeDescription
entryIdGuidIdentifier of the entry
occurredAtdatetimeWhen the message occurred
entryTypestringAlways message on this endpoint
subTypestringMessage discriminator, e.g. text
directionstringclientOriginated or clientTerminated
flowIdGuidThe flow the message was routed through, if any
stateIdGuidThe state the message was routed through, if any
sourceApplicationIdGuidThe application the message originated from, if any
targetApplicationIdsarray of GuidThe applications the message was routed to
routingDurationMslongHow long routing the message took, in milliseconds, if applicable
pipelineDurationMslongHow long the pipeline transform took, in milliseconds. Only present when transformWithPipelineId was set
messageobjectThe message content in the TwoWay rich message format. When a pipeline was applied, the transformed text is on message.text; enrichment, when includeEnrichment=true was set, is on message.pipelineEnrichment

This endpoint returns messages only - it does not include deliveries, event, or routerAction entries.

Delete session history​

If your use case requires it, you can delete a session’s stored history.

Endpoint: DELETE https://api.cm.com/router/conversation-history/v1/accounts/{accountId}/session-history/{sessionId}

Header: X-CM-PRODUCTTOKEN: 00000000-0000-0000-0000-000000000000

Permission: ConversationalRouter.SessionHistory_Delete

FieldTypeDescription
accountIdGuidThe ID of logical account
sessionIdGuidIdentifier of the session