Intent Matching

Intent matching lets KiBee understand what a user wants in plain language and automatically select the best flow to run — no hard-coded triggers required.

How it works

When you call kibee.ask(query), KiBee:

  1. Sends the query and the current page's visible targets to the API
  2. Scores every flow for the current page against the query using phrase matching and page-context signals
  3. Returns the best match with a confidence score between 0 and 1
  4. The SDK can then run the matched flow automatically

Matching signals

SignalWeightDescription
Phrase matchHighExact or fuzzy match against a flow's phrases array.
Goal similarityMediumSemantic similarity between the query and the flow's goal text.
Visible targetsMediumTarget labels visible in the viewport increase the score for flows referencing those targets.
Page scopeBoostFlows matching the current pageId are prioritised over flows from other pages.

Using intent matching

TypeScript
const match = await kibee.ask("how do I invite someone?");

if (match.flowId) {
  kibee.speak(match.message); // e.g. "I'll guide the invite team flow."
  await kibee.runInteractiveFlow(match.flowId);
} else {
  kibee.speak("I'm not sure how to help with that yet.");
}

IntentMatch response

FieldTypeDescription
flowIdstring | nullThe matched flow ID, or null if no match was confident enough.
confidencenumberScore from 0 to 1. Scores above ~0.5 are considered a match.
messagestringHuman-readable explanation of the match, suitable to show in the bee's speech bubble.

Improving match quality

  • Add phrases — include all natural-language variations a user might type: “invite team”, “add a user”, “send an invite”.
  • Write a clear goal — the goal is used for semantic similarity. Write it as a complete sentence describing the outcome.
  • Use descriptive target labels — “Send invite button” is a stronger matching signal than “button-2”.
  • Scope flows to the right pageId — page-scoped flows are prioritised. If a flow only makes sense on the settings page, give it the settings page ID.
No AI costs by default. The base engine uses phrase scoring and page-context signals with no external LLM calls. Optional embedding-based semantic matching is available for deeper natural-language understanding.