Skip to main content

Rust SDK: the hatang crate on crates.io

Ha Tang has an official Rust SDK. The hatang crate calls the API from axum, actix-web, workers and CLIs: plans and purchases on the customer's profile, the AI assistant's knowledge, conversations and customers, email, VietQR payments, and webhook and IPN verification. It has the same namespaces as the Python SDK.

cargo add hatang
cargo add hatang --features blocking # a synchronous client too
Releasehatang 0.1.1 (crates.io)
API referencedocs.rs/hatang
Rust1.89 or later
ClientsHatang (async, reqwest with rustls) and blocking::Hatang with the blocking feature
  • Bodies take the crate's typed structs (SendEmail, SubscriptionUpsert, PurchaseUpsert, KnowledgeDocument, ChatMessage, CreatePayment…) or any serde::Serialize value; responses are serde_json::Value.
  • hatang::Error gives the HTTP status (0 when Ha Tang was not reached), the API's error code and retryable() for unreachable, 429 and 5xx.
  • construct_webhook_event, construct_ipn_event, identity_hash and purchase_token give the same values as Ha Tang's servers and the other SDKs, and take an http::HeaderMap straight from axum.

See the Rust SDK guide.