# Danh sách hội thoại

* Lấy danh sách hội thoại.

## Request

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

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

### Filters

| Key      | Type                 | Description                                  |
| -------- | -------------------- | -------------------------------------------- |
| pageIds  | array                | Danh sách pageIds muốn lấy hội thoại         |
| type     | int                  | Loại hội thoại. 1: Bình luận, 2: Tin nhắn    |
| hasPhone | boolean (true/false) | Hội thoại có/không có số điện thoại.         |
| hasReply | boolean (true/false) | Hội thoại đã trả lời/chưa trả lời.           |
| status   | int                  | Trạng thái hội thoại. 1: Chưa đọc, 2: Đã đọc |
| tagIds   | array                | Hội thoại đã gắn những tagIds này            |
| postIds  | array                | Hội thoại phát sinh từ những postIds này     |

### 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

| Value       | Description                       | Sort      |
| ----------- | --------------------------------- | --------- |
| updatedTime | Thời gian tương tác của hội thoại | ASC, DESC |

## Response

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

### Failed response

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

### Successful response

```json
{
    "code": 1,
    "paginator": {
        "next": [
            1742545330,
            6478
        ]
    },
    "data": [
        {
            "id": "331526780045341_7521482117936821",
            "channel": 1,
            "type": 2,
            "customerAvatar": "https://example.com/user_1.jpg",
            "pageId": "331526780045341",
            "pageUserId": "7521482117936821",
            "pageUserName": "Linhgfx",
            "hasReply": true,
            "assignedGroupId": "",
            "hasPhone": true,
            "createdAt": 1718878288,
            "updatedAt": 1742803465,
            "lastSeenMessageAt": 1742827806,
            "lastMessage": "[Send sticker]",
            "status": 2,
        },
        {
            "id": "101286204573840_1075546127814826_101286204573840",
            "type": 1,
            "channel": 1,
            "hasPhone": false,
            "hasReply": true,
            "lastMessage": "hi dev vp Trung Nguyễn cmt\npa\ncmt3 0987695050\ncmt2 0987695050\ncmt1 0987695050",
            "status": 2,
            "customerAvatar": "https://example.com/user_2.jpg",
            "isFromLive": 1,
            "createdAt": 1749876899,
            "updatedAt": 1751353509,
            "pageUserName": "Tạp Chí Ò ó o",
            "pageUserId": "101286204573840",
            "pageId": "101286204573840",
            "pagePostId": "101286204573840_1075546127814826"
        }
    ]
}
```
