ZNS APISend ZNS message

Send ZNS message

Tạ Quốc Thắng·6/2/2026

ZNS message sending API group (Zalo Notification Service): send ZNS to customers and retrieve the list of available ZNS templates.

Authentication: All requests need to send the header X-Api-Key. Contact Alohub to obtain an API Key.

Requirements: Before sending ZNS, you need to have a Zalo OA connected to Alohub and the ZNS template approved by Zalo. Use the API List Template ZNS to check available templates.


1. Send ZNS

POST /v1/zns/send

Send ZNS message to the customer's phone number via the specified campaign. Supports passing personalization information to fill in the ZNS template.

Headers

Header

Required

Description

X-Api-Key

Yes

API Key for authentication

Content-Type

Yes

application/json

Request Body

Parameter

Type

Required

Description

phone

string

Yes

Customer's phone number (registered with Zalo)

campaignId

number

Yes

ZNS campaign ID

transactionId

string

No

Transaction ID created by the client for result matching

name

string

No

Customer name

email

string

No

Customer email

address

string

No

Customer address

pField1pField6

string

No

Personalization information fields (up to 6 fields). Values will be assigned to corresponding variables in the ZNS template

Sample code

curl --location -g '{{base_url}}/v1/zns/send' \
  --header 'X-Api-Key: {{api_key}}' \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "phone": "0123456789",
    "campaignId": 1,
    "transactionId": "TXN_004",
    "name": "Nguyễn Văn A",
    "email": "nguyenvana@example.com",
    "pField1": "Đơn hàng #12345",
    "pField2": "Đang giao hàng"
  }'
const axios = require('axios')

const response = await axios.post('{{base_url}}/v1/zns/send', {
  phone: '0123456789',
  campaignId: 1,
  transactionId: 'TXN_004',
  name: 'Nguyễn Văn A',
  email: 'nguyenvana@example.com',
  pField1: 'Đơn hàng #12345',
  pField2: 'Đang giao hàng'
}, {
  headers: {
    'X-Api-Key': '{{api_key}}',
    'Content-Type': 'application/json'
  }
})

console.log(response.data)
import requests

response = requests.post('{{base_url}}/v1/zns/send',
  json={
    'phone': '0123456789',
    'campaignId': 1,
    'transactionId': 'TXN_004',
    'name': 'Nguyễn Văn A',
    'email': 'nguyenvana@example.com',
    'pField1': 'Đơn hàng #12345',
    'pField2': 'Đang giao hàng'
  },
  headers={
    'X-Api-Key': '{{api_key}}',
    'Content-Type': 'application/json'
  }
)

print(response.json())

2. List of ZNS templates

POST /v1/zns/template

Retrieve the list of ZNS templates approved by Zalo. Can filter by Zalo OA, status, and include parameter or mapping information.

Headers

Header

Required

Description

X-Api-Key

Yes

API Key for authentication

Content-Type

Yes

application/json

Request Body

Parameter

Type

Required

Description

oaId

string

No

ID of Zalo OA. Leave empty ""to get all OAs

status

string

No

Filter by template status. Leave empty ""to get all

includeParams

boolean

No

true= include the list of parameters for each template

includeMappings

boolean

No

true= include mapping field information

Sample code

curl --location -g '{{base_url}}/v1/zns/template' \
  --header 'X-Api-Key: {{api_key}}' \
  --header 'Content-Type: application/json' \
  --data '{
    "oaId": "",
    "status": "",
    "includeParams": true,
    "includeMappings": true
  }'
const axios = require('axios')

const response = await axios.post('{{base_url}}/v1/zns/template', {
  oaId: '',
  status: '',
  includeParams: true,
  includeMappings: true
}, {
  headers: {
    'X-Api-Key': '{{api_key}}',
    'Content-Type': 'application/json'
  }
})

console.log(response.data)
import requests

response = requests.post('{{base_url}}/v1/zns/template',
  json={
    'oaId': '',
    'status': '',
    'includeParams': True,
    'includeMappings': True
  },
  headers={
    'X-Api-Key': '{{api_key}}',
    'Content-Type': 'application/json'
  }
)

print(response.json())

Was this article helpful?
Updated: 6/2/2026