List Templates
API
API dùng để lấy danh sách các mẫu (template) đã có từ hệ thống Zalo.
POST $BASE_URL/api/vendor/v1/zalo/list-templates
Lưu ý
- API-KEY: là duy nhất
- Các bước lấy API-KEY:
- Doanh nghiệp đăng nhập
- Di chuyển đến trang Key (hoặc License)
- Lấy 1 API-KEY thỏa mãn điều kiện hoạt động
Thông tin Request
Method:
POSTURL:
/api/vendor/v1/zalo/list-templatesHeaders:
accept: */*Content-Type: application/jsonAPI-KEY: {API_KEY}
Parameters:
API-KEY: Key License
Body:
filter: (Mô tả dữ liệu filter)paging: (Mô tả dữ liệu paging)
Cấu trúc request
| Key | Type Value | Required | Description |
|---|---|---|---|
API-KEY header | string | true | Key License |
filter body | object | false |
|
- Ví dụ Request
curl --location 'https://cpaas.interits.com:8080/api/vendor/v1/zalo/list-templates' \
--header 'API-KEY: EImADVLv3tjE0ExErTkhTbKxBWeWwhY' \
--header 'Content-Type: application/json' \
--data '{
"filter": {
"date_from": "2025-03-28T03:16:58.682536Z",
"date_to": "2026-03-28T03:16:58.682536Z",
"oa_id": "94900466102472689",
"template_id": 419951,
"template_name": "Đánh giá chất lượng dịch vụ",
"type": "rating"
}
}'
Thông tin Response
Mô tả: Mô tả dữ liệu trả về dùng làm gì
- Cấu trúc data của response
| Key | Type | Description |
|---|---|---|
| templates | array |
|
| paging | object | Bỏ qua, không quan tâm |
- Ví dụ Response
{
"code": 200,
"data": {
"paging": {
"after": ".",
"before": "",
"limit": 100,
"next": "AAAAAAAGaG8BAAYxXoDZaKj7",
"prev": "AAAAAAAGaG8BAAYxXoDZaKj7",
"sort": ""
},
"templates": [
{
"apply_template_quota": false,
"created_at": "2025-03-28T03:16:58.682536Z",
"preview_url": "https://account.zalo.cloud/znspreview/Wp5ZAYcfR6_A3HUCJPoCPQ==",
"price": 200,
"template_daily_quota": 0,
"template_id": 419951,
"template_name": "Đánh giá chất lượng dịch vụ",
"template_params": [
{
"accept_null": false,
"max_length": 50,
"min_length": 0,
"name": "Ten_khach_hang",
"require": true,
"type": "STRING"
},
{
"accept_null": false,
"max_length": 30,
"min_length": 0,
"name": "bill_id",
"require": true,
"type": "STRING"
},
{
"accept_null": false,
"max_length": 30,
"min_length": 0,
"name": "date",
"require": true,
"type": "STRING"
}
],
"template_quality": "UNDEFINED",
"template_remaining_quota": 0,
"template_status": "ENABLE",
"template_tag": "unknown",
"timeout": 7200,
"type": "rating",
"is_journey": false,
"token_type": "unknown",
"updated_at": "2025-04-01T03:47:11.954222Z"
}
]
}
}
Bảng Status Response
| Status Code | Status Message | Description |
|---|---|---|
| 200 | OK | Yêu cầu đã thành công và server trả về kết quả. |
| 201 | Created | Yêu cầu đã thành công và server đã tạo ra tài nguyên mới. |
| 204 | No Content | Yêu cầu đã thành công nhưng không có nội dung trả về. |
| 400 | Bad Request | Server không thể hiểu yêu cầu do cú pháp không hợp lệ message:
|
| 401 | Unauthorized | Cần xác thực để truy cập tài nguyên. |
| 403 | Forbidden | Server từ chối thực hiện yêu cầu, mặc dù người dùng đã xác thực. |
| 404 | Not Found | Tài nguyên yêu cầu không tồn tại trên server. |
| 405 | Method Not Allowed | Phương thức HTTP không được phép cho tài nguyên yêu cầu. |
| 500 | Internal Server Error | Lỗi không xác định trong server. |
| 502 | Bad Gateway | Server là một gateway hoặc proxy và nhận được phản hồi không hợp lệ từ server khác. |
| 503 | Service Unavailable | Server không thể xử lý yêu cầu do quá tải hoặc bảo trì. |
| 504 | Gateway Timeout | Server không nhận được phản hồi kịp thời từ server phụ trợ. |