Feature referenceDeveloper integration · 02 of 06

Developer integration

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.

Availability
All plans
Configured in
Website code → https://api.stand.chat/v1/ and the session WebSocket returned by the API
Category
Developer integration
Reference status
Beta
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 beta 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 beta contract.

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.

02

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.
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.
03

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, exclude it from logs and analytics, and clear saved credentials when the conversation ends or authorization fails.
  • 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 dashboard. 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.
04

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. Carry returned attribution IDs into session creation so analytics reflect that interface.
05

Availability and beta 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.
  • 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.