curl --request POST \
--url https://business.adflex.vn/api/v1/messages/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"template_id": "123456",
"phone": "84912345678",
"template_data": {
"otp": "246813",
"time": "5 phut"
},
"tracking_id": "otp-login-8842",
"send_at": "2026-09-01T09:00:00+07:00"
}
'import requests
url = "https://business.adflex.vn/api/v1/messages/send"
payload = {
"template_id": "123456",
"phone": "84912345678",
"template_data": {
"otp": "246813",
"time": "5 phut"
},
"tracking_id": "otp-login-8842",
"send_at": "2026-09-01T09:00:00+07:00"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
template_id: '123456',
phone: '84912345678',
template_data: {otp: '246813', time: '5 phut'},
tracking_id: 'otp-login-8842',
send_at: '2026-09-01T09:00:00+07:00'
})
};
fetch('https://business.adflex.vn/api/v1/messages/send', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://business.adflex.vn/api/v1/messages/send",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'template_id' => '123456',
'phone' => '84912345678',
'template_data' => [
'otp' => '246813',
'time' => '5 phut'
],
'tracking_id' => 'otp-login-8842',
'send_at' => '2026-09-01T09:00:00+07:00'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://business.adflex.vn/api/v1/messages/send"
payload := strings.NewReader("{\n \"template_id\": \"123456\",\n \"phone\": \"84912345678\",\n \"template_data\": {\n \"otp\": \"246813\",\n \"time\": \"5 phut\"\n },\n \"tracking_id\": \"otp-login-8842\",\n \"send_at\": \"2026-09-01T09:00:00+07:00\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://business.adflex.vn/api/v1/messages/send")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"template_id\": \"123456\",\n \"phone\": \"84912345678\",\n \"template_data\": {\n \"otp\": \"246813\",\n \"time\": \"5 phut\"\n },\n \"tracking_id\": \"otp-login-8842\",\n \"send_at\": \"2026-09-01T09:00:00+07:00\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://business.adflex.vn/api/v1/messages/send")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"template_id\": \"123456\",\n \"phone\": \"84912345678\",\n \"template_data\": {\n \"otp\": \"246813\",\n \"time\": \"5 phut\"\n },\n \"tracking_id\": \"otp-login-8842\",\n \"send_at\": \"2026-09-01T09:00:00+07:00\"\n}"
response = http.request(request)
puts response.read_body{
"msg_id": "m_a1b2c3d4e5f6g7h8",
"tracking_id": "otp-login-8842",
"status": "queued",
"scheduled_at": "2023-11-07T05:31:56Z"
}{
"error": {
"code": 401,
"message": "API key không hợp lệ hoặc đã bị thu hồi"
}
}{
"error": {
"code": 401,
"message": "API key không hợp lệ hoặc đã bị thu hồi"
}
}{
"error": {
"code": 401,
"message": "API key không hợp lệ hoặc đã bị thu hồi"
}
}{
"error": {
"code": 401,
"message": "API key không hợp lệ hoặc đã bị thu hồi"
}
}Gửi một tin
Gửi một tin ZNS.
Trả 202 khi tin vào hàng đợi. Mã này xác nhận tiếp nhận, không xác nhận đã giao tới người nhận.
Scope: messages:send
curl --request POST \
--url https://business.adflex.vn/api/v1/messages/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"template_id": "123456",
"phone": "84912345678",
"template_data": {
"otp": "246813",
"time": "5 phut"
},
"tracking_id": "otp-login-8842",
"send_at": "2026-09-01T09:00:00+07:00"
}
'import requests
url = "https://business.adflex.vn/api/v1/messages/send"
payload = {
"template_id": "123456",
"phone": "84912345678",
"template_data": {
"otp": "246813",
"time": "5 phut"
},
"tracking_id": "otp-login-8842",
"send_at": "2026-09-01T09:00:00+07:00"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
template_id: '123456',
phone: '84912345678',
template_data: {otp: '246813', time: '5 phut'},
tracking_id: 'otp-login-8842',
send_at: '2026-09-01T09:00:00+07:00'
})
};
fetch('https://business.adflex.vn/api/v1/messages/send', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://business.adflex.vn/api/v1/messages/send",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'template_id' => '123456',
'phone' => '84912345678',
'template_data' => [
'otp' => '246813',
'time' => '5 phut'
],
'tracking_id' => 'otp-login-8842',
'send_at' => '2026-09-01T09:00:00+07:00'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://business.adflex.vn/api/v1/messages/send"
payload := strings.NewReader("{\n \"template_id\": \"123456\",\n \"phone\": \"84912345678\",\n \"template_data\": {\n \"otp\": \"246813\",\n \"time\": \"5 phut\"\n },\n \"tracking_id\": \"otp-login-8842\",\n \"send_at\": \"2026-09-01T09:00:00+07:00\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://business.adflex.vn/api/v1/messages/send")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"template_id\": \"123456\",\n \"phone\": \"84912345678\",\n \"template_data\": {\n \"otp\": \"246813\",\n \"time\": \"5 phut\"\n },\n \"tracking_id\": \"otp-login-8842\",\n \"send_at\": \"2026-09-01T09:00:00+07:00\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://business.adflex.vn/api/v1/messages/send")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"template_id\": \"123456\",\n \"phone\": \"84912345678\",\n \"template_data\": {\n \"otp\": \"246813\",\n \"time\": \"5 phut\"\n },\n \"tracking_id\": \"otp-login-8842\",\n \"send_at\": \"2026-09-01T09:00:00+07:00\"\n}"
response = http.request(request)
puts response.read_body{
"msg_id": "m_a1b2c3d4e5f6g7h8",
"tracking_id": "otp-login-8842",
"status": "queued",
"scheduled_at": "2023-11-07T05:31:56Z"
}{
"error": {
"code": 401,
"message": "API key không hợp lệ hoặc đã bị thu hồi"
}
}{
"error": {
"code": 401,
"message": "API key không hợp lệ hoặc đã bị thu hồi"
}
}{
"error": {
"code": 401,
"message": "API key không hợp lệ hoặc đã bị thu hồi"
}
}{
"error": {
"code": 401,
"message": "API key không hợp lệ hoặc đã bị thu hồi"
}
}Authorizations
Authorization: Bearer ak_live_…
Body
Mã template phía Zalo
"123456"
Số người nhận. Chấp nhận 0912345678, +84912345678, 912345678 — hệ thống tự quy về 84xxxxxxxxx.
API KHÔNG kiểm tra định dạng. Số sai vẫn vào hàng đợi rồi mới thất bại ở Zalo. Hãy lọc phía bạn trước.
"84912345678"
Khoá là tên tham số lấy từ GET /api/v1/templates, giá trị luôn là chuỗi.
Show child attributes
Show child attributes
{ "otp": "246813", "time": "5 phut" }
Mã đối soát do hệ thống của bạn định nghĩa. Không truyền thì AdFlex dùng msg_id.
Tối đa 48 ký tự; chỉ chấp nhận chữ, số, dấu chấm, gạch ngang, gạch dưới. Vi phạm trả lỗi 400.
48^[A-Za-z0-9._-]+$"otp-login-8842"
ISO 8601, xa nhất 60 ngày. Thời điểm quá khứ = gửi ngay.
"2026-09-01T09:00:00+07:00"
Bỏ trống = theo mặc định của OA. RSA dùng endpoint riêng.
plain, hashphone Response
Đã nhận vào hàng đợi
"m_a1b2c3d4e5f6g7h8"
Mã đối soát do hệ thống của bạn định nghĩa. Không truyền thì AdFlex dùng msg_id.
Tối đa 48 ký tự; chỉ chấp nhận chữ, số, dấu chấm, gạch ngang, gạch dưới. Vi phạm trả lỗi 400.
48^[A-Za-z0-9._-]+$"otp-login-8842"
queued