SDK reference
Vatio.chat starts or resumes a conversation and waits for a subscription before resolving. The SDK handles reconnects, history resync, and polling fallback. Messages include id, role, and content. Deduplicate history and event delivery by id.
| Method | Purpose |
|---|---|
Vatio.config({ workspace, token }) | Fetch public agent and widget configuration |
Vatio.chat(options) | Start, resume, or reopen a conversation |
Vatio.conversations({ workspace, token, ... }) | List this browser visitor's conversations, newest first |
Vatio.resumable({ workspace, ... }) | Check for a locally stored, unexpired conversation |
Vatio.reset({ workspace, ... }) | Forget the locally stored conversation; does not delete server history |
chat.send(text) | Send a message |
chat.history({ limit }) | Fetch messages |
chat.on(event, handler) | Subscribe to message, typing, status, or error |
chat.close() | Disconnect the client |
Options
Vatio.chat accepts workspace and token, plus optional baseUrl, fresh, scope, visitorToken, replyStyle, and conversation. fresh: true starts a new chat. conversation reopens an entry returned by Vatio.conversations.
Use a distinct scope when preview and live UIs share an origin. Pass the same scope and visitorToken to chat, conversations, resumable, and reset. Storage is separated by the complete visitor token, so issuing a new token also changes its local conversation scope. It does not merge contacts across devices.
Storage
The SDK stores the current conversation per tab and a visitor reference in local storage. Chat credentials last 12 hours. Treat visitor references and chat credentials as private: the reference can retrieve that visitor's conversation list and fresh chat credentials, so store the reference where the signed-in user cannot read another's, and never derive it from a public or predictable user ID. Issue a new reference when the signed-in user changes.
