WidgetApi
The visitor REST API (/widget/v1/sites/{siteId}/…) over OkHttp. Every call sends the app key and the user agent; token calls add x-visitor-token. Failures throw HatangException: gateway errors ({statusCode, name, message}) keep their name as HatangException.code and the HTTP status; transport failures are network_error. Open so tests can script it.
Constructors
Functions
First call: config, a visitor token (new or existing) and the current conversation.
Removes a push token. A gateway without the endpoint (404) returns false.
The visitor's conversations, newest activity first, resolved ones included.
Offline / pre-chat form.
Reports a finished store purchase: verified with the store when purchaseToken (Android) or signedTransaction (iOS) is given, plus an internal note for the team. A gateway without the endpoint (404) returns false.
Registers (or moves) a push token for this visitor. A gateway without the endpoint (404) returns false.
Forget this visitor; the old token stops working.
Swap a magic-link token for the visitor's session.
HTTP fallback for message.send.
Uploads a file (multipart field file); the returned id goes into message.send.attachments. onProgress is called from an OkHttp thread as the body goes out.