# Send Zalo ZNS messages from your backend

ZNS (Zalo Notification Service) sends an approved template to a phone number through your Zalo Official Account, even if the customer never messaged you. Ha Tang connects the OA once and gives you one API call; replies land in the same inbox as your other channels.

**Before you start:** connect the Zalo OA under **Support → Channels**, put it on a Zalo tier that includes ZNS, and get your templates approved at oa.zalo.me. Use an API key with `crm:write`.

```ts
import { Hatang } from "@hatang/sdk";

const hatang = new Hatang(); // HATANG_API_KEY

const { data, error } = await hatang.chat.zns.send({
  account_id: "cha_123", // the connected OA
  template_id: "231234", // an approved template
  phone: "0912345678", // 84912345678 and +84 912 345 678 work too
  template_data: { customer_name: "Lan", order_code: "DH1024", amount: "350.000đ" },
});
if (error) throw new Error(error.message);
if (data.status === "failed") console.error("Zalo refused:", data.error);
```

The same call over HTTP is `POST https://api.hatang.dev/chat/zns`. List an OA's templates and its daily quota with `hatang.chat.zns.templates("cha_123")`.

Zalo charges for every message. To send to many customers at once, or from a workflow when an order is paid, see the full guide.

## Go further

- Templates, bulk sends, workflows and errors: [Zalo ZNS](https://hatang.dev/docs/guides/support/zns.md)
- Everything else the support API does: [Support REST API](https://hatang.dev/docs/guides/support/rest-api.md)

Source: https://hatang.dev/docs/guides/recipes/zalo-zns
