Skip to main content

Outcome: a visitor sends a message, receives a reply, and continues the same conversation.

Prerequisites: the widget repository, Node.js 20.20.0, and a browser. Real AI replies also require a server-side provider key.

This guide covers response-chat-widget and its self-hosted backend. For the hosted ResponseCX Widget Builder and browser Chat Desk, follow Widget to desk. The standalone server also has its own native operator console.
Reviewed on October 20, 2026 against the 1.2.13 workspace at 1cacaaa, including local session, recovery and live-chat changes. Confirm your deployed image and browser assets include these changes before enabling them; the package version alone does not establish that.

1. Run a local conversation

From the widget repository:
Open http://localhost:3000. The mock server exercises UI and streaming without provider keys. For a local visitor-to-operator conversation, stop it and run npm run tui:demo; open the loopback URL printed by the console. The playground uses synthetic replies and memory storage. To test actual model replies instead:
AI_PROVIDER selects openai (default), anthropic, or gemini; keep its matching API key on the server. Both dev servers default to port 3000, so run one at a time. After a local build, npm run embed:reset restores the source loader before committing it; deploy the complete built artifact as described in deployment.

2. Install one matching build

Host the built public/ assets together, including vendor/, lazy chunks, the manifest and licenses. Replace this example URL with your own asset deployment:
The loader supplies React, ReactDOM, styles and the bundle, then creates a mount container. Use absolute API URLs when the website and API are on different origins. Without them, /api/chat points to the website’s origin. A loader and its asset base must come from the same build so the embedded hashes and integrity values match. If you manage settings through the widget Admin API, add data-rw-settings-endpoint="https://chat.example.com/api/widget/settings?siteId=YOUR_SITE_ID". Publish the site’s draft before checking the live widget. Inline props override remote settings.

3. Supply and renew widget identity

For a deployment with the opt-in session issuer configured, add:
The loader fetches a public deployment token before mounting, enables 1500 ms thread polling unless configured already, and renews the token without clearing the draft or conversation. Initial issuance failure prevents mounting. Install one of these snippets, once per page. On the server, enable WIDGET_SESSION_ENABLED=true and WIDGET_LIVE_CHAT_ENABLED=true; set STATESET_WIDGET_AUTH_SECRET to a random secret of at least 32 characters, bind STATESET_ORG_ID and STATESET_AGENT_ID, and set WIDGET_SESSION_ALLOWED_ORIGINS to the exact website origins. Include those origins in ALLOWED_ORIGINS too. TTL must be 60–900 seconds (STATESET_WIDGET_AUTH_TTL_SEC, default 900). An optional STATESET_WIDGET_SITE_ID UUID adds a signed site claim. This public token identifies a deployment. It does not authenticate a shopper. Conversation access uses a separate threadToken; operator credentials stay out of browser code. See authentication and recovery.

4. Verify continuity and replies

  1. Send a unique test message and wait for the full reply.
  2. Send a follow-up; confirm both messages belong to the same threadId.
  3. Check that new-thread JSON includes threadToken, or streaming begins with a thread event. Later chat/history requests should carry x-widget-thread-token.
  4. If native live chat is enabled, claim that conversation in the terminal, send another visitor message, and confirm it receives a human acknowledgement instead of an AI answer. Send an operator reply and confirm the visitor receives it through polling.
  5. Reload once and check the configured retention behavior. Test Forget this conversation on this device separately from server-side deletion.

Verified outcome: the same authorized conversation survives a follow-up, and the actual deployed browser/API pair handles its configured reply mode.

Direct mounting and custom backends

If your application already loads React and the UMD bundle, use window.ChatWidget.mount() and dispose of it when the host component unmounts:
Direct mounts must fetch and renew tokens themselves. Control methods also include open(), close(), toggle(), createThread(), fetchThread(), updateThread(), and deleteThread(); wait for mounting before calling asynchronous conversation methods. A custom backend can implement chat JSON/SSE and optional thread CRUD. buildMessagePayload, parseResponse and the thread request/URL hooks adapt a different contract. Default history reads use GET /api/threads/{id} with an optional channel query. A custom buildThreadRequest must supply any required authentication and conversation capability itself.

Next steps

Widget configuration

Settings, commerce and integration choices.

Native human support

Operator inbox, claims, replies and private notes.

Deployment

Asset integrity, shared storage and release qualification.

Backend reference

Source-reviewed routes, credentials and event shapes.
Last modified on November 13, 2026