Messages API
Retrieve messages with comprehensive filtering and pagination.
List Messages
GET/api/messages
Retrieve messages with pagination and filtering options.
Query Parameters
limitinteger
Results per page (default: 10)
pageinteger
Page number
conversation_idstring
Filter by conversation ID
inbox_idstring
Filter by inbox ID
bash
curl -X GET "https://api.cekat.ai/api/messages?limit=10" \
-H "Authorization: Bearer YOUR_API_KEY"
Response
200 OK
{
"success": true,
"data": [
{
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"message": "Hello! How can we help you today?",
"conversation_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"sent_by": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"sent_by_name": "Agent Name",
"sent_by_type": "agent",
"media_type": "text",
"media_url": null,
"status": "delivered",
"is_template": false,
"created_at": "2026-04-10 16:24:23",
"updated_at": "2026-04-10 16:24:23",
"additional_data": {
"is_private_note": false,
"snooze_date": null
},
"contact": {
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"type": "whatsapp",
"display_name": "Customer Name",
"phone_number": "6281234567890"
},
"inbox": {
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"name": "CekatAI Verified",
"type": "whatsapp",
"phone_number": "6287751700285"
}
}
],
"metadata": {
"pagination": {
"current_page": 1,
"current_items": 10,
"total_page": 5779,
"total_items": 57790
}
}
}
Message Object
| Field | Type | Description |
|---|---|---|
id | string (UUID) | Unique message identifier |
message | string | Message content |
conversation_id | string | Associated conversation ID |
sent_by | string | Sender ID |
sent_by_name | string | Sender display name |
sent_by_type | string | agent, user, or system |
media_type | string | text, image, video, document, audio |
media_url | string | Media URL (nullable) |
status | string | sent, delivered, read, failed |
is_template | boolean | Whether message is a template |
created_at | string | Timestamp |
updated_at | string | Last update timestamp |
additional_data | object | Additional metadata |
contact | object | Contact information |
inbox | object | Inbox information |
Sender Types
| Type | Description |
|---|---|
agent | Message sent by human agent |
user | Message sent by customer |
system | System message (resolutions, assignments) |
Code Examples
javascript
const getMessages = async (filters = {}) => {
const params = new URLSearchParams(filters);
const response = await fetch(
`https://api.cekat.ai/api/messages?${params}`,
{ headers: { 'Authorization': 'Bearer YOUR_API_KEY' } }
);
return response.json();
};
// Get messages for a conversation
const messages = await getMessages({
conversation_id: 'conversation-uuid',
limit: 50
});
// Get recent messages from inbox
const inboxMessages = await getMessages({
inbox_id: 'inbox-uuid',
limit: 20
});
console.log(`Total messages: ${messages.metadata.pagination.total_items}`);
