Skip to main content

Widget Runtime

The widget runtime powers customer-facing live chat. It uses widget public keys plus route-level controls rather than broad table access. Widget routes are not /api/v1 REST API endpoints and do not accept woesk_ workspace API keys.

Install Snippet

Use the install snippet from Settings → Channels → Live chat or Settings → Keys.
The public key can be a workspace widget key or an agent widget key. Agent keys route the conversation to that agent’s attached context.

Loader Behavior

https://woes.dev/widget.js is a small host-page loader. It fetches customer-safe widget configuration, records the install origin for operator verification, and mounts the real Woes product widget inside an isolated iframe at /embed/widget. The iframe resizes between launcher, teaser, and open-panel footprints so the host page does not need to reserve a fixed container. The loader forwards window.Woes(...) commands into the iframe once it is ready, and the iframe queues early commands until the inner widget API is installed. Early identify calls made during widget boot are not dropped. The config route returns presentation fields only: colors, logo URLs, welcome copy, quick links, pre-chat question labels, position, radius, theme, identity-required state, enabled surveys, published updates settings, business-hours fields, and enabled state. It does not return workspace settings, secrets, operator data, or API key material.

JavaScript API

The widget exposes a queued window.Woes(command, payload) API. Calls made after the snippet is added are queued until the widget runtime is ready.

Customer Identity

For unsigned installs, send the customer details you already know.
Unsigned identify fields are display and routing metadata, not authentication. Any browser user can alter them. Use HMAC or JWT identity verification before showing account-specific history or trusting account/customer ids. In HMAC mode, only the normalized email is verified; name, company, and id remain display metadata. Use JWT when account/contact ids must be verified.
For verified installs, pass either an HMAC email proof or a JWT minted by your backend. Verified identity should be fetched from an authenticated, no-store backend endpoint and retried after login/session load, widget load, focus, and visibility changes. See Widget Identity for the full security model.

Pre-chat Questions

Pre-chat questions are configured in Settings → Channels → Live chat and delivered through the widget config route. The widget asks them before the first message in a new conversation and shows the pre-chat form as the main new-chat pane while those details are needed. Required questions are enforced by the public message route, so a custom script cannot bypass them. If the page identifies a visitor with window.Woes("identify", ...), configured name, email, and company questions can be auto-filled from that identity. Verified identity modes should be used before trusting those fields for account-specific routing.

Conversation Metadata

Use conversation fields to attach page, product, account, or plan context to the next new conversation.

Conversation Continuity

A widget public key only resolves the workspace or agent. Continuing or reading an existing widget conversation also requires the opaque conversationSecret returned when the conversation is created. Store the secret per widget key in the browser, do not send it to analytics or logs, and prefer the x-widget-conversation-secret header for history requests. Public key plus conversation id alone must not be treated as authorization.

Ticket Forms

Ticket form commands let you open a specific form and control the customer-facing form choices.

Public Widget Capabilities

  • Resolve workspace or agent by widget key.
  • Create or continue a conversation.
  • Store customer messages.
  • Return customer-safe message history.
  • Emit widget events such as launcher view and widget open.
  • Update customer presence for active visitors.
  • Submit CSAT or NPS survey responses.
  • Show published updates and track verified-reader read state.

Public Boundaries

Widget responses must not include:
  • Operator-only debug traces.
  • Provider or model internals.
  • Raw secrets.
  • Another workspace’s data.
  • Service-role information.

Common Widget Routes

The /api/widget/csat route name is kept for compatibility, but it can record typed survey responses when the survey is configured as CSAT or NPS.
Use Widget Routes for route-by-route request requirements and boundary details.
Last modified on July 3, 2026