VI | EN
Message us on Messenger
Developer resources

Trạng thái gửi / nhận của một tin ZNS — Zalo OA API

Lấy trạng thái tin ZNS · call it through Quantri360 with one API key for your own accounts / assets that you connected and authorized — 360 handles request signing and refreshing the authorization you granted.

Lấy trạng thái tin ZNS

GET/zns/message/statusVia 360: GET https://partner.quantri360.com/v1/zalo/zns/message/status
Description

API Lấy thông tin trạng thái gửi tin qua SĐT — API cho phép đối tác truy xuất trạng thái gửi tin qua SĐT. Quyền cần có: Gửi tin qua số điện thoại

Request

Endpoint

GET https://partner.quantri360.com/v1/zalo/zns/message/status

Authentication & shop

NameInTypeSampleDescription
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.

Request parameters

NameInTypeRequiredSampleDescription
message_idquerystringYesID của thông báo cần lấy thông tin trạng thái.

Request examples

curl -s "https://partner.quantri360.com/v1/zalo/zns/message/status?message_id=" \
  -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/message/status",
    params={
        "message_id": ""
    },
    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/message/status');
for (const [k, v] of Object.entries({"message_id":""})) 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/message/status' . '?' . http_build_query(['message_id' => '']);
$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

Response fields (as returned by Zalo OA)

NameTypeSampleDescription
errorint0 = thành công; khác 0 xem `message` (Zalo trả HTTP 200 kèm mã lỗi).
messagestringThông điệp của Zalo.
dataobjectDữ liệu.
delivery_timestringThời gian thiết bị của người dùng nhận được tin qua SĐT.
statusintTrạng thái của tin qua SĐT.
messagestringMô tả trạng thái tin qua SĐT. Các giá trị trả về: -1: The message does not exist 0: The message is pushed successfully to Zalo server but has not yet delivered to user’s phone 1: The message was delivered to the user's phone

Response sample

{
   "message": "Success",
   "data": {
       "delivery_time": "1600328011517",
       "message": "The message was delivered to the user's phone",
       "status": 1
   },
   "error": 0
}

Get started

  1. Sign up for Partner
  2. Enable a data type of the ZNS (Zalo Notification Service) group on the platform page
  3. Create an API key (tick the Zalo OA channel)
  4. Call it as in the examples above