Overview
This article outlines how to retrieve transcript data stored on Live Assist for Microsoft Dynamics 365. It describes the available REST methods and includes sample request and response structures.
Authentication
An authentication token must be passed in the Authentication header of all requests that are made to the transcript API. This is in the form of an application key.
- You can generate application keys through Live Assist for Microsoft Dynamics 365 administration portal.
- These keys are secret and must be kept secure.
- Each application key only works for the organization for which it was generated.
Retrieve transcript data for a chat
You can retrieve the transcript data for a chat by making the following request:
Method | URL |
---|---|
GET | https://{regionalurl}/api/transcript/v1/organization/{msorgid}/chatsession/{chatsessionid} |
Required headers
Header Name | Header Value |
---|---|
Authorization | Bearer APPLICATION_KEY |
Example CURL command
curl -i https://service.na1.liveassistfor365.com/api/transcript/v1/organization/YOUR-ORG-ID/chatsession/CHAT-SESSION-ID -H "Authorization: Bearer YOUR-APPLICATION-KEY"
Required URL parameters
These parameters are in the URL above.
Parameter Name | Parameter Value |
---|---|
{regionalurl} | The Live Assist for Microsoft Dynamics 365 service is hosted out of different regions. Transcript API requests need to be made to the region where the service is hosted for the required organization. Regional URLs are documented and static. |
{msorgid} | The Microsoft Organization ID. This is available in Dynamics 365, by making a request to /api/data/v8.1/organizations The ID is returned in the organizationid attribute of the response. |
{chatsessionid} | The Live Assist chat session ID. This is the ID of the chat that the transcript will be retrieved for. This is available in Dynamics 365 by making a request to /api/data/v8.1/cxlvhlp_chatactivities for the appropriate chat. The ID is returned in the cxlvhlp_chatsessionid attribute of the response. |
Response
Response Code | Result |
---|---|
200 | A chat was found with the given ID. Transcript details are in the response body. |
401 | Unauthorized. The Authorization header was either missing or invalid. |
404 | A chat was not found with the given ID. |
On receiving a 200 response, the response body is as in the following example:
{ "transcript": { "lines": [ { "author": "system", "time": "2018-02-20 10:02:11.524+0000", "timestampMillis": 1519120931524, "textType": "plain", "text": "Thank you for choosing to chat with us.An agent will be with you shortly." }, { "author": "agent", "time": "2018-02-20 10:02:32.910+0000", "timestampMillis": 1519120952910, "textType": "plain", "text": "Hi, how may I help today?", "agentDisplayName": "Bob", "agentSystemUserId": "b2f434e0-eb85-44f0-a4c5-44e3c14c6160", "privateMessage": false }, { "author": "visitor", "time": "2018-02-20 10:02:43.336+0000", "timestampMillis": 1519120963336, "textType": "plain", "text": "I have a problem" }, { "author": "agent", "time": "2018-02-20 10:03:24.183+0000", "timestampMillis": 1519121004183, "textType": "plain", "text": "This is a private message that the visitor cannot see.", "agentDisplayName": "Bob", "agentSystemUserId": "b2f434e0-eb85-44f0-a4c5-44e3c14c6160", "privateMessage": true } ] } }
The response contains an object with a transcript attribute. The transcript attribute contains an array of line objects in its lines attribute.
A line object consists of the following:
Attribute Name | Attribute value | Notes | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
author | String: “system”, “agent” or “visitor” |
|||||||||||||||||
time | String: Time the message was sent; in the format: “YYYY-MM-dd HH:mm:ss.SSSZ” |
|
||||||||||||||||
timestampMillis | Numeric: Same as the time attribute, but as a timestamp in milliseconds. This is the number of milliseconds since: 1970-01-01 00:00:00.000+0000 |
|||||||||||||||||
textType | String: “plain” or “html” |
|||||||||||||||||
text | String: The message text |
|||||||||||||||||
agentDisplayName | String: The display name of the agent who sent the message at the time the message was sent. If a bot sent the message, this is the bot’s display name. |
Only present for messages with the author type of agent. | ||||||||||||||||
agentSystemUserId | String: The System user ID of the user in Microsoft Dynamics CRM. |
Only present for messages with the author type of agent, where the agent who wrote the message is still present in CRM. This field is not present for bot messages. |
||||||||||||||||
privateMessage | Boolean: true or false True if this is a private message (which visitors cannot see). |
Only present for messages with the author type of agent. |