VI | EN
Nhắn Messenger
Dành cho developer

Tham số, nút, trạng thái duyệt, giá của một mẫu ZNS — API Zalo OA

Lấy chi tiết template · gọi qua Quantri360 bằng một API key cho chính tài khoản / tài sản bạn đã kết nối và ủy quyền — 360 lo việc ký request và làm mới phiên đăng nhập bạn đã cấp.

Lấy chi tiết template

GET/zns/template/info/v2Gọi qua 360: GET https://partner.quantri360.com/v1/zalo/zns/template/info/v2
Mô tả API

Chi tiết một mẫu ZNS: danh sách tham số cần truyền (tên, kiểu, độ dài, bắt buộc), nút bấm, trạng thái và lý do, loại nội dung (giao dịch / CSKH / hậu mãi), đơn giá mỗi tin. Dùng dựng đúng template_data trước khi gửi.

  • Đơn giá là CHUỖI có phần thập phân ("300.0").
  • Tham số kiểu DATE truyền chuỗi dd/MM/yyyy; NUMBER truyền số nguyên dạng chuỗi (không dấu phân cách) — sai định dạng thường gặp lỗi -1124.

Request

Địa chỉ

GET https://partner.quantri360.com/v1/zalo/zns/template/info/v2

Xác thực & gian hàng

TênVị tríKiểuMẫuMô tả
AuthorizationheaderheaderBearer q360_live_ab12cd34_…Khóa API của brand (tạo ở mục API key). Bắt buộc với mọi request. Brand suy từ key — không truyền mã brand.
platform_shop_idquerystring1173478676788457425OA_ID của Zalo OA brand đã nối (GET /v1/platforms). Mỗi brand một OA — có thể bỏ.
dataquerystring (JSON){"offset":0,"count":10}Nhiều API GET của Zalo nhận tham số gói trong data là chuỗi JSON — gửi nguyên như tài liệu Zalo.

Tham số request

TênVị tríKiểuBắt buộcMẫuMô tả
template_idquerystringCó600003Mã mẫu (templateId từ /zns/template/all).

Ví dụ request

curl -s "https://partner.quantri360.com/v1/zalo/zns/template/info/v2?template_id=600003" \
  -H "Authorization: Bearer $KEY"
Python
import requests

KEY = "q360_live_..."  # khóa API của brand
r = requests.get(
    "https://partner.quantri360.com/v1/zalo/zns/template/info/v2",
    params={
        "template_id": "600003"
    },
    headers={"Authorization": f"Bearer {KEY}"},
    timeout=60,
)
print(r.status_code)
print(r.json())
Node.js
const KEY = 'q360_live_...'; // khóa API của brand
const url = new URL('https://partner.quantri360.com/v1/zalo/zns/template/info/v2');
for (const [k, v] of Object.entries({"template_id":"600003"})) url.searchParams.set(k, typeof v === 'object' ? JSON.stringify(v) : String(v));
const r = await fetch(url, {
  method: 'GET',
  headers: { Authorization: `Bearer ${KEY}` },
});
console.log(r.status, await r.json());
PHP
<?php
$key = 'q360_live_...'; // khóa API của brand
$url = 'https://partner.quantri360.com/v1/zalo/zns/template/info/v2' . '?' . http_build_query(['template_id' => '600003']);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer ' . $key]);
$res = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $status, "\n", $res;

Response

Tham số phản hồi (nguyên của Zalo OA)

TênKiểuMẫuMô tả
errorint00 = thành công.
messagestringSuccess
dataobject
templateIdint600003
templateNamestringXác nhận đơn hàng
statusstringENABLE`ENABLE` · `PENDING_REVIEW` · `REJECT` · `DISABLE` · `DELETE`.
reasonstringTemplate đã được duyệtLý do trạng thái (lý do từ chối / khóa).
listParamsobject[]Tham số phải có trong template_data khi gửi.
namestringorder_codeTên khóa trong template_data.
requirebooltrueBắt buộc.
typestringSTRING`STRING` · `NUMBER` · `DATE` …
maxLengthint30Độ dài tối đa — vượt là lỗi -1121.
minLengthint0
acceptNullboolfalseCho phép rỗng.
listButtonsobject[]Nút bấm của mẫu.
typeint3Loại nút: `1` trang doanh nghiệp · `2` gọi điện · `3` trang OA · `4` Mini App · `10` sao chép · `11` thanh toán · `12` xem chi tiết …
titlestringTheo dõi Cửa hàng mẫu
contentstringLink / số điện thoại / nội dung sao chép (vd `<otp>`).
timeoutint7200000Thời hạn của tin, mili giây.
previewUrlstringLink xem trước mẫu.
templateTagstringTRANSACTION`TRANSACTION` giao dịch · `CUSTOMER_CARE` CSKH · `PROMOTION` hậu mãi.
templateQualitystringnullHiện thường là chuỗi "null".
price_sdtstring300.0Đơn giá gửi qua số điện thoại (VND, chuỗi).
price_uidstring0.0Đơn giá gửi qua UID Zalo.
pricestring300.0Cũ — bằng price_sdt.
applyTemplateQuotaboolfalse

Mẫu phản hồi

{
  "error": 0,
  "message": "Success",
  "data": {
    "templateId": 600003,
    "templateName": "Xác nhận đơn hàng",
    "status": "ENABLE",
    "listParams": [
      {
        "name": "name",
        "require": true,
        "type": "STRING",
        "maxLength": 30,
        "minLength": 0,
        "acceptNull": false
      },
      {
        "name": "order_code",
        "require": true,
        "type": "STRING",
        "maxLength": 30,
        "minLength": 0,
        "acceptNull": false
      },
      {
        "name": "price",
        "require": true,
        "type": "NUMBER",
        "maxLength": 20,
        "minLength": 0,
        "acceptNull": false
      },
      {
        "name": "date",
        "require": true,
        "type": "DATE",
        "maxLength": 20,
        "minLength": 0,
        "acceptNull": false
      }
    ],
    "listButtons": [
      {
        "type": 3,
        "title": "Theo dõi Cửa hàng mẫu",
        "content": "https://oa.zalo.me/1188000000000000001"
      }
    ],
    "timeout": 7200000,
    "previewUrl": "https://account.zalo.cloud/znspreview/VcvnuTgDL3Wr…",
    "templateQuality": "null",
    "templateTag": "TRANSACTION",
    "price": "300.0",
    "applyTemplateQuota": false,
    "reason": "Template đã được duyệt",
    "price_uid": "0.0",
    "price_sdt": "300.0"
  }
}

Bắt đầu dùng

  1. Đăng ký tài khoản Partner
  2. Mở loại dữ liệu thuộc nhóm ZNS (Zalo Notification Service) ở trang nền tảng
  3. Tạo API key (tick kênh Zalo OA)
  4. Gọi theo ví dụ ở trên