# 19. API get Omni Messages

## 1. API

#### **Domain:**

Production: `GET https://apiring.antbuddy.com/messages`

#### **Headers**

```json
{
  "apikey": "<secret key>",
  "Content-Type": "application/json"
}
```

## 2. Parameters

<table><thead><tr><th width="187.5999755859375">Tham số</th><th width="123.199951171875">Kiểu dữ liệu</th><th width="119.199951171875">Bắt buộc</th><th>Giải thích</th></tr></thead><tbody><tr><td>sessionId</td><td>String</td><td>N</td><td>session id</td></tr><tr><td>limit</td><td>Number</td><td>N</td><td>Số lượng messages</td></tr><tr><td>offset</td><td>Number</td><td>N</td><td>Bắt đầu từ đầu</td></tr><tr><td>created_from</td><td>Number (timestamp)</td><td>Y</td><td>Thời gian bắt đầu</td></tr><tr><td>created_to</td><td>Number (timestamp)</td><td>Y</td><td>Thời gian kết thúc</td></tr></tbody></table>

#### **Request Body**

```json
curl --location 'https://apiring.antbuddy.com/messages?limit=15&offset=0&created_from=2025-11-17T00%3A00%3A00.000Z&created_to=2025-12-17T23%3A59%3A59.999Z' \
--header 'apikey: YOUR_API_KEY'

```

## 3. Response

```json
{
    "success": true,
    "data": {
        "sessions": [
            {
                "sessionId": "694a1499de71f2c2088c1fc3",
                "conversationId": "36737553777762229507559071987705051666",
                "pageId": "3673755377776222950",
                "createdAt": 1766462616946,
                "leadId": 1234,
                "messages": [
                    {
                        "_id": "694a14995e010d29e99bae1f",
                        "attachments": {
                            "data": []
                        },
                        "shares": {
                            "data": []
                        },
                        "channel": "ZALO",
                        "errorMessage": "",
                        "isOutboundMessage": false,
                        "isResponsedByBot": false,
                        "conversationId": "36737553777762229507559071987705051666",
                        "pageId": "3673755377776222950",
                        "messageId": "2971ae4485addcf585ba",
                        "from": "7559071987705051666",
                        "to": "3673755377776222950",
                        "message": "Xin chào, mình muốn hỏi về hệ thống crm cho trường đại học",
                        "templateZaloOA": null,
                        "created_time": "2025-12-23T04:03:36.946Z",
                        "__v": 0
                    },
                    {
                        "_id": "694a153597195c20fdbbf6c5",
                        "attachments": {
                            "data": []
                        },
                        "shares": {
                            "data": []
                        },
                        "channel": "ZALO",
                        "errorMessage": "",
                        "isOutboundMessage": false,
                        "isResponsedByBot": false,
                        "conversationId": "36737553777762229507559071987705051666",
                        "pageId": "3673755377776222950",
                        "messageId": "2fab996e5f8606de5f91",
                        "from": "3673755377776222950",
                        "to": "7559071987705051666",
                        "location": {
                            "type": "text",
                            "message": "Dạ AntBuddy chào chị, chị vui lòng chia sẻ số điện thoại để AntBuddy chủ động liên hệ tư vấn chi tiết hơn."
                        },
                        "msginfo": {
                            "type": "text",
                            "message": "Dạ AntBuddy chào chị, chị vui lòng chia sẻ số điện thoại để AntBuddy chủ động liên hệ tư vấn chi tiết hơn."
                        },
                        "templateZaloOA": null,
                        "created_time": "2025-12-23T04:06:12.404Z",
                        "createdBy": "5d19c41a9cddc4682400df28",
                        "__v": 0
                    },
                    {
                        "_id": "694a153fbb497fc37dc022ca",
                        "attachments": {
                            "data": []
                        },
                        "shares": {
                            "data": []
                        },
                        "channel": "ZALO",
                        "errorMessage": "",
                        "isOutboundMessage": false,
                        "isResponsedByBot": false,
                        "conversationId": "36737553777762229507559071987705051666",
                        "pageId": "3673755377776222950",
                        "messageId": "3d4ef81222fa7ba222ed",
                        "from": "7559071987705051666",
                        "to": "3673755377776222950",
                        "message": "0946912006",
                        "templateZaloOA": null,
                        "created_time": "2025-12-23T04:06:23.200Z",
                        "__v": 0
                    },
                    {
                        "_id": "694a1544c58e2a211781651e",
                        "attachments": {
                            "data": []
                        },
                        "shares": {
                            "data": []
                        },
                        "channel": "ZALO",
                        "errorMessage": "",
                        "isOutboundMessage": false,
                        "isResponsedByBot": false,
                        "conversationId": "36737553777762229507559071987705051666",
                        "pageId": "3673755377776222950",
                        "messageId": "60225e9d8975d02d8962",
                        "from": "7559071987705051666",
                        "to": "3673755377776222950",
                        "message": "Bạn tư vấn giúp mình nhé",
                        "templateZaloOA": null,
                        "created_time": "2025-12-23T04:06:28.543Z",
                        "__v": 0
                    },
                    {
                        "_id": "694a156d5e010d29e99bb538",
                        "attachments": {
                            "data": []
                        },
                        "shares": {
                            "data": []
                        },
                        "channel": "ZALO",
                        "errorMessage": "",
                        "isOutboundMessage": false,
                        "isResponsedByBot": false,
                        "conversationId": "36737553777762229507559071987705051666",
                        "pageId": "3673755377776222950",
                        "messageId": "e18856385fd006885fc7",
                        "from": "3673755377776222950",
                        "to": "7559071987705051666",
                        "location": {
                            "type": "text",
                            "message": "Dạ, AntBuddy cảm ơn chị và sẽ liên hệ chị qua số ... ạ"
                        },
                        "msginfo": {
                            "type": "text",
                            "message": "Dạ, AntBuddy cảm ơn chị và sẽ liên hệ chị qua số ... ạ"
                        },
                        "templateZaloOA": null,
                        "created_time": "2025-12-23T04:07:08.718Z",
                        "createdBy": "5d19c41a9cddc4682400df28",
                        "__v": 0,
                        "doneAt": 1766463110398,
                        "doneBy": "5d19c41a9cddc4682400df28",
                        "pin": false,
                        "pinnedAt": "2025-12-23T04:11:50.415Z"
                    }
                ],
                "messageCount": 5
            }
        ],
        "total": 1
    }
}
```
