. Create an API key under API keys.API reference · Conversations
Inbox
Conversations: chat lists, messages of a chat, read state, tags, notes, pin, archive and close.
List the chats of a device
/v1/sessions/{sessionId}/inboxList chats with last message, unread count, and group flag.
Path parameters
sessionIdstringrequired
Query parameters
limitintegeroffsetinteger | null
Responses
- 200Inbox listing
Response fields
inboxarray of objectrequiredinbox[].idstringrequiredinbox[].session_idstringrequiredinbox[].chat_idstringrequiredinbox[].chat_namestring | nullrequiredinbox[].last_messagestring | nullrequiredinbox[].last_message_atintegerrequiredinbox[].unread_countintegerrequiredinbox[].is_groupintegerrequired1 = group chat, 0 = 1-on-1inbox[].agent_idstring | nullrequiredAssigned CS agent, or null for unassignedinbox[].statusstringrequired
curl "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY"const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
console.log(data);import os
import requests
res = requests.get(
"https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox",
headers={
"Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
},
timeout=30,
)
res.raise_for_status()
print(res.json())<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
$res = $client->request('GET', 'https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
],
]);
print_r(json_decode((string) $res->getBody(), true));{
"inbox": [
{
"id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
"session_id": "YOUR_DEVICE_ID",
"chat_id": "+447700900123",
"chat_name": "string",
"last_message": "Hi Sam, your order has shipped.",
"last_message_at": 1767225600000,
"unread_count": 12,
"is_group": 1,
"agent_id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
"status": "active"
}
]
}List chats seen in history
/v1/sessions/{sessionId}/contactsDistinct chat ids found in the stored message history of the session, most recently active first (max 100). Derived from the message log, not from the WhatsApp address book.
Path parameters
sessionIdstringrequiredSession (device) id
Responses
- 200Chats
Response fields
contactsarray of objectrequiredcontacts[].chat_idstringrequiredcontacts[].last_seenintegerrequiredTime of the latest message in the chat (Unix epoch, milliseconds)
- 401Missing or invalid credentials
- 403The API key is restricted to other sessions
- 404Unknown session, or a session of another tenant
curl "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/contacts" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY"const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/contacts', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
console.log(data);import os
import requests
res = requests.get(
"https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/contacts",
headers={
"Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
},
timeout=30,
)
res.raise_for_status()
print(res.json())<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
$res = $client->request('GET', 'https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/contacts', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
],
]);
print_r(json_decode((string) $res->getBody(), true));{
"contacts": [
{
"chat_id": "+447700900123",
"last_seen": 1
}
]
}List the messages of a chat
/v1/sessions/{sessionId}/inbox/{chatId}/messagesMessages of one chat, oldest first within the page. Pass next_cursor as before to load older messages. Rows are returned as stored in the message log (more columns than listed may be present).
Path parameters
sessionIdstringrequiredSession (device) idchatIdstringrequiredChat id (JID) exactly as stored in the inbox, e.g.[email protected]or…@g.us. URL-decoded by the server; no phone-number normalisation is applied
Query parameters
limitintegerPage size; values outside 1-100 are clampedbeforenumbercreated_at(epoch ms) of the oldest message already loaded; non-numeric values are ignored
Responses
- 200A page of messages
Response fields
messagesarray of objectrequiredOldest firstmessages[].idstringrequiredGateway message id (ULID)messages[].directionstringrequiredmessages[].chat_idstringrequiredChat JIDmessages[].message_typestringrequiredtext,image,video,document,audio,sticker,location,poll,contactorreactionmessages[].bodystring | nullrequiredText content, if anymessages[].media_r2_keystring | nullrequiredKey of the stored media file; download it withGET /v1/sessions/{sessionId}/messages/{id}/mediamessages[].statusstringrequiredqueued,sent,delivered,read,failed,cancelledordeletedmessages[].created_atintegerrequiredCreation time (Unix epoch, milliseconds)messages[].wa_message_idstring | nullrequiredWhatsApp message id; null until the message was handed to WhatsAppmessages[].sent_atinteger | nullrequiredTime the message was handed to WhatsApp (Unix epoch, milliseconds)messages[].errorstring | nullrequiredFailure reason of a failed messagehas_morebooleanrequiredtruewhen the page is fullnext_cursorinteger | nullrequiredcreated_atof the oldest message in the page (Unix epoch, milliseconds), or null
- 401Missing or invalid credentials
- 403The API key is restricted to other sessions
- 404Unknown session, or a session of another tenant
curl "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/messages" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY"const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/messages', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
console.log(data);import os
import requests
res = requests.get(
"https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/messages",
headers={
"Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
},
timeout=30,
)
res.raise_for_status()
print(res.json())<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
$res = $client->request('GET', 'https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/messages', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
],
]);
print_r(json_decode((string) $res->getBody(), true));{
"messages": [
{
"id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
"direction": "inbound",
"chat_id": "+447700900123",
"message_type": "Hi Sam, your order has shipped.",
"body": "Hi Sam, your order has shipped.",
"media_r2_key": "uploads/abc123.jpg",
"status": "active",
"created_at": 1767225600000,
"wa_message_id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
"sent_at": 1767225600000,
"error": "string"
}
],
"has_more": true,
"next_cursor": 1
}Close a chat
/v1/sessions/{sessionId}/inbox/{chatId}/closeMarks the inbox chat closed and resolves its agent assignment. If the tenant enabled the CSAT survey (setting csat_config), the session is connected and the chat is a one-to-one chat, the survey question is sent and a pending response is recorded.
Path parameters
sessionIdstringrequiredSession (device) idchatIdstringrequiredChat id (JID) exactly as stored in the inbox, e.g.[email protected]or…@g.us. URL-decoded by the server; no phone-number normalisation is applied
Responses
- 200Closed
Response fields
okbooleanrequiredstatusstringrequiredcsat_sentbooleanrequiredtruewhen the CSAT survey was sent
- 401Missing or invalid credentials
- 403The API key is restricted to other sessions
- 404Unknown session, or a session of another tenant
curl -X POST "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/close" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY"const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/close', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
console.log(data);import os
import requests
res = requests.post(
"https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/close",
headers={
"Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
},
timeout=30,
)
res.raise_for_status()
print(res.json())<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
$res = $client->request('POST', 'https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/close', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
],
]);
print_r(json_decode((string) $res->getBody(), true));{
"ok": true,
"status": "closed",
"csat_sent": true
}Reset the unread counter
/v1/sessions/{sessionId}/inbox/{chatId}/readSets the unread counter of the inbox chat to zero. This is local only: no read receipt is sent to WhatsApp (see POST …/messages/{msgId}/read). Answers 200 even when the chat is unknown.
Path parameters
sessionIdstringrequiredSession (device) idchatIdstringrequiredChat id (JID) exactly as stored in the inbox, e.g.[email protected]or…@g.us. URL-decoded by the server; no phone-number normalisation is applied
Responses
- 200Reset
Response fields
okbooleanrequired
- 401Missing or invalid credentials
- 403The API key is restricted to other sessions
- 404Unknown session, or a session of another tenant
curl -X POST "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/read" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY"const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/read', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
console.log(data);import os
import requests
res = requests.post(
"https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/read",
headers={
"Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
},
timeout=30,
)
res.raise_for_status()
print(res.json())<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
$res = $client->request('POST', 'https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/read', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
],
]);
print_r(json_decode((string) $res->getBody(), true));{
"ok": true
}Get tags, notes, pin and archive state
/v1/sessions/{sessionId}/inbox/{chatId}/metadataReturns the organisation data of a chat. A chat without any stored data returns empty tags and notes with pinned and archived false.
Path parameters
sessionIdstringrequiredSession (device) idchatIdstringrequiredChat id (JID) exactly as stored in the inbox, e.g.[email protected]or…@g.us. URL-decoded by the server; no phone-number normalisation is applied
Responses
- 200Chat metadata
Response fields
tagsarray of objectrequiredTags attached to the chattags[].namestringrequiredtags[].colorstringrequirednotesarray of stringrequiredInternal notes, newest firstpinnedbooleanrequiredarchivedbooleanrequired
- 401Missing or invalid credentials
- 403The API key is restricted to other sessions
- 404Unknown session, or a session of another tenant
curl "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/metadata" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY"const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/metadata', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
console.log(data);import os
import requests
res = requests.get(
"https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/metadata",
headers={
"Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
},
timeout=30,
)
res.raise_for_status()
print(res.json())<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
$res = $client->request('GET', 'https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/metadata', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
],
]);
print_r(json_decode((string) $res->getBody(), true));{
"tags": [
{
"name": "Example",
"color": "#0a7350"
}
],
"notes": [
"Prefers delivery after 5 pm"
],
"pinned": true,
"archived": true
}Replace tags, notes, pin and archive state
/v1/sessions/{sessionId}/inbox/{chatId}/metadataReplaces the whole record: fields left out are reset (tags and notes to empty, pinned and archived to false). The body is not validated; use the dedicated tag, note, pin and archive calls to change a single thing.
Path parameters
sessionIdstringrequiredSession (device) idchatIdstringrequiredChat id (JID) exactly as stored in the inbox, e.g.[email protected]or…@g.us. URL-decoded by the server; no phone-number normalisation is applied
Request body
tagsarray of objecttags[].namestringrequiredtags[].colorstringrequirednotesarray of stringpinnedbooleanAny truthy value pinsarchivedbooleanAny truthy value archives
Responses
- 200Saved
Response fields
okbooleanrequired
- 401Missing or invalid credentials
- 403The API key is restricted to other sessions
- 404Unknown session, or a session of another tenant
curl -X PUT "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/metadata" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"tags": [
{
"name": "VIP",
"color": "#0a7350"
}
],
"notes": [
"Prefers delivery after 5 pm"
],
"pinned": true,
"archived": false
}'const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/metadata', {
method: 'PUT',
headers: {
Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"tags": [
{
"name": "VIP",
"color": "#0a7350"
}
],
"notes": [
"Prefers delivery after 5 pm"
],
"pinned": true,
"archived": false
}),
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
console.log(data);import os
import requests
res = requests.put(
"https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/metadata",
headers={
"Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
},
json={
"tags": [
{
"name": "VIP",
"color": "#0a7350",
},
],
"notes": [
"Prefers delivery after 5 pm",
],
"pinned": True,
"archived": False,
},
timeout=30,
)
res.raise_for_status()
print(res.json())<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
$res = $client->request('PUT', 'https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/metadata', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
],
'json' => [
'tags' => [
[
'name' => 'VIP',
'color' => '#0a7350',
],
],
'notes' => [
'Prefers delivery after 5 pm',
],
'pinned' => true,
'archived' => false,
],
]);
print_r(json_decode((string) $res->getBody(), true));{
"ok": true
}Add a tag to a chat
/v1/sessions/{sessionId}/inbox/{chatId}/tagsAppends a tag to the chat. The call does not de-duplicate: adding the same name twice stores it twice.
Path parameters
sessionIdstringrequiredSession (device) idchatIdstringrequiredChat id (JID) exactly as stored in the inbox, e.g.[email protected]or…@g.us. URL-decoded by the server; no phone-number normalisation is applied
Request body
namestringrequiredTag namecolorstringrequiredTag colour, free text such as a hex code
Responses
- 200Tag added
Response fields
okbooleanrequiredtagsarray of objectrequiredAll tags of the chattags[].namestringrequiredtags[].colorstringrequired
- 401Missing or invalid credentials
- 403The API key is restricted to other sessions
- 404Unknown session, or a session of another tenant
curl -X POST "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/tags" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "vip",
"color": "#0a7350"
}'const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/tags', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"name": "vip",
"color": "#0a7350"
}),
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
console.log(data);import os
import requests
res = requests.post(
"https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/tags",
headers={
"Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
},
json={
"name": "vip",
"color": "#0a7350",
},
timeout=30,
)
res.raise_for_status()
print(res.json())<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
$res = $client->request('POST', 'https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/tags', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
],
'json' => [
'name' => 'vip',
'color' => '#0a7350',
],
]);
print_r(json_decode((string) $res->getBody(), true));{
"ok": true,
"tags": [
{
"name": "vip",
"color": "#0a7350"
}
]
}Add a note to a chat
/v1/sessions/{sessionId}/inbox/{chatId}/notesAdds an internal note at the top of the chat notes. Notes are never sent to the contact.
Path parameters
sessionIdstringrequiredSession (device) idchatIdstringrequiredChat id (JID) exactly as stored in the inbox, e.g.[email protected]or…@g.us. URL-decoded by the server; no phone-number normalisation is applied
Request body
textstringrequiredNote text
Responses
- 200Note added
Response fields
okbooleanrequirednotesarray of stringrequiredAll notes of the chat, newest first
- 401Missing or invalid credentials
- 403The API key is restricted to other sessions
- 404Unknown session, or a session of another tenant
curl -X POST "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/notes" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Hi Sam, your order has shipped."
}'const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/notes', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"text": "Hi Sam, your order has shipped."
}),
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
console.log(data);import os
import requests
res = requests.post(
"https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/notes",
headers={
"Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
},
json={
"text": "Hi Sam, your order has shipped.",
},
timeout=30,
)
res.raise_for_status()
print(res.json())<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
$res = $client->request('POST', 'https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/notes', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
],
'json' => [
'text' => 'Hi Sam, your order has shipped.',
],
]);
print_r(json_decode((string) $res->getBody(), true));{
"ok": true,
"notes": [
"Prefers delivery after 5 pm"
]
}Toggle the pin of a chat
/v1/sessions/{sessionId}/inbox/{chatId}/pinFlips the pinned flag of the chat (pinned becomes unpinned and the other way round). The response does not return the new state; read it from the metadata.
Path parameters
sessionIdstringrequiredSession (device) idchatIdstringrequiredChat id (JID) exactly as stored in the inbox, e.g.[email protected]or…@g.us. URL-decoded by the server; no phone-number normalisation is applied
Responses
- 200Toggled
Response fields
okbooleanrequired
- 401Missing or invalid credentials
- 403The API key is restricted to other sessions
- 404Unknown session, or a session of another tenant
curl -X POST "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/pin" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY"const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/pin', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
console.log(data);import os
import requests
res = requests.post(
"https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/pin",
headers={
"Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
},
timeout=30,
)
res.raise_for_status()
print(res.json())<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
$res = $client->request('POST', 'https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/pin', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
],
]);
print_r(json_decode((string) $res->getBody(), true));{
"ok": true
}Toggle the archive flag of a chat
/v1/sessions/{sessionId}/inbox/{chatId}/archiveFlips the archived flag of the chat. The response does not return the new state; read it from the metadata.
Path parameters
sessionIdstringrequiredSession (device) idchatIdstringrequiredChat id (JID) exactly as stored in the inbox, e.g.[email protected]or…@g.us. URL-decoded by the server; no phone-number normalisation is applied
Responses
- 200Toggled
Response fields
okbooleanrequired
- 401Missing or invalid credentials
- 403The API key is restricted to other sessions
- 404Unknown session, or a session of another tenant
curl -X POST "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/archive" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY"const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/archive', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
console.log(data);import os
import requests
res = requests.post(
"https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/archive",
headers={
"Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
},
timeout=30,
)
res.raise_for_status()
print(res.json())<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
$res = $client->request('POST', 'https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/archive', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
],
]);
print_r(json_decode((string) $res->getBody(), true));{
"ok": true
}Set local message expiry for a chat
/v1/sessions/{sessionId}/inbox/{chatId}/disappearingStores a retention time for the chat. A background job that runs every 5 minutes deletes the messages of the chat older than that time from the stored history. It does not change the disappearing-messages setting of the chat on WhatsApp (for groups see PUT …/groups/{gid}/ephemeral). null or 0 turns it off.
Path parameters
sessionIdstringrequiredSession (device) idchatIdstringrequiredChat id (JID) exactly as stored in the inbox, e.g.[email protected]or…@g.us. URL-decoded by the server; no phone-number normalisation is applied
Request body
duration_msinteger | nullrequiredKeep messages this long, in milliseconds;nullor 0 disables
Responses
- 200Saved
Response fields
okbooleanrequiredduration_msinteger | nullrequired
- 401Missing or invalid credentials
- 403The API key is restricted to other sessions
- 404Unknown session, or a session of another tenant
curl -X POST "https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/disappearing" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"duration_ms": 604800000
}'const res = await fetch('https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/disappearing', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"duration_ms": 604800000
}),
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
console.log(data);import os
import requests
res = requests.post(
"https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/disappearing",
headers={
"Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
},
json={
"duration_ms": 604800000,
},
timeout=30,
)
res.raise_for_status()
print(res.json())<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
$res = $client->request('POST', 'https://api.chatkomodo.com/v1/sessions/YOUR_DEVICE_ID/inbox/447700900123%40s.whatsapp.net/disappearing', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
],
'json' => [
'duration_ms' => 604800000,
],
]);
print_r(json_decode((string) $res->getBody(), true));{
"ok": true,
"duration_ms": 604800000
}List chats across all devices
/v1/inboxChats of all the tenant's devices, most recent first. For an agent login only chats assigned to that agent or unassigned are returned. Per-device listing is GET /v1/sessions/{sessionId}/inbox.
Query parameters
limitintegerValues outside 1-1 000 are clampedoffsetinteger | null
Responses
- 200Chats
Response fields
inboxarray of objectrequiredinbox[].idstringrequiredinbox[].session_idstringrequiredinbox[].chat_idstringrequiredinbox[].chat_namestring | nullrequiredinbox[].last_messagestring | nullrequiredinbox[].last_message_atinteger | nullrequiredinbox[].unread_countinteger | nullrequiredinbox[].is_groupinteger | nullrequired1 = group chat, 0 = 1-on-1inbox[].agent_idstring | nullrequiredAssigned agent, or nullinbox[].statusstring | nullrequiredopenorresolved
- 401Missing, invalid or expired credentials
curl "https://api.chatkomodo.com/v1/inbox" \
-H "Authorization: Bearer $CHATKOMODO_API_KEY"const res = await fetch('https://api.chatkomodo.com/v1/inbox', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.CHATKOMODO_API_KEY}`,
},
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.error}`);
console.log(data);import os
import requests
res = requests.get(
"https://api.chatkomodo.com/v1/inbox",
headers={
"Authorization": f"Bearer {os.environ['CHATKOMODO_API_KEY']}",
},
timeout=30,
)
res.raise_for_status()
print(res.json())<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
$res = $client->request('GET', 'https://api.chatkomodo.com/v1/inbox', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('CHATKOMODO_API_KEY'),
],
]);
print_r(json_decode((string) $res->getBody(), true));{
"inbox": [
{
"id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
"session_id": "YOUR_DEVICE_ID",
"chat_id": "+447700900123",
"chat_name": "string",
"last_message": "Hi Sam, your order has shipped.",
"last_message_at": 1767225600000,
"unread_count": 12,
"is_group": 1,
"agent_id": "01JA5V6Q8M2H7G4K9P3T0R1S2X",
"status": "active"
}
]
}