List messages
curl --request GET \
--url https://{appid}.api-{region}.cometchat.io/v3/moderation/messages \
--header 'apikey: <api-key>'import requests
url = "https://{appid}.api-{region}.cometchat.io/v3/moderation/messages"
headers = {"apikey": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {apikey: '<api-key>'}};
fetch('https://{appid}.api-{region}.cometchat.io/v3/moderation/messages', 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/moderation/messages",
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>"
],
]);
$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/moderation/messages"
req, _ := http.NewRequest("GET", url, nil)
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/moderation/messages")
.header("apikey", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{appid}.api-{region}.cometchat.io/v3/moderation/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["apikey"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": [
{
"id": "1",
"conversationId": "cometchat-uid-1_user_cometchat-uid-2",
"sender": "cometchat-uid-2",
"receiverType": "user",
"receiver": "cometchat-uid-1",
"category": "message",
"type": "text",
"data": {
"entities": {
"receiver": {
"entity": {
"avatar": "https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-1.webp",
"createdAt": 1751644824,
"lastActiveAt": 1751644824,
"name": "Andrew Joseph",
"role": "default",
"status": "offline",
"uid": "cometchat-uid-1"
},
"entityType": "user"
},
"sender": {
"entity": {
"avatar": "https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-2.webp",
"conversationId": "cometchat-uid-1_user_cometchat-uid-2",
"createdAt": 1751644824,
"lastActiveAt": 1751644824,
"name": "George Alan",
"role": "default",
"status": "offline",
"uid": "cometchat-uid-2"
},
"entityType": "user"
}
},
"moderation": {
"status": "approved"
},
"text": "Hi new user"
},
"sentAt": 1750335220,
"updatedAt": 1751644906
}
],
"meta": {
"current": {
"limit": 100,
"count": 1
},
"next": {
"affix": "append",
"sentAt": 1750335220,
"id": "1"
}
}
}AI Moderation
List messages
This endpoint is used to retrieve a list of messages that were submitted for moderation. Each message includes its current moderation status based on the rules configured for the app.
GET
/
moderation
/
messages
List messages
curl --request GET \
--url https://{appid}.api-{region}.cometchat.io/v3/moderation/messages \
--header 'apikey: <api-key>'import requests
url = "https://{appid}.api-{region}.cometchat.io/v3/moderation/messages"
headers = {"apikey": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {apikey: '<api-key>'}};
fetch('https://{appid}.api-{region}.cometchat.io/v3/moderation/messages', 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/moderation/messages",
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>"
],
]);
$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/moderation/messages"
req, _ := http.NewRequest("GET", url, nil)
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/moderation/messages")
.header("apikey", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{appid}.api-{region}.cometchat.io/v3/moderation/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["apikey"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": [
{
"id": "1",
"conversationId": "cometchat-uid-1_user_cometchat-uid-2",
"sender": "cometchat-uid-2",
"receiverType": "user",
"receiver": "cometchat-uid-1",
"category": "message",
"type": "text",
"data": {
"entities": {
"receiver": {
"entity": {
"avatar": "https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-1.webp",
"createdAt": 1751644824,
"lastActiveAt": 1751644824,
"name": "Andrew Joseph",
"role": "default",
"status": "offline",
"uid": "cometchat-uid-1"
},
"entityType": "user"
},
"sender": {
"entity": {
"avatar": "https://assets.cometchat.io/sampleapp/v2/users/cometchat-uid-2.webp",
"conversationId": "cometchat-uid-1_user_cometchat-uid-2",
"createdAt": 1751644824,
"lastActiveAt": 1751644824,
"name": "George Alan",
"role": "default",
"status": "offline",
"uid": "cometchat-uid-2"
},
"entityType": "user"
}
},
"moderation": {
"status": "approved"
},
"text": "Hi new user"
},
"sentAt": 1750335220,
"updatedAt": 1751644906
}
],
"meta": {
"current": {
"limit": 100,
"count": 1
},
"next": {
"affix": "append",
"sentAt": 1750335220,
"id": "1"
}
}
}Authorizations
API Key with fullAccess scope(i.e. Rest API Key from the Dashboard).
Query Parameters
Filters messages by the sender’s uid.
Filters messages by the receiver's uid.
Filters messages by the receiver's guid in case of group
Filters messages by category. Possible values: message and custom.
Available options:
message, custom Filters messages by type.
Filters messages by moderation status.
Available options:
disapproved, pending Response
200 - application/json
Get Message(s)
The response is of type object.
Was this page helpful?
⌘I