GET/ conversations/ :id/
Get single conversation
You can return details about a specific conversation.
Attributes
Optional unless marked required
- id
- A unique identifier for the conversation which is given by User automatically.
Request
- cURL
- JavaScript
- PHP
- Python
curl -X GET "https://<your_app_subdomain>.user.com/api/public/conversations/:id/" \
-H "Authorization: Token <your_64_char_api_key>" \
-H "Accept: */*; version=2"
const response = await fetch(
"https://<your_app_subdomain>.user.com/api/public/conversations/:id/",
{
method: "GET",
headers: {
Authorization: "Token <your_64_char_api_key>",
Accept: "*/*; version=2",
},
},
);
const data = await response.json();
console.log(data);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://<your_app_subdomain>.user.com/api/public/conversations/:id/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Token <your_64_char_api_key>",
"Accept: */*; version=2",
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
response = requests.get(
"https://<your_app_subdomain>.user.com/api/public/conversations/:id/",
headers={
"Authorization": "Token <your_64_char_api_key>",
"Accept": "*/*; version=2",
},
)
print(response.json())
Response examples
- 200 OK
- 404 Not Found
{"count": 1,"next": null,"previous": null,"results": {"id": 1,"assigned_to": {"id": 1,"key": "g7lvoickax9e","name": "Jane Agent","email": "agent@example.com"},"active": true,"agent": {"id": 1,"name": "Jane Agent"},"messages": [8 fields]}}{
"detail": "No Conversation matches the given query."
}
Response fields
Fields returned in the 200 OK response body.
- count
- Number of results across all pages. It can lag behind recent changes; see Response pagination.
- next
- URL of the next page of results. null on the last page.
- previous
- URL of the previous page of results. null on the first page.
- results
- Results on this page.
- results.
id - A unique identifier for the conversation which is given by User automatically.
- results.
assigned_to - The contact the conversation is with.
- results.
assigned_to. id - ID of the contact.
- results.
assigned_to. key - The contact's
user_key: a 12-character identifier assigned by User. - results.
assigned_to. name - The contact's name.
- results.
assigned_to. email - The contact's email address, or
nullif they have none.
- results.
- results.
active - Whether the conversation is open.
falseonce it is closed. - results.
agent - The agent group the conversation is assigned to, or
null.- results.
agent. id - ID of the agent group.
- results.
agent. name - Name of the agent group.
- results.
- results.
messages - Messages in the conversation, newest first, 25 per page.
- results.
messages[]. id - A unique identifier for the conversation which is given by User automatically.
- results.
messages[]. chat - ID of the conversation the message belongs to.
- results.
messages[]. user - Who wrote the message.
- results.
messages[]. user. id - A unique identifier for the conversation which is given by User automatically.
- results.
messages[]. user. key - The contact's
user_key, ornullwhen an agent wrote the message. - results.
messages[]. user. name - Name of the contact or agent who wrote the message.
- results.
messages[]. user. email - Email address of the contact or agent who wrote the message.
- results.
- results.
messages[]. content - A content of a message sent to the user.
- results.
messages[]. timestamp - When the message was sent, ISO 8601.
- results.
messages[]. source_context - An additional context for your source (only visible for you).
- results.
messages[]. source - Where the message was sent from, as a label, for example
Chat,EmailorAPI. See Message source types. - results.
messages[]. attachments - Files and images sent with the message, or the details of a conversation event (such as an assignment) for an event message;
nullif there are none.- results.
messages[]. attachments. type - Kind of conversation event, for example
assignee_changed,chat_openedorchat_closed. - results.
messages[]. attachments. agent_id - ID of the agent who assigned the conversation.
- results.
messages[]. attachments. assignee - Name of the agent group the conversation was assigned to.
- results.
messages[]. attachments. meta_text - Template of the event text shown in the conversation, with placeholders such as
{assignee}and{assigned_by}. - results.
messages[]. attachments. assigned_by - Name of the agent who assigned the conversation.
- results.
- results.
- results.
note
Errors that can come from any endpoint (401, 429, 500, 502, 504) are described in HTTP response codes.