Skip to main content

AI Chat Widget Overview

The AI Chat Widget is a floating support bubble that appears on your customer's pages. When an end-user clicks it and asks a "how do I…" question, the bot picks the best existing Flow or Tooltip from your library and walks the user through it. If no existing content fits, the bot generates a brand-new Flow on the fly and walks the user through that.

Prerequisites

  • The tenant must be on the Pro or Enterprise plan.
  • The Site must have completed mapping (Settings → Sites → Enable AI Creation). The chat widget can't be created or published on a site whose mappingStatus is anything other than COMPLETED.

How it works

  1. End-user asks a question in the chat drawer.
  2. Matcher — the bot ranks every PUBLISHED Flow + Tooltip for the site and picks the single best match. If the question contains an existing item's name verbatim, that match is selected without an LLM call. Otherwise an LLM call ranks the candidates and either returns a winner or returns null.
  3. Reuse vs. generate — if a match is found, the chat emits a MATCHED_CONTENT message, navigates the user to the target page if needed, and starts the existing experience. If no match, the bot generates a new Flow using the same grounded pipeline the dashboard's AI generator uses (compressed app map + system prompt + target validation) and publishes it under the "No users" audience.
  4. SDK triggers — the new content is rendered to the asking user via imperative flowRunner.startFlow(id) or contentManager.showContent(id) calls. Audience evaluation is bypassed for the asking user only.

What gets stored

  • ChatSession rows for every (chatWidgetId, endUserId) pair.
  • ChatMessage rows for every turn — user message, status updates (ANALYZING, MATCHED_CONTENT, GENERATED_CONTENT, NAVIGATING, COMPLETED), and any errors. Each message has its own tokensUsed + model for cost accounting.
  • ChatFeedback rows when the end-user votes up or down on an answer.
  • SupportTicket rows when the end-user downvotes and opens a ticket.
  • Flow / Tooltip rows for any AI-generated content (with source: "AI" and audience = "No users" so they never auto-show to other users).

Visibility note: "No users" audience

AI-generated content is published under the "No users" audience preset. This means:

  • It will never auto-show to any end-user via normal targeting rules.
  • It can be triggered imperatively by the chat (for the asking user only) or replayed manually from the chat panel's "↻ Restart walkthrough" pill.
  • It appears in the library with the AI source badge and you can re-target it manually if you want it to auto-show.

Credit usage

Every chat turn consumes AI credits. Two LLM calls happen per turn at most:

  • A matcher call (small, ~500–800 tokens).
  • A generator call (large, several thousand tokens) — only when the matcher returns null.

The fast-path skips the matcher call entirely when the question contains an existing item's name. If the tenant has insufficient credits, the bot emits an INSUFFICIENT_CREDITS message and the owner gets a debounced email notification.