Developer

API ZAgent — Build trên cùng nền tảng

Truy cập đầy đủ workspace, contacts, conversations, broadcast, automations qua REST API + webhooks. Tài liệu đầy đủ và SDK đa ngôn ngữ.

Authentication

Sử dụng API key dạng Bearer token gắn trong header. Mỗi workspace có thể tạo nhiều key, mỗi key có scope riêng.

curl -H "Authorization: Bearer YOUR_API_KEY" \
  https://api.zalhub.com/v1/contacts

Rate limit

Mặc định 60 request / phút / key. Header phản hồi có X-RateLimit-Remaining và X-RateLimit-Reset. Gói Enterprise được nâng theo thoả thuận.

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 47
X-RateLimit-Reset: 1740000000

Webhooks

Đăng ký URL nhận event (message.received, message.sent, contact.updated, broadcast.completed). Payload ký HMAC-SHA256 với webhook secret.

POST https://yourapp.com/zalhub-webhook
X-Zalhub-Signature: sha256=...

{
  "event": "message.received",
  "data": { "profileId": "...", "from": "...", "text": "..." }
}

SDKs

Đang phát hành: Node.js (TypeScript), Python. PHP, Go, Ruby trong roadmap Q3/2026. Mã nguồn mở trên GitHub.

// Node.js
import { ZAgent } from "@zalhub/sdk";
const client = new ZAgent({ apiKey: process.env.ZALHUB_KEY });
const conv = await client.conversations.list({ limit: 20 });

Cần API key cho dự án?

Tạo workspace miễn phí, vào Cài đặt → API & Webhook để generate key. Hỗ trợ kỹ thuật miễn phí cho 5 tích hợp đầu tiên.