From Bright Pattern Documentation
getChatTranscript
Gets the chat transcript for a chat interaction and returns the list of messages exchanged during the chat. Only available for Communicator Widget 2.0.
Request
Syntax
| getChatTranscript(interactionId?: string): Promise<OperationResult<ChatTranscript>> |
Where:
type ChatTranscript = {
messages: ChatTranscriptMessage[] } type ChatTranscriptMessage = { id: string timestamp: number text: string senderName: string type: "normal" | "system" } |
Parameters
| Parameters | Parameter Values | Data Type | Optional/Required | Description |
| interactionId | String | Optional | The chat interaction for which to get the transcript. If the interactionId is omitted, the currently active interaction will be used. |
Example Request
getChatTranscriptButton.onclick = async () => {
const interactionId = interactionsList[0]?.interactionId;
const result = await adApi.getChatTranscript(interactionId);
if (result.status === "success") {
console.log(result.data.messages);
}
};
Return Value
| Object | Object Values | Data Type | Optional? (Y/N) | Value Description |
| ChatTranscript | ||||
| messages | ChatTranscriptMessage[] | N | Array of chat messages | |
| id | String | N | Unique message ID | |
| timestamp | Number | N | Message timestamp | |
| text | String | N | Message text content | |
| senderName | String | N | Display name of the sender | |
| type | String | N | Message type: "normal" or "system" |