> For the complete documentation index, see [llms.txt](https://apidocs.nhanh.vn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apidocs.nhanh.vn/v3/vpage/conversation/conversation_message_list.md).

# Danh sách tin nhắn

* Lấy danh sách tin nhắn hoặc bình luận của một hội thoại.

## Request

* Xem sample Postman [tại đây](https://www.postman.com/nhanh-vn/vpage-open-nhanh-vn/request/xq8plwv/message-list?tab=body).

```curl
curl --location 'https://vpage.open.nhanh.vn/v3.0/conversation/messages?appId={{appId}}&businessId={{businessId}}' \
--header 'Authorization: {{accessToken}}' \
--header 'Content-Type: application/json' \
--data '{
    "filters": { 
        "conversationId": "{{conversationId}}"
    },
    "paginator": {
        "size": 30, 
        "sort": {"createdAt": "desc"}
    }
}'
```

### Filters

| Key            | Type   | Description  |
| -------------- | ------ | ------------ |
| conversationId | string | ID hội thoại |

### Paginator

| Key  | Type  | Description                                                |
| ---- | ----- | ---------------------------------------------------------- |
| size | int   | Số lượng bản ghi trên 1 trang. Tối đa không quá 50         |
| next | array | Mảng dữ liệu next (được trả về từ trang trước đó - nếu có) |
| sort | array | Mảng dữ liệu các tiêu chí sort. Xem bảng bên dưới          |

* sort

| Key       | Description   | Value     |
| --------- | ------------- | --------- |
| createdAt | Thời tạo page | ASC, DESC |

## Response

* Xem cấu trúc chung [tại đây](/v3/readme.md#response).

### Failed response

* Xem các mã lỗi chung [tại đây](/v3/readme.md#failed-response).

### Successful response

* Khi mà senderId = pageId thì được hiểu là page gửi tin nhắn đó, còn senderId khác pageId thì là khách hàng gửi tin nhắn đó.
* Một page có thể có nhiều nhân viên trả lời, thì bạn có thể dựa vào createdById và createdByName để biết nhân viên nào trả lời tin nhắn này.

```json
{
    "code": 1,
    "paginator": {
        "next": [
            1752414539,
            103507
        ]
    },
    "data": [
        {
            "id": "m_0el8TAOmOlM3g7a1J8uCiAZOYQkhWy6VQhC71nRoci-Qzt89WzXRRzP2DK1E72JIYwQf096ywuT6SxjHsNwexg",
            "conversationId": "101286204573840_4655657141168264",
            "pageId": "101286204573840",
            "senderId": "4655657141168264",
            "senderName": "Khách hàng A",
            "createdById": "t1xnk19a0",
            "createdByName": "Nhân viên A",
            "createdAt": 1752469318093,
            "message": "cảm ơn",
            "pageUserId": "4655657141168264"
        },
        {
            "id": "m_7iA2Os6paI7psEyYM-5pKgZOYQkhWy6VQhC71nRoci-Ewz9B5u0doUsPoWshzNDleLAe8uMt8twmkksEQHBylQ",
            "conversationId": "101286204573840_4655657141168264",
            "pageId": "101286204573840",
            "senderId": "101286204573840",
            "senderName": "Nguyễn Văn A",
            "createdAt": 1752414540296,
            "message": "hi Nguyễn A",
            "pageUserId": "4655657141168264"
        },
        {
            "id": "m_CzBpXKWh9dlkbUFeYShxeAZOYQkhWy6VQhC71nRoci8WmsX3BmpVa_R4iHY6qK0yV9oMEeAb8dl4m5Phs8H1og",
            "conversationId": "101286204573840_4655657141168264",
            "pageId": "101286204573840",
            "senderId": "101286204573840",
            "senderName": "Nguyễn Văn B",
            "createdAt": 1752414539445,
            "message": "chào Bạn. Mình có thể giúp gì cho bạn",
            "pageUserId": "4655657141168264"
        }
    ]
}
```
