Overview

The Vocantly Widget (@vocantly/widget) is a drop-in support chat bubble built on top of the headless SDK. One <script> renders a floating launcher + chat panel; your visitors talk to the AI bot (and human agents) with zero UI work on your side. Everything — the SDK, its dependencies, and the UI — is bundled into a single self-contained file.
The SDK (@vocantly/sdk) is headless — logic only, no UI. Use it directly if you want to build your own chat interface. Use the widget when you want a ready-made bubble.

Install

The security model

The widget runs in the browser, so it only ever holds an SDK token (scoped to one app + one visitor, short-lived). Your API secret never touches the browser.
There are two ways to get the visitor a session — pick based on whether you have a backend. Your server mints a session with your API key + secret and hands only { token, conversation_id } to the page. Best when you already know who the visitor is (logged-in users).
1

Server mints a session

2

Frontend boots the widget

Option 2 — Anonymous, no backend (public key)

For a static landing page with unauthenticated visitors and no server, embed with your app’s public key. The widget self-provisions an anonymous session — no secret in the browser.
Allow your site’s origin first. Anonymous embedding is off by default. Add your domain(s) to the app’s allowed_origins (dashboard, or PATCH /apps/:id { "allowed_origins": ["https://acme.com"] }). Requests are origin-checked server-side and rate-limited.
The widget generates a stable visitor id (localStorage) and caches {token, conversationId}, so a reload resumes the same conversation and maps to the same customer.

Options

Controlling the widget

Pre-chat contact capture

With collectContact: true, the widget asks the visitor for their name + (optional) email before chatting and saves it to their customer profile via PATCH /sdk/customers/me (authenticated by the SDK token — no secrets). Agents then see the visitor’s contact details in the inbox.

What happens when a visitor sends a message

Bot replies are delivered live and persisted, so they appear in history and the agent inbox. See SDK Support Sessions for the underlying session API and provisioning endpoints.