4. Chat & Messaging
4.1 Get Conversation Counts
GET /api/v1/conversations/counts
Get count of unread and unreplied conversations.
Response:
{
"total": 150,
"unread": 25,
"unreplied": 12,
"archived": 8
}
4.2 List Conversations
GET /api/v1/conversations
List conversations/threads with pagination.
Query Parameters:
page- Page number (default: 1)limit- Items per page (default: 50, max: 100)status- Filter:active,archived,closedtype- Filter:user,groupsearch- Search by contact namesortBy- Sort field:lastMessage,createdAt(default:lastMessage)direction- Sort direction:asc,desc
Response:
{
"data": [
{
"id": "conv-001",
"contactId": "contact-123",
"contactName": "Nguyen Van A",
"contactAvatar": "https://...",
"type": "user",
"zaloAccountId": "acc-001",
"messageCount": 45,
"unreadCount": 3,
"lastMessage": {
"id": "msg-999",
"content": "Hello!",
"contentType": "text",
"senderName": "Nguyen Van A",
"sentAt": "2026-06-05T17:20:00Z"
},
"status": "active",
"createdAt": "2026-03-10T08:00:00Z",
"lastActivityAt": "2026-06-05T17:20:00Z"
}
],
"pagination": {
"total": 150,
"page": 1,
"limit": 50,
"pages": 3
}
}
4.3 Get Conversation Details
GET /api/v1/conversations/:id
Get full conversation with messages.
Query Parameters:
page- Message page (default: 1)limit- Messages per page (default: 30)
Response:
{
"conversation": {
"id": "conv-001",
"contactId": "contact-123",
"contactName": "Nguyen Van A",
"type": "user",
"zaloAccountId": "acc-001",
"status": "active",
"createdAt": "2026-03-10T08:00:00Z"
},
"messages": [
{
"id": "msg-001",
"conversationId": "conv-001",
"content": "Hello, how are you?",
"contentType": "text",
"senderUid": "1234567890",
"senderName": "Nguyen Van A",
"isFromZalo": true,
"isRead": true,
"isReplied": true,
"sentAt": "2026-06-05T10:00:00Z"
}
],
"pagination": {
"total": 45,
"page": 1,
"limit": 30
}
}
4.4 Send Message
POST /api/v1/conversations/:id/messages
Send message to conversation.
Request Body:
{
"content": "Thanks for reaching out!",
"contentType": "text",
"attachments": []
}
Response: 201
{
"id": "msg-1000",
"conversationId": "conv-001",
"content": "Thanks for reaching out!",
"contentType": "text",
"senderName": "John Doe",
"sentAt": "2026-06-05T17:35:00Z",
"status": "sent"
}
4.5 Archive Conversation
POST /api/v1/conversations/:id/archive
Archive conversation.
Response:
{
"message": "Conversation archived"
}
4.6 Create Chat Folder
POST /api/v1/chat/folders
Create folder for organizing conversations.
Request Body:
{
"name": "Hot Leads",
"color": "#FF5722"
}
Response: 201
{
"id": "folder-001",
"name": "Hot Leads",
"color": "#FF5722",
"conversationCount": 0,
"createdAt": "2026-06-05T17:35:00Z"
}
4.7 List Chat Presets
GET /api/v1/chat/presets
List saved message templates.
Response:
[
{
"id": "preset-001",
"name": "Greeting",
"content": "Hi! Thanks for contacting us 👋",
"category": "greetings",
"createdAt": "2026-05-01T10:00:00Z"
}
]
4.8 Upload Attachment
POST /api/v1/chat/attachments
Upload file/image/video for sending.
Request: Form-data with file field
Response: 201
{
"id": "attach-001",
"filename": "document.pdf",
"size": 1024000,
"contentType": "application/pdf",
"url": "https://api.domaincrm.com/attachments/attach-001",
"uploadedAt": "2026-06-05T17:35:00Z"
}