Get conversation
curl --request GET \
--url https://{appid}.api-{region}.cometchat.io/v3/conversations/{conversationId} \
--header 'apikey: <api-key>' \
--header 'onBehalfOf: <onbehalfof>'import requests
url = "https://{appid}.api-{region}.cometchat.io/v3/conversations/{conversationId}"
headers = {
"onBehalfOf": "<onbehalfof>",
"apikey": "<api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {onBehalfOf: '<onbehalfof>', apikey: '<api-key>'}};
fetch('https://{appid}.api-{region}.cometchat.io/v3/conversations/{conversationId}', 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://{appid}.api-{region}.cometchat.io/v3/conversations/{conversationId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"apikey: <api-key>",
"onBehalfOf: <onbehalfof>"
],
]);
$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://{appid}.api-{region}.cometchat.io/v3/conversations/{conversationId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("onBehalfOf", "<onbehalfof>")
req.Header.Add("apikey", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{appid}.api-{region}.cometchat.io/v3/conversations/{conversationId}")
.header("onBehalfOf", "<onbehalfof>")
.header("apikey", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{appid}.api-{region}.cometchat.io/v3/conversations/{conversationId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["onBehalfOf"] = '<onbehalfof>'
request["apikey"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": [
{
"conversationId": "group_project-group",
"conversationType": "group",
"unreadMessageCount": "0",
"createdAt": 1630071782,
"updatedAt": 1630481413,
"lastMessage": {
"id": "50",
"conversationId": "group_project-group",
"sender": "superhero4",
"receiverType": "group",
"receiver": "project-group",
"category": "action",
"type": "groupMember",
"data": {
"action": "unbanned",
"entities": {
"by": {
"entity": {
"uid": "superhero4",
"name": "Wolverine",
"role": "default",
"avatar": "https://data-us.cometchat.io/assets/images/avatars/wolverine.png",
"status": "offline",
"createdAt": 1629869270
},
"entityType": "user"
},
"on": {
"entity": {
"uid": "superhero3",
"link": "https://data-us.cometchat.io/assets",
"name": "Captain America",
"role": "default",
"avatar": "https://data-us.cometchat.io/assets/images/avatars/captainamerica.png",
"status": "offline",
"createdAt": 1629869270,
"updatedAt": 1629964825,
"conversationId": "superhero3_user_superhero4"
},
"entityType": "user"
},
"for": {
"entity": {
"guid": "project-group",
"icon": "http://placehold.it/120x120&text=image1",
"name": "Project Group1",
"type": "private",
"owner": "superhero4",
"createdAt": 1630071341,
"updatedAt": 1630305525,
"updatedBy": "superhero4",
"description": "project related discussions between members",
"membersCount": 4,
"conversationId": "group_project-group"
},
"entityType": "group"
}
}
},
"sentAt": 1630305562,
"updatedAt": 1630305562,
"receipts": {
"data": [
[]
]
}
},
"conversationWith": {
"guid": "project-group",
"name": "Project Group1",
"description": "project related discussions between members",
"icon": "http://placehold.it/120x120&text=image1",
"type": "private",
"scope": "participant",
"membersCount": 4,
"joinedAt": 1630071782,
"conversationId": "group_project-group",
"hasJoined": true,
"createdAt": 1630071341,
"owner": "superhero4",
"updatedAt": 1630308875,
"updatedBy": "superhero4"
}
}
]
}Conversations
Get conversation
deprecated
This API is deprecated please use Get User/Group ConversationAPI
GET
/
conversations
/
{conversationId}
Get conversation
curl --request GET \
--url https://{appid}.api-{region}.cometchat.io/v3/conversations/{conversationId} \
--header 'apikey: <api-key>' \
--header 'onBehalfOf: <onbehalfof>'import requests
url = "https://{appid}.api-{region}.cometchat.io/v3/conversations/{conversationId}"
headers = {
"onBehalfOf": "<onbehalfof>",
"apikey": "<api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {onBehalfOf: '<onbehalfof>', apikey: '<api-key>'}};
fetch('https://{appid}.api-{region}.cometchat.io/v3/conversations/{conversationId}', 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://{appid}.api-{region}.cometchat.io/v3/conversations/{conversationId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"apikey: <api-key>",
"onBehalfOf: <onbehalfof>"
],
]);
$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://{appid}.api-{region}.cometchat.io/v3/conversations/{conversationId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("onBehalfOf", "<onbehalfof>")
req.Header.Add("apikey", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{appid}.api-{region}.cometchat.io/v3/conversations/{conversationId}")
.header("onBehalfOf", "<onbehalfof>")
.header("apikey", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{appid}.api-{region}.cometchat.io/v3/conversations/{conversationId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["onBehalfOf"] = '<onbehalfof>'
request["apikey"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": [
{
"conversationId": "group_project-group",
"conversationType": "group",
"unreadMessageCount": "0",
"createdAt": 1630071782,
"updatedAt": 1630481413,
"lastMessage": {
"id": "50",
"conversationId": "group_project-group",
"sender": "superhero4",
"receiverType": "group",
"receiver": "project-group",
"category": "action",
"type": "groupMember",
"data": {
"action": "unbanned",
"entities": {
"by": {
"entity": {
"uid": "superhero4",
"name": "Wolverine",
"role": "default",
"avatar": "https://data-us.cometchat.io/assets/images/avatars/wolverine.png",
"status": "offline",
"createdAt": 1629869270
},
"entityType": "user"
},
"on": {
"entity": {
"uid": "superhero3",
"link": "https://data-us.cometchat.io/assets",
"name": "Captain America",
"role": "default",
"avatar": "https://data-us.cometchat.io/assets/images/avatars/captainamerica.png",
"status": "offline",
"createdAt": 1629869270,
"updatedAt": 1629964825,
"conversationId": "superhero3_user_superhero4"
},
"entityType": "user"
},
"for": {
"entity": {
"guid": "project-group",
"icon": "http://placehold.it/120x120&text=image1",
"name": "Project Group1",
"type": "private",
"owner": "superhero4",
"createdAt": 1630071341,
"updatedAt": 1630305525,
"updatedBy": "superhero4",
"description": "project related discussions between members",
"membersCount": 4,
"conversationId": "group_project-group"
},
"entityType": "group"
}
}
},
"sentAt": 1630305562,
"updatedAt": 1630305562,
"receipts": {
"data": [
[]
]
}
},
"conversationWith": {
"guid": "project-group",
"name": "Project Group1",
"description": "project related discussions between members",
"icon": "http://placehold.it/120x120&text=image1",
"type": "private",
"scope": "participant",
"membersCount": 4,
"joinedAt": 1630071782,
"conversationId": "group_project-group",
"hasJoined": true,
"createdAt": 1630071341,
"owner": "superhero4",
"updatedAt": 1630308875,
"updatedBy": "superhero4"
}
}
]
}Authorizations
API Key with fullAccess scope(i.e. Rest API Key from the Dashboard).
Headers
UID of the user on whose behalf the action is performed.
Path Parameters
(Required) conversation id
Response
200 - application/json
Get Conversations
⌘I