Retrieve a conversation
curl --request GET \
--url https://api.chatling.ai/v3/conversations/{conversation} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.chatling.ai/v3/conversations/{conversation}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.chatling.ai/v3/conversations/{conversation}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.chatling.ai/v3/conversations/{conversation}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.chatling.ai/v3/conversations/{conversation}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.chatling.ai/v3/conversations/{conversation}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.chatling.ai/v3/conversations/{conversation}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"object": "conversation",
"id": "5f0c1c2e-6c1d-4a8f-9a59-0d4c4f1b2a10",
"agent": {
"id": "3132353852",
"type": "ai_agent",
"name": "Support agent"
},
"channel": "web",
"user_id": "0b6f3c1e-8d2a-4f5b-9c7e-1a2b3c4d5e6f",
"external_user_id": "<string>",
"status": "open",
"mode": "ai",
"ended_at": "2023-11-07T05:31:56Z",
"read": true,
"important": true,
"priority": "low",
"labels": [
{
"id": "<string>",
"name": "<string>"
}
],
"topics": [
{
"id": "<string>",
"name": "<string>",
"source": "ai"
}
],
"sentiment": "positive",
"assignee": {
"id": "<string>",
"name": "<string>"
},
"team": {
"id": "<string>",
"name": "<string>"
},
"contact": {
"id": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"phone": "<string>",
"job_title": "<string>",
"company": "<string>",
"website": "<string>",
"industry": "<string>",
"address": "<string>",
"city": "<string>",
"state": "<string>",
"zip": "<string>",
"country": "<string>"
},
"variables": [
{
"id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"name": "order_id",
"value": "<string>"
}
],
"locale": "<string>",
"country": "<string>",
"reply_window": {
"closes_at": "2023-11-07T05:31:56Z",
"team_reply_closes_at": "2023-11-07T05:31:56Z"
},
"created_at": "2023-11-07T05:31:56Z",
"last_message_at": "2023-11-07T05:31:56Z"
}{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "The API key is invalid or has been revoked.",
"param": null,
"request_id": "req_8Fq2kLm9TzX4vB7nC1dR5sYw"
}
}{
"error": {
"type": "permission_error",
"code": "insufficient_permission",
"message": "This API key doesn't have delete access to agents.",
"param": null,
"request_id": "req_8Fq2kLm9TzX4vB7nC1dR5sYw"
}
}{
"error": {
"type": "not_found_error",
"code": "resource_not_found",
"message": "No conversation with this ID exists, or this API key can't access it.",
"param": null,
"request_id": "req_8Fq2kLm9TzX4vB7nC1dR5sYw"
}
}{
"error": {
"type": "authentication_error",
"code": "validation_failed",
"message": "<string>",
"param": "<string>",
"request_id": "<string>",
"errors": [
{
"param": "<string>",
"message": "<string>"
}
]
}
}Conversations
Retrieve a conversation
Retrieves a conversation on any channel, including playground tests. Retrieving a conversation doesn’t mark it as read.
GET
/
conversations
/
{conversation}
Retrieve a conversation
curl --request GET \
--url https://api.chatling.ai/v3/conversations/{conversation} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.chatling.ai/v3/conversations/{conversation}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.chatling.ai/v3/conversations/{conversation}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.chatling.ai/v3/conversations/{conversation}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.chatling.ai/v3/conversations/{conversation}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.chatling.ai/v3/conversations/{conversation}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.chatling.ai/v3/conversations/{conversation}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"object": "conversation",
"id": "5f0c1c2e-6c1d-4a8f-9a59-0d4c4f1b2a10",
"agent": {
"id": "3132353852",
"type": "ai_agent",
"name": "Support agent"
},
"channel": "web",
"user_id": "0b6f3c1e-8d2a-4f5b-9c7e-1a2b3c4d5e6f",
"external_user_id": "<string>",
"status": "open",
"mode": "ai",
"ended_at": "2023-11-07T05:31:56Z",
"read": true,
"important": true,
"priority": "low",
"labels": [
{
"id": "<string>",
"name": "<string>"
}
],
"topics": [
{
"id": "<string>",
"name": "<string>",
"source": "ai"
}
],
"sentiment": "positive",
"assignee": {
"id": "<string>",
"name": "<string>"
},
"team": {
"id": "<string>",
"name": "<string>"
},
"contact": {
"id": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"phone": "<string>",
"job_title": "<string>",
"company": "<string>",
"website": "<string>",
"industry": "<string>",
"address": "<string>",
"city": "<string>",
"state": "<string>",
"zip": "<string>",
"country": "<string>"
},
"variables": [
{
"id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"name": "order_id",
"value": "<string>"
}
],
"locale": "<string>",
"country": "<string>",
"reply_window": {
"closes_at": "2023-11-07T05:31:56Z",
"team_reply_closes_at": "2023-11-07T05:31:56Z"
},
"created_at": "2023-11-07T05:31:56Z",
"last_message_at": "2023-11-07T05:31:56Z"
}{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "The API key is invalid or has been revoked.",
"param": null,
"request_id": "req_8Fq2kLm9TzX4vB7nC1dR5sYw"
}
}{
"error": {
"type": "permission_error",
"code": "insufficient_permission",
"message": "This API key doesn't have delete access to agents.",
"param": null,
"request_id": "req_8Fq2kLm9TzX4vB7nC1dR5sYw"
}
}{
"error": {
"type": "not_found_error",
"code": "resource_not_found",
"message": "No conversation with this ID exists, or this API key can't access it.",
"param": null,
"request_id": "req_8Fq2kLm9TzX4vB7nC1dR5sYw"
}
}{
"error": {
"type": "authentication_error",
"code": "validation_failed",
"message": "<string>",
"param": "<string>",
"request_id": "<string>",
"errors": [
{
"param": "<string>",
"message": "<string>"
}
]
}
}Response
The conversation.
Identifies the person chatting. It's the same in all their conversations with the agent, including for anonymous widget users who aren't contacts. On the web, it's the widget's ID for the user's browser. Through the API, it's derived from external_user_id, or new for each conversation without one. On WhatsApp, it's the user's phone number. On Instagram and Messenger, it's the user's ID for the account or page, and on Telegram, the chat ID. null for some older conversations.
Example:
"0b6f3c1e-8d2a-4f5b-9c7e-1a2b3c4d5e6f"