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:
- Sends the query and the current page's visible targets to the API
- Scores every flow for the current page against the query using phrase matching and page-context signals
- Returns the best match with a confidence score between 0 and 1
- The SDK can then run the matched flow automatically
Matching signals
| Signal | Weight | Description |
|---|---|---|
| Phrase match | High | Exact or fuzzy match against a flow's phrases array. |
| Goal similarity | Medium | Semantic similarity between the query and the flow's goal text. |
| Visible targets | Medium | Target labels visible in the viewport increase the score for flows referencing those targets. |
| Page scope | Boost | Flows 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
| Field | Type | Description |
|---|---|---|
flowId | string | null | The matched flow ID, or null if no match was confident enough. |
confidence | number | Score from 0 to 1. Scores above ~0.5 are considered a match. |
message | string | Human-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.