Feature referenceWebsite customization · 02 of 07

Website customization

Custom chat UI

Custom chat UIs let a website render its own visitor conversation interface, including interfaces built with an AI coding agent, while Stand provides routing, AI replies, human chat, and conversation history through the visitor HTTP and WebSocket APIs. Stand’s guide includes a live inline React client.

Availability
All plans
Configured in
Website code → https://api.stand.chat/v1/ and the session WebSocket returned by the API
Category
Website customization
Reference status
Current

Before you begin

Plan availability: All plans. Normal chat quotas and feature entitlements apply.

Prerequisite: An enabled Site registered in Stand, a page on its matching domain, eligible human or Stand-in coverage, available chat capacity, and a browser client that implements the documented visitor protocol.

Key boundary: The customer owns the interface and its protocol handling. The visitor API exposes visitor conversations, not Stand app administration or a server-side management API. Visitor messages are text-only.

01

What a custom chat UI changes

The customer supplies the launcher, layout, transcript, composer, and interaction design. A custom interface can be a page section, application panel, or character-based chat experience. It connects to the same visitor APIs used by stand.js and ui.js; loading those scripts is not required when the customer implements the conversation client.

Stand still selects an eligible responder, creates the conversation, delivers messages, runs configured Stand-in skills, supports rep takeover, and makes the conversation available in Chats and History. Site and path routing, availability, organization quotas, and plan entitlements continue to apply.

This is a supported integration surface for developers and AI coding agents. The guide documents the current endpoint and event contracts, implementation requirements, and a release checklist. Custom clients must track updates to that contract.

For a conventional inline transcript with a customized appearance, use stand-chatbox instead of implementing a visitor client. It shares the supplied widget’s rendering and lifecycle, with CSS variables, shadow parts, slots, and capped or growing height. A fully custom client remains useful for canvas scenes, games, character interfaces, or a different interaction model.

02

Stand’s custom chat examples

The pink cow example demonstrates a custom chat card that unfolds from an animated cow. It remains available in the example reel and on its standalone example page.

The recordings show both custom conversation interfaces and page controls that open Stand’s supplied widget. Each example links to its live page and public-domain source.

Chapter 12 includes a live inline React client connected to Stand’s website coverage, with its actual client and component source available to copy or download. It starts a real conversation on the first send and restores it when returning to the chapter after in-page navigation. The standard floating widget is hidden on this chapter and returns on navigation away with its separate conversation preserved.

The Chapter 12 client reports an activation on its first valid submission. Discovery, prewarming, mounting, restoration, and reopening an existing conversation do not add activations.

    03

    Visitor API lifecycle

    StageContract
    DiscoverGET /v1/reps/find with the Site ID and current page URL returns availability, the selected rep or Stand-in, identity, greeting, presentation settings, and attribution. A valid domain-matched lookup also records installation.
    ActivateReport a real open before creation through POST /v1/events/activate, or the first valid submission for an always-visible inline composer. Reuse one activation ID for bounded event retries and carry the latest activation into creation. This telemetry never blocks the conversation.
    CreatePOST /v1/sessions starts a conversation using the current Site, page, and selected responder. It returns the persisted initial messages, participants, a session-scoped visitor token, and WebSocket URL.
    Exchange messagesConnect to the returned session WebSocket with the visitor token. Send text messages and reconcile their canonical responses. POST /v1/sessions/{sessionId}/messages provides the authenticated HTTP fallback.
    RecoverGET /v1/sessions/{sessionId} with the visitor token returns current session state and recent messages for restoration or reconnect. The client merges canonical messages and discards obsolete transient indicators.
    EndDELETE /v1/sessions/{sessionId} closes the conversation. A closed, expired, or inaccessible session requires an ended or unavailable state and a separate new-chat flow.
    04

    Authentication and page context

    • Discovery and visitor session creation use the public Site ID. Subsequent HTTP calls use Authorization: Bearer <visitorToken>; the session WebSocket uses the token query parameter.
    • A visitor token grants access only to its conversation. Keep it private and exclude it from logs and analytics. On closure, stop sends and reconnects, finish any permitted final reconciliation while still authorized, then clear saved credentials. On authorization failure, discard the unusable token and retain unconfirmed visitor text for an explicit new-chat flow.
    • No developer API key, rep login, Keycloak token, or OpenAPI integration credential belongs in the browser client.
    • visitorExternalId and visitorIdentityName provide the same unverified page-known identity as the widget identification API. They do not authenticate the visitor or authorize customer backend actions.
    • Optional prompt context is retained for the responder and the Stand app. A custom client must exclude system-prompt messages from the visitor transcript; hiding them is a display rule, so browser-supplied context must not contain secrets.
    05

    Required conversation behavior

    • Show the matched responder’s identity and distinguish an AI Stand-in from a human. Update that identity when handoff or takeover cards arrive.
    • Render the returned sensitive-data notice when configured and the Powered by Stand link when poweredByUrl is present. A custom interface does not change branding entitlements.
    • Handle text, link cards, and system cards, including session start/end, human transfer, Stand-in takeover, and the recovery email follow-up flow. Preserve visitor choice in handoff and action-confirmation conversations.
    • Treat AI streaming deltas and typing/status events as temporary display state. Reconcile final messages using server message IDs, sequence numbers, and client message IDs rather than appending duplicate replies.
    • Provide loading, unavailable, sending, failed-send, reconnecting, and ended states. Restore the same authorized conversation across navigation when continuity is offered; do not create a new session just because the socket disconnects.
    • Render untrusted text and links safely, support keyboard and mobile use, and keep controls consistent with the conversation language.
    • Send greeting, activation, link-click, and branding-click events only for interactions the custom interface actually presents. Custom clients must report their own activation events for those opens to appear in Stand statistics; session creation does not infer them. Reuse the activation ID on bounded retries within 24 hours, and carry the latest ID and source into creation.
    06

    Availability and boundaries

    • A successful availability lookup is not a reservation. The server revalidates the Site, responder, and capacity when a conversation starts; handle creation failure without inventing a local conversation.
    • Custom appearance does not grant extra chats, remove Base branding, enable paid skills, or bypass disabled Sites or unavailable responders.
    • Before registering, a client can send demo as siteId for discovery and session creation. Stand Chat’s demo Stand-in then answers from any page domain. Only that Stand-in responds, and the conversations are not visible in your account; your own responders, instructions, knowledge, skills, and History require your registered Site ID.
    • The current session read returns a bounded recent-message snapshot, not an unlimited transcript export. Reps use History for retained conversation review and export.
    • The visitor API does not support visitor file uploads or expose rep and organization management operations.
    • The shipped widget remains a reference implementation. A generated visual prototype requires protocol integration and verification before it can handle Stand conversations.