Client integration contract: chat and drive
The agent side's handshake and named order-taking eligibility, the conversation list needing an explicit cross to full scope, heartbeat must not overwrite other devices, and the drive's long restricted-scope key.
This product has two kinds of "clients": the chat side used by customer-service agents (desktop and Android), and the drive file client. They connect to the same site, but their credential shapes, visible interfaces and failure contracts are completely different. This page is the integration essentials for both sides, written for people who will write clients.
The agent side starts with one handshake. GET /api/site/info gets the site self-description (version, capabilities, paths); login goes through a dedicated desktop login endpoint, returning a session token and account information, and logout has its own exit. Every call after that carries this token, and permission judgment happens server-side — the client decides whether to draw buttons from the permission set the server returns, not by guessing role names itself.
Order-taking eligibility is a named permission code, not "logged in means you can take". The built-in customer-service role only seeds the minimal set: can read conversations, can write conversations, plus the one cell "eligible to take orders". Message boards, assistant configuration and content writing are not in it. One code missing an administrator can add at any time; one code extra is only found by audit — so when writing a client, the "logged in but not eligible" branch must be handled; its manifestation is not taking orders, not a broken interface.
The conversation list excludes closed ones by default; this must be explicitly crossed. The server-side list is by design filtered of closed conversations, and for the "closed" tier the client must explicitly request the full filter set; passing an unrecognized filter value returns 400 directly. This was a gap first hit in real integration: without the client explicitly requesting it, that column is always empty and looks like a broken feature. Poll order-taking eligibility one by one with the single-conversation read endpoint; do not download the whole list every round.
Message reads and writes both have shapes. Pulling messages supports incremental after the last one; sending a reply carries a client message number for idempotency (a network retry must not produce a second agent message). Attachments on Android go through the two-step "upload first, then attach" flow; on desktop, the in-conversation atomic upload. Online status uses that heartbeat POST — the early implementation was "pull the list first, then PUT your own status", which would overwrite the status another device just changed. Multi-device concurrency also has one general rule: the list polled back must carry a change sequence number, and a late old response must not overwrite a write that just succeeded.
Real-time is an accelerator channel, not the main path. The client polls as the primary mode; WebSocket only brings forward the moment something should be seen; that channel checks same-origin sources, and its being alive does not mean the session is valid — the long connection's credentials must be re-checked against that one kernel criterion (logout, session revocation and account deactivation all kill it, while temporarily unable to read the store is not invalidation, otherwise one database blip would drop all agents).
The customer-service side has two read-only export outlets (conversations and messages, knowledge base CSV); they are strictly read-only and change no state.
The drive client is a completely different credential set. It reuses the site's 80/443 routing and opens no new listening ports; the unified interface prefix is /api/v1/drive-client, and the credential is a long key with restricted scope, used directly as a Bearer — V1 does not swap in short-lived tokens, avoiding two credential lifecycles. The key boundary: this key can only call the drive-client section's routes, cannot authenticate any backend, account, publish or configuration interface, and cannot touch that set of backend file-management addresses. Conversely, backend administration interfaces do not accept it either.
The credentials in the backend are "manageable", not a one-time configuration. The three entries are the drive files, the client configuration, and the plugin intro — that intro screen writes the actual interfaces and the integration contract, not marketing copy. Connections can be created, renamed, key-rotated, revoked; the list does not echo the key, and rotation is an irreversible action so it needs an explicit confirmation. After revoking a connection, its next call should be refused, rather than waiting for the token to expire.
The contracts common to both sides. Errors always carry a stable error code plus a human sentence; the client branches by code and displays by copy; length is judged by character count and the request body is capped by bytes — the two numbers differ; image derivation on the upload path is best-effort — when no processing slot is available or the pixel cap is exceeded it is skipped and the page falls back to the original image, and it never rolls a successful upload back into a failure to trade for a traffic-saving optimization.
One last boundary must be said: online update and public release download entry are outside this product's delivery scope; the client can read from the site self-description which server version it is connected to, but the "get the package" step is in the deployer's hands; the signed installer comes after feature acceptance.