Messages Endpoints (Classic)
Send WhatsApp messages to customers and retrieve message history using the Classic API endpoints.
Overview
This is the Classic messaging API. For improved features and pagination, consider using the New Open API Messages endpoints.
Endpoints Summary
| Method | Endpoint | Description |
|---|---|---|
| POST | /messages/whatsapp | Send WhatsApp message |
| GET | /messages | List messages by conversation |
| GET | /messages/{id} | Get single message |
| POST | /v1/backoffice/conversations-delete | Delete conversations |
Send WhatsApp Message
Send a message to a customer via WhatsApp.
Authentication
curl -X POST "{{OPEN_API_SERVER}}/messages/whatsapp" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"inbox_id": "inbox_abc123",
"to": "+62812345678",
"type": "text",
"content": {
"text": "Hello! How can we help you today?"
}
}'
Request Body
Source inbox ID (WhatsApp channel)
Recipient phone number in E.164 format
Message type: text, image, video, document, audio
Message content object based on type
Message ID to reply to (optional)
Message Types
{
"type": "text",
"content": {
"text": "Hello! How can we help you today?"
}
}
Response
{
"success": true,
"data": {
"message_id": "msg_xyz789",
"status": "sent",
"to": "+62812345678",
"timestamp": "2025-03-27T15:30:00Z"
}
}
List Messages
Retrieve messages for a specific conversation.
Query Parameters
Conversation ID to filter messages
Maximum results (default: 50, max: 100)
Cursor for pagination (message ID)
curl -X GET "https://api.cekat.ai/messages?conversation_id=conv_abc123&limit=50" \
-H "Authorization: Bearer YOUR_API_KEY"
Response
{
"success": true,
"data": [
{
"id": "msg_001",
"conversation_id": "conv_abc123",
"direction": "inbound",
"type": "text",
"content": {
"text": "Hi, I need help with my order"
},
"sender": {
"name": "John Doe",
"phone": "+62812345678"
},
"timestamp": "2025-03-27T15:00:00Z"
},
{
"id": "msg_002",
"conversation_id": "conv_abc123",
"direction": "outbound",
"type": "text",
"content": {
"text": "Hello! I'd be happy to help. What's your order number?"
},
"sender": {
"name": "Support Agent",
"user_id": "agent_123"
},
"timestamp": "2025-03-27T15:01:00Z"
}
],
"pagination": {
"has_more": true,
"before": "msg_001"
}
}
Get Single Message
Retrieve a specific message by its ID.
curl -X GET "https://api.cekat.ai/messages/msg_abc123" \
-H "Authorization: Bearer YOUR_API_KEY"
Response
{
"success": true,
"data": {
"id": "msg_abc123",
"conversation_id": "conv_xyz789",
"direction": "outbound",
"type": "text",
"status": "delivered",
"content": {
"text": "Your order has been shipped!"
},
"sender": {
"name": "Support Bot",
"user_id": "bot_001"
},
"recipient": {
"phone": "+62812345678"
},
"timestamp": "2025-03-27T14:30:00Z",
"delivered_at": "2025-03-27T14:30:05Z",
"read_at": "2025-03-27T14:35:00Z"
}
}
Delete Conversations
Delete one or more conversations and their messages.
This action is irreversible. Deleted conversations cannot be recovered.
Request Body
Array of conversation IDs to delete
curl -X POST "{{base_url}}/v1/backoffice/conversations-delete" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"conversation_ids": ["conv_001", "conv_002"]
}'
Response
{
"success": true,
"data": {
"deleted": 2,
"conversation_ids": ["conv_001", "conv_002"]
}
}
Code Examples
const sendMessage = async (inboxId, to, message) => {
const response = await fetch('https://api.cekat.ai/messages/whatsapp', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
inbox_id: inboxId,
to,
type: 'text',
content: { text: message }
})
});
return response.json();
};
// Send a text message
const result = await sendMessage(
'inbox_abc123',
'+62812345678',
'Hello! Thank you for contacting us.'
);
console.log(result.data.message_id);
