Ha Tang SDKs
Ha Tang's SDKs put the support chat inside your website and apps, and connect your servers to the Ha Tang API. Every chat client speaks the same realtime protocol with the gateway at chat.hatang.dev, so a customer who writes from your website, your mobile app, Zalo, Messenger, Instagram or TikTok Shop lands in the same inbox.
The SDKs
| Platform | Package | Status | Guide |
|---|---|---|---|
| Website (script tag) | https://chat.hatang.dev/widget.js | Stable | Web widget and JS API |
| React / Next.js | @hatang/chat-react | Stable | React and Next.js |
| WordPress | Ha Tang Chat | Stable | WordPress plugin |
| Flutter (iOS, Android, web, desktop) | hatang_chat | Stable | Flutter |
| React Native / Expo | @hatang/chat-react-native | Stable | React Native |
| iOS (Swift) | HatangChat | Stable | iOS |
| Android (Kotlin) | dev.hatang:chat | Stable | Android |
| Node.js (server) | @hatang/sdk | Stable | Node.js SDK |
| Python (server) | hatang | Stable | Python SDK |
| AI coding agents (MCP) | @hatang/mcp | New | MCP server |
How they fit together
On the web, the widget is the core. @hatang/chat-react loads the widget in a React app and the WordPress plugin loads it in a WordPress site. Both drive the same $hatang JavaScript API, and the widget follows the settings you make in the dashboard.
In mobile apps, the SDKs are native. The Flutter, React Native, iOS and Android SDKs do not embed a web view. Each one speaks the protocol to the gateway itself and ships its own chat screen, conversation list, launcher button, push notification helpers and deep links. They share one contract: the same page structure in these docs, the same events, and the same conformance scenarios (C01–C12) that every SDK must pass against a real gateway before a release. An app identifies itself with an app key (hak_...) instead of the browser's Origin.
On your server, use @hatang/sdk (Node.js) or hatang (Python). They call the REST API with an API key: send email, read and answer conversations as an agent, put plans and purchases on customers, sync customers, orders and the assistant's knowledge, create payments and verify webhooks. For PHP, Go or any other language, call the REST API directly.
Topics shared by every chat SDK
- Identity verification:
identifywith and without a signature, the identity secret, and how the inbox merges sessions. - Push notifications: upload a Firebase service account, when Ha Tang sends a push, and the payload.
- Realtime protocol: the WebSocket frames,
seqandresume, close codes, and downloadable JSON Schema. - Compatibility: SDK, protocol and minimum gateway versions, and the versioning policy.
Support matrix
| SDK | Status | Current | Supported | Protocol | Platforms |
|---|---|---|---|---|---|
| widget.js | Stable | — | always current (served by the gateway) | 1 | Browsers with ES2020 (Chrome 80+, Safari 14+, Firefox 78+, Edge 80+) |
| @hatang/chat-react | Stable | 0.1.2 | 0.1.x | 1 | React 18+; Next.js 14+ (App Router and Pages) |
| @hatang/sdk | Stable | 0.6.2 | 0.6.x | 1 | Node 20+; Bun 1.1+; Edge runtimes with fetch (User-Agent reports node/unknown) |
| hatang (Python) | Stable | 0.1.1 | 0.1.x | 1 | Python 3.9+ (sync and asyncio, httpx) |
| hatang_chat (Flutter) | Stable | 0.6.1 | 0.6.x | 1 | Flutter 3.32+; Dart 3.8+; iOS 15+; Android 6.0 (API 23)+; macOS 11+; Web; Windows 10+; Linux (secure storage falls back to preferences) |
| @hatang/chat-react-native | Stable | 0.4.2 | 0.4.x | 1 | React Native 0.76+; Expo SDK 52+ |
| iOS (Swift) | Stable | 0.4.1 | 0.4.x | 1 | iOS 17+; Swift 6 / Xcode 16+; SwiftUI and UIKit (HatangChatViewController) |
| Android (Kotlin) | Stable | 0.4.1 | 0.4.x | 1 | Android 8+ (API 26); Kotlin 1.9+ / 2.x; Jetpack Compose (BOM 2024.12+); View-based apps open the chat through HatangChat.open |
| WordPress plugin | Stable | 0.2.3 | 0.2.x | 1 | WordPress 6.0+; PHP 7.4+ |
The full table, with packages and minimum gateway versions, is on Compatibility.
API references
- Ha Tang REST API (email, inbox, payments): API reference.
- Chat gateway (the widget and SDK endpoints, with OpenAPI): Chat gateway reference. The machine-readable protocol is at chat.hatang.dev/protocol.json.
@hatang/sdk: TypeDoc reference.@hatang/chat-react: README on npm.hatang_chat(Flutter): dartdoc reference.HatangChatandHatangChatCore(iOS): DocC reference.dev.hatang:chatanddev.hatang:chat-core(Android): Dokka reference.
The SDK references are generated from the doc comments in each SDK's source and are in English.
Next steps
- Add chat to a website: Web widget and JS API or React and Next.js.
- Add chat to a mobile app: Flutter, React Native, iOS or Android.
- Call the API from your server: Node.js SDK.