# Ha Tang developer docs > Ha Tang (Hạ Tầng) is a customer support platform for businesses in Vietnam: one inbox for website chat, mobile apps, Zalo, Messenger, Instagram, TikTok Shop, WhatsApp and email, with an AI assistant, plus a transactional email API, VietQR payments and e-invoices. These are the developer guides and API references. - REST API base URL: https://api.hatang.dev, auth with `Authorization: Bearer ht_...`; Payments has separate development and production environments, picked with the `Hatang-Environment` header. - SDKs: @hatang/sdk (Node.js), hatang (Python), @hatang/chat-react, @hatang/chat-react-native, hatang_chat (Flutter), HatangChat (iOS), dev.hatang:chat (Android). - MCP server for coding agents: `npx -y @hatang/mcp` (see guides/sdks/mcp). ## Getting started - [Introduction](https://hatang.dev/docs/guides/getting-started/introduction.md): What Ha Tang is, the modules it is made of, and how to find your way around this developer hub. - [Quickstart: send your first email](https://hatang.dev/docs/guides/getting-started/quickstart-email.md): Create an API key, verify a sending domain and send your first email with cURL, Node.js, Python or PHP. - [Quickstart: add live chat to your site](https://hatang.dev/docs/guides/getting-started/quickstart-chat.md): Put the Ha Tang chat widget on your website in two lines, identify signed-in users, reply from the inbox and add chat to your mobile apps. - [Use Ha Tang with AI coding agents](https://hatang.dev/docs/guides/getting-started/ai-agents.md): Give Claude Code, Cursor, GitHub Copilot, Codex or Windsurf the current Ha Tang docs and rules, with the MCP server, a skill, a Cursor rule or an AGENTS.md section, so they write correct integrations. - [Authentication](https://hatang.dev/docs/guides/getting-started/authentication.md): Create API keys, choose their scopes, restrict them to a domain or browser origins, pick the Payments environment, and rotate or revoke keys safely. - [Rate limits](https://hatang.dev/docs/guides/getting-started/rate-limits.md): The per-second request limits of each module, the rate limit headers, the daily email quota and how to back off and retry. - [Errors](https://hatang.dev/docs/guides/getting-started/errors.md): The error format every Ha Tang API uses, the errors you will meet most often, and how to handle them in code. - [Pagination](https://hatang.dev/docs/guides/getting-started/pagination.md): Page through Ha Tang list endpoints with the after cursor, the limit parameter, has_more and next_cursor. - [Idempotency](https://hatang.dev/docs/guides/getting-started/idempotency.md): Retry email sends, payments and chat messages safely with the Idempotency-Key header, and handle idempotency conflicts. - [Webhooks](https://hatang.dev/docs/guides/getting-started/webhooks.md): Receive signed HTTP callbacks for events in every module, verify their signatures, handle retries and replays, and test them locally. - [API libraries](https://hatang.dev/docs/guides/getting-started/api-libraries.md): The official Node.js SDK, the chat SDKs for web and mobile, and how to generate a client in any language from the OpenAPI spec. - [Security](https://hatang.dev/docs/guides/getting-started/security.md): Protect your Ha Tang integration by keeping API keys and secrets safe, restricting and rotating keys, verifying webhooks and verifying chat identities. ## Email - [Ha Tang Email](https://hatang.dev/docs/guides/email/overview.md): Send transactional and marketing email from your own domain with a Resend-compatible API and SMTP relay on Amazon SES. - [Domains](https://hatang.dev/docs/guides/email/domains.md): Add a sending domain, publish its DKIM, SPF, return-path and DMARC records, and verify it so you can send from it. - [Send email](https://hatang.dev/docs/guides/email/sending.md): Send email with POST /emails and POST /emails/batch, with attachments, tags, headers, scheduling and idempotency, and follow its status and events. - [SMTP relay](https://hatang.dev/docs/guides/email/smtp.md): Send email through smtp.hatang.dev on port 5870 with STARTTLS, with recipes for Nodemailer, Laravel, Django, Rails, Spring Boot, WordPress, PHPMailer and Postfix. - [Templates](https://hatang.dev/docs/guides/email/templates.md): Write reusable emails with variables, publish them, and send them by id or alias from the API, broadcasts and automations. - [Open and click tracking](https://hatang.dev/docs/guides/email/tracking.md): Turn on open and click tracking per domain, serve tracked links from your own subdomain, and understand what tracking records. - [Receive email](https://hatang.dev/docs/guides/email/receiving.md): Receive mail sent to your domain as an email.received webhook, then read the message and its attachments through the API. - [Email groups](https://hatang.dev/docs/guides/email/groups.md): Forward mail sent to one address on your domain, like team@example.com, to a list of people, the way Google Workspace groups do. - [Contacts, segments and topics](https://hatang.dev/docs/guides/email/audiences.md): Organize who receives your broadcasts with contacts, custom properties, segments and topics, through the dashboard or the API. - [Broadcasts](https://hatang.dev/docs/guides/email/broadcasts.md): Write a marketing email once and send it to every subscribed contact of a segment, now or on a schedule, with merge tags and one-click unsubscribe. - [Automations](https://hatang.dev/docs/guides/email/automations.md): Build per-contact email sequences that start when your app sends an event, with delays, waits for other events, conditions and contact updates. - [Suppressions and bounces](https://hatang.dev/docs/guides/email/suppressions-and-bounces.md): How hard bounces, spam complaints and unsubscribes put an address on your suppression list, what happens when you send to it, and how to remove it. - [Deliverability](https://hatang.dev/docs/guides/email/deliverability.md): Get your email into the inbox with aligned SPF, DKIM and DMARC, a careful warm-up, clean lists and the signals Ha Tang gives you. - [Metrics and logs](https://hatang.dev/docs/guides/email/metrics-and-logs.md): Read delivery, open, click, bounce and complaint numbers in the dashboard or through GET /emails/metrics, and debug integrations with the API request log. - [Migrate from Resend](https://hatang.dev/docs/guides/email/migrate-from-resend.md): Move from Resend to Ha Tang Email, what stays the same, what is different, and how SendGrid and Postmark fields map to the Ha Tang API. ## Support - [Overview](https://hatang.dev/docs/guides/support/overview.md): Ha Tang Support is a multi-channel inbox; learn its building blocks (sites, conversations, customers, channels, agents) and how a message travels through it. - [Install the web widget](https://hatang.dev/docs/guides/support/web-widget/install.md): Create a website channel, paste the two-tag snippet on every page and confirm the chat widget loads on your domain. - [Configure the widget](https://hatang.dev/docs/guides/support/web-widget/configuration.md): Set the widget's look, launcher, greeting, pre-chat form, office hours and visibility in the dashboard, and override them per page with window.HATANG_CONFIG. - [JavaScript API](https://hatang.dev/docs/guides/support/web-widget/javascript-api.md): Control the web widget from your page with $hatang.push commands, listen to its events, send leads from your own forms and track chat conversions. - [Mobile apps](https://hatang.dev/docs/guides/support/mobile-apps.md): Add in-app chat to your iOS, Android, Flutter or React Native app with an app key that belongs to one of your websites. - [Identity verification](https://hatang.dev/docs/guides/support/web-widget/identity-verification.md): Sign identify calls with your site's identity secret so the inbox trusts the user ID, links every session of a signed-in user and keeps visitors from impersonating each other. - [In-app purchases and subscriptions](https://hatang.dev/docs/guides/support/in-app-purchases.md): Show each customer's App Store, Google Play and web plans and purchases on their profile, for your team and the AI assistant. Two ways to send them, from your app with the store connected or from your own backend, with setup, code, importing past purchases and testing. - [Automation](https://hatang.dev/docs/guides/support/automation.md): Route conversations, run scripted bots, react to events with workflows, show proactive campaigns and track SLAs in Ha Tang Support. - [AI assistant](https://hatang.dev/docs/guides/support/ai-assistant.md): Set up the Ha Tang AI assistant to answer customers from your knowledge base, suggest replies to agents and hand off to people. - [Knowledge API](https://hatang.dev/docs/guides/support/knowledge-api.md): Push your help center, CMS or product docs into the AI assistant's knowledge under your own ids, keep it in sync on every deploy, and search it. - [Zalo ZNS](https://hatang.dev/docs/guides/support/zns.md): Send approved Zalo ZNS template messages, such as order confirmations and payment reminders, to customers' phone numbers through your Zalo Official Account. - [Realtime](https://hatang.dev/docs/guides/support/realtime.md): How the widget, the mobile SDKs and the agent apps talk to the chat gateway, and which interface to use for your own client or integration. - [Support REST API](https://hatang.dev/docs/guides/support/rest-api.md): Read conversations, reply as your team, update status and tags, and react to inbox webhooks from your own server. ## SDKs - [Ha Tang SDKs: live chat, email and payments](https://hatang.dev/docs/guides/sdks/overview.md): The Ha Tang SDKs for websites, mobile apps and servers, what each one does and which versions are supported. - [Node.js SDK for email, chat and payments](https://hatang.dev/docs/guides/sdks/node.md): Install @hatang/sdk and call every part of the Ha Tang API from Node.js, Bun or an edge runtime, with typed results and webhook and IPN verification. - [Python SDK for the Ha Tang API](https://hatang.dev/docs/guides/sdks/python.md): Install hatang from PyPI and call the Ha Tang API from Python (Django, FastAPI, Flask, workers), sync or asyncio, with typed request bodies and webhook, IPN and identity helpers. - [MCP server for AI coding agents](https://hatang.dev/docs/guides/sdks/mcp.md): Connect Claude Code, Cursor, VS Code or Windsurf to Ha Tang with @hatang/mcp, so your agent reads the current docs and can send email, create VietQR payments and work the support inbox. - [Live chat widget for React and Next.js](https://hatang.dev/docs/guides/sdks/react.md): Load the Ha Tang chat widget in a React or Next.js app with one component, and drive it from your code with a typed hook. - [Flutter live chat SDK](https://hatang.dev/docs/guides/sdks/flutter.md): Add Ha Tang support chat to a Flutter app with hatang_chat, a native chat screen with push notifications, deep links and in-app purchase hooks. - [React Native live chat SDK](https://hatang.dev/docs/guides/sdks/react-native.md): Add Ha Tang support chat to a React Native or Expo app with @hatang/chat-react-native, with no native code of its own. - [iOS live chat SDK (Swift)](https://hatang.dev/docs/guides/sdks/ios.md): Add native Ha Tang support chat to an iOS app with the HatangChat Swift package, from installation to push notifications, deep links and theming. - [Android live chat SDK (Kotlin)](https://hatang.dev/docs/guides/sdks/android.md): Add native Ha Tang support chat to an Android app with dev.hatang:chat, from installation to push notifications, deep links and theming. - [Push notifications](https://hatang.dev/docs/guides/sdks/push-notifications.md): Send support replies to your customers' phones as push notifications through your own Firebase project, and understand when Ha Tang sends one. - [Compatibility](https://hatang.dev/docs/guides/sdks/compatibility.md): Which SDK versions are supported, the chat protocol version each one speaks, the minimum gateway, and how Ha Tang versions its SDKs. ## Payments - [Overview](https://hatang.dev/docs/guides/payments/overview.md): Take VietQR bank transfers straight into your own bank account, match them to orders automatically and issue e-invoices. - [Quickstart](https://hatang.dev/docs/guides/payments/quickstart.md): Take your first VietQR payment in the development environment, with no real bank account. - [Environments and sandbox](https://hatang.dev/docs/guides/payments/environments.md): How the development and production environments of Ha Tang Payments differ, how to pick one per request, and how to simulate transfers. - [JavaScript SDK](https://hatang.dev/docs/guides/payments/sdk-javascript.md): Create payments, confirm them, and verify IPN calls and webhooks with @hatang/sdk. - [Bank connections](https://hatang.dev/docs/guides/payments/bank-connections.md): Link the bank account your customers pay into, configure how transfers are matched, unlink it, and recover missed transfers from a statement. - [Receive transfers without orders](https://hatang.dev/docs/guides/payments/transactions.md): Get told about every transfer into your account, with your own order code found in the description, without creating a payment per order. - [Create a payment](https://hatang.dev/docs/guides/payments/create-payment.md): Create a payment for an order, let the payer pay by VietQR, and follow it through every status. - [E-invoices](https://hatang.dev/docs/guides/payments/einvoices.md): Issue e-invoices (hóa đơn điện tử) through your own Mắt Bão account, automatically when an order is paid or on demand, and reconcile money in against invoices. - [How the payer pays](https://hatang.dev/docs/guides/payments/buyer-flow.md): The ways a payer can pay a Ha Tang payment (VietQR, the hosted checkout page, a manual transfer) and how to build your own payment page. - [Receive payment results](https://hatang.dev/docs/guides/payments/payment-results.md): How your server learns that a payment changed, through IPN calls, webhooks or polling, and how to handle them safely. - [Verify IPN signatures](https://hatang.dev/docs/guides/payments/verify-ipn.md): Check the HMAC-SHA256 signature of every IPN call before you trust it, with examples in Node.js, Python, PHP and C#. - [Webhooks](https://hatang.dev/docs/guides/payments/webhooks.md): Receive every payment, transaction, bank account and e-invoice event of your business, verify the Svix signature, and handle retries. - [Go live](https://hatang.dev/docs/guides/payments/go-live.md): Move a Ha Tang Payments integration from development to production, test it with real money, and keep it healthy once it is live. ## Recipes - [Send transactional email from Node.js and Next.js](https://hatang.dev/docs/guides/recipes/send-email-nodejs.md): Send order confirmations, password resets and receipts from Node.js, Next.js or Bun with @hatang/sdk, from your own verified domain, with idempotent retries. - [Accept VietQR bank transfers in your app](https://hatang.dev/docs/guides/recipes/vietqr-payments.md): Take payments by bank transfer with a VietQR code in Node.js or Next.js: create the payment, send the buyer to checkout, verify the signed IPN, and confirm before you fulfil the order. - [Send Zalo ZNS messages from your backend](https://hatang.dev/docs/guides/recipes/zalo-zns.md): Send approved Zalo ZNS template messages (order confirmations, payment reminders, delivery updates) to Vietnamese phone numbers from Node.js or any language through the Ha Tang API. - [Add live chat to a Next.js or React site](https://hatang.dev/docs/guides/recipes/live-chat-nextjs.md): Put a live chat widget on a Next.js, React or plain HTML site in a few lines, identify signed-in users, and answer from one inbox shared with Zalo, Messenger, Instagram and email. - [Issue Vietnamese e-invoices (hóa đơn điện tử) through an API](https://hatang.dev/docs/guides/recipes/einvoice-api.md): Issue Vietnamese e-invoices under your own tax code from code, automatically when a VietQR payment is paid or on their own, through your own e-invoice provider account. ## Integrations - [WordPress](https://hatang.dev/docs/guides/integrations/wordpress.md): Add the Ha Tang chat widget to a WordPress site with the Ha Tang Chat plugin, choose its position and language, and identify logged-in users. ## Reference - [REST API endpoints](https://hatang.dev/docs/reference/api.md): OpenAPI 3.1 spec https://hatang.dev/docs/openapi.json - [Chat gateway endpoints](https://hatang.dev/docs/reference/chat-gateway.md): OpenAPI 3.1 spec https://hatang.dev/docs/chat-gateway-openapi.json - [References](https://hatang.dev/docs/reference/overview.md): Every Ha Tang API, event, protocol, error and limit, generated from the source. - [Webhook events](https://hatang.dev/docs/reference/webhooks.md): Every event Ha Tang can send to your webhook endpoints, with a link to its payload. - [Errors](https://hatang.dev/docs/reference/errors.md): Every error code of the API, the realtime protocol and the SMTP relay, with what to do. - [Limits](https://hatang.dev/docs/reference/limits.md): Rate limits and size limits of the Ha Tang APIs. - [Realtime protocol](https://hatang.dev/docs/reference/realtime-protocol.md): The WebSocket and HTTP protocol (v1) that the chat widget and the mobile SDKs speak with the Ha Tang chat gateway, for anyone writing their own client. ## Optional - [Changelog](https://hatang.dev/docs/changelog): https://hatang.dev/docs/changelog/rss.xml - [Ha Tang for AI coding agents](https://hatang.dev/docs/changelog/2026/11/03/ai-coding-agents.md) - [SDK listings on npm, pub.dev, PyPI, Maven Central and wordpress.org](https://hatang.dev/docs/changelog/2026/11/03/sdk-listings.md) - [Email groups](https://hatang.dev/docs/changelog/2026/11/02/email-groups.md) - [Support email without forwarding](https://hatang.dev/docs/changelog/2026/11/02/support-email-receiving.md) - [Email API enforces API key scopes](https://hatang.dev/docs/changelog/2026/10/24/email-scopes.md) - [Help center at hatang.dev/help](https://hatang.dev/docs/changelog/2026/10/24/help-center.md) - [@hatang/sdk 0.4.0: production by default, templates, global contacts, automations](https://hatang.dev/docs/changelog/2026/10/24/node-sdk-0-4-0.md) - [WhatsApp, Telegram, X and LINE channels](https://hatang.dev/docs/changelog/2026/10/24/whatsapp-telegram-x-line.md) - [The developer hub moves to hatang.dev/docs](https://hatang.dev/docs/changelog/2026/10/23/developer-hub.md) - [API: webhook payloads in the OpenAPI spec](https://hatang.dev/docs/changelog/2026/10/23/openapi-webhooks.md) - [llms-full.txt](https://hatang.dev/docs/llms-full.txt)