Zalo OA API Send Message by Phone Number: Code & Limits
Zalo documentation screenshot, accessed 23 October 2026: ZBS Template Message phone-send API. Official source.
To send a Zalo OA API message by phone number, use ZBS Template Message with an approved template. This guide provides Node.js code, sending limits and common error checks. The advisory-message API uses a UID. Having a phone number in your CRM does not authorize unrestricted free-text messages to that person.
Choose the delivery channel before writing code: advisory messages use a UID, while phone-number delivery uses approved ZBS templates. Check OA permissions, the access token, billing setup and template parameters. HTTP 200 alone is insufficient: inspect Zalo’s error code and track delivery separately. After a timeout, reconcile before retrying. Pricing and sending times depend on the template, channel and current policy; avoid applying a single price to every message.
Should you send by phone number or UID?
The two routes serve different needs. A customer who has just asked about an order through your OA may receive an advisory reply when eligible. A CRM notification should start with selecting the appropriate template and delivery channel. Do not copy a free-text conversation reply into a phone-number template request.
The OpenAPI advisory conditions specify a 7-day window after the latest interaction. The text-message documentation sets a 2,000-character limit and a free 48-hour period after interaction, effective 1 January 2026. Being eligible to send and being eligible for free sending are different questions.
| Use case | Recipient identifier | Check before sending |
|---|---|---|
| Reply to a conversation | User UID within the OA | Interaction, timing and advisory-message permissions |
| Send a template by phone number | Phone number associated with Zalo | Approved template, customer relationship and phone-send permissions |

Zalo documentation screenshot, accessed 23 October 2026: advisory text messages.
What must be ready before the phone-number API call?
ZNS is now part of ZBS Template Message, consolidated from 1 January 2026. You need an OA, an OA-authorized application, the relevant sending permission and a ZBS Account for billing. A template must be approved; successfully creating a draft does not authorize sending. Check Zalo’s setup guide before configuring the environment.
The phone-send API uses POST https://business.openapi.zalo.me/message/template, an access_token header and four required JSON fields:
| Field | Prepare |
|---|---|
phone | A number in country-code format |
template_id | The approved template identifier |
template_data | The exact registered parameter names and types |
tracking_id | Your correlation identifier; the documentation recommends at most 48 characters without special characters |
Use customer details collected through your authorized business process. Do not test sending against purchased contact lists. For a new workflow, agree on its purpose and template first, then design the data supplied to that template.
How do you call the Zalo OA API from Node.js?
This example uses Node.js 18 or later without extra packages. It sends only when invoked. Load the token from a server-side secret store, use your approved template’s actual parameters and test only with authorized recipients. Keep tokens out of browser code, URLs and logs.
// Node >= 18. Importing this module sends nothing and reads no environment.
export async function sendTemplate({ accessToken, phone, templateId, templateData, trackingId }, fetchImpl = fetch) {
if (![accessToken, phone, templateId, trackingId].every(value => typeof value === 'string' && value.length)
|| !templateData || typeof templateData !== 'object'
|| Array.isArray(templateData)) throw new TypeError('Invalid template request');
let response;
try {
response = await fetchImpl('https://business.openapi.zalo.me/message/template', {
method: 'POST',
headers: { 'content-type': 'application/json', access_token: accessToken },
body: JSON.stringify({ phone, template_id: templateId, template_data: templateData, tracking_id: trackingId }),
// Application timeout, not a provider-guaranteed delivery deadline.
signal: AbortSignal.timeout(10_000),
});
} catch {
throw new Error('Send outcome unknown; reconcile before retrying');
}
let payload;
try { payload = await response.json(); }
catch { throw new Error('Send outcome unknown; invalid response, reconcile before retrying'); }
if (!response.ok || payload?.error !== 0) {
// Do not print the response: it may contain personal data.
throw new Error('Template request not confirmed successful; review before retrying');
}
// tracking_id is a required correlation field, not a deduplication guarantee.
return payload;
}
templateData must match the approved schema. The 10-second timeout is an application choice. If it expires, Zalo may already have received the request. trackingId links a business event to an API attempt; the documentation does not guarantee that it prevents duplicate sends.
In a deployed integration, create a send record with a unique business key before making the request. Save the returned message identifier and processing status, while limiting personal data in logs. Local tests of this example use synthetic fixtures; they do not establish your OA’s permissions or prove delivery.
Why can HTTP 200 arrive before the customer receives anything?
HTTP success concerns transport. This example also requires error === 0 before treating the API request as successful. Delivery is a separate stage. The message-status documentation distinguishes status 0, accepted but not delivered, from status 1, delivered. Retain msg_id for reconciliation.
Use the official error table to fix the cause before retrying:
| Code | Check |
|---|---|
-124 | Invalid access token: inspect the token and OA authorization |
-131 | Template not approved: inspect its status |
-1122 | Missing parameter: compare the request with the template schema |
-144 | Daily phone-send quota exceeded |

Screenshot of Zalo’s official error reference, accessed 23 October 2026.
Which sending limits and costs should you confirm?
No single price fits every template. Check price_sdt and price_uid in the template-details API or ZBS Account. The public pricing page and terms accessed on 23 October 2026 show conflicting amounts. Do not turn those figures into a firm quote. Public prices exclude VAT.
An October notice schedules Tag 1 sending at all hours and Tags 2 and 3 between 07:00 and 22:00 from 15 October 2026. The source still labels the change as planned. Confirm the mechanism applied to your OA before scheduling; do not describe template delivery as unrestricted at any time.
How should this connect to a chatbot workflow?
Separate receiving events, making business decisions and sending messages. A webhook receives a conversation event; a worker chooses an eligible advisory reply or template; a status tracker records API and delivery results. This gives support staff a clear next action: fix data, wait for confirmation or contact the customer through another appropriate channel.
Continue with Zalo OA webhook verification in Node.js and ZNS template approval, pricing and rejection checks. For the wider support experience, read Zalo OA chatbots for businesses. Official documentation linked here was accessed on 23 October 2026; check again before deployment when policy changes matter to your workflow.
Source portal: Zalo for Developers. Current detailed references are linked beside each claim. Accessed 23 October 2026.
Frequently asked questions
Can the Zalo OA API send a message by phone number?
Yes, through ZBS Template Message with an approved template and the required sending conditions. Advisory messages use a UID. Configure and check each channel separately.
Does HTTP 200 mean the customer received the message?
No. Inspect the JSON error code, then track delivery status. A successful API response and delivery to the recipient are separate states.
Should I retry automatically after an API timeout?
Do not retry blindly. The earlier request may have been accepted. Retain the business record, reconcile the outcome and resolve uncertainty before another send.
Is there a fixed price for every Zalo API message?
No. Cost depends on the template, components and channel. Check the current template price in ZBS Account or the channel-specific price fields. Example response values are not a quote.