01What is intent recognition?
Intent recognition — also called intent classification or intent detection — is the part of a chatbot's natural language understanding (NLU) that decides what the customer is trying to do. Given "where's my parcel, it's been 6 days", it returns an intent such as track_order with a confidence score, say 0.93, and the bot routes the message to the handler for that task.
An intent set is the list of goals the bot supports, each defined by a name, a description and example phrases: track_order, cancel_order, refund_request, store_hours, talk_to_agent. Classic classifiers are trained on labelled phrases for each intent, often comparing messages as vectors (embeddings); large language models can classify with no training at all, from a prompt listing the intents and their descriptions, returning a label from a fixed list. Many production bots combine both: a fast classifier for the common intents and an LLM for the long tail.
Confidence is what makes recognition safe to act on. If the top intent clears a threshold and leads the runner-up clearly, the bot proceeds; otherwise it falls back — asks the customer to rephrase, offers a menu or hands off. Intent recognition captures the goal only. The details needed to complete it — which order, which date — come from entity extraction, and a single message can hold two intents ("cancel this and refund me") that the bot must handle one after the other.
Key takeaways
- Intent recognition maps a free-text message to one of a defined set of goals, such as
track_orderorrefund_request. - Every prediction carries a confidence score; below the threshold, the message goes to the fallback intent.
- Intents capture the goal; entity extraction captures the details — the order ID, the date, the city.
- Classic classifiers learn from labelled example phrases; LLMs can classify from intent descriptions alone.
- On WhatsApp, button and list replies carry IDs you defined, so only free text needs classifying.
02 · How it works, step by step
How does intent recognition work?
- Step 1
Define a small, distinct intent set
Start with the 10–20 goals that cover most of your traffic, plus
talk_to_agent. Merge intents that lead to the same action and split ones that need different handling. - Step 2
Collect real example phrases
Use masked messages from your inbox, including Hinglish, regional scripts, typos and voice-note transcripts. Variety beats volume; 20–50 varied phrases per intent is a common starting point for a trained classifier.
- Step 3
Classify with a score
A trained classifier or an LLM returns the top intents with a confidence each. With an LLM, ask for a label from a fixed list through structured output, never free text.
- Step 4
Route by threshold
Above the threshold with a clear margin, run the intent's handler; otherwise use the fallback intent. Treat
interactivebutton and list replies as already classified by their IDs. - Step 5
Measure and retrain
Track accuracy on a labelled test set, review low-confidence and fallback messages weekly, and add phrases or intents as customers' language shifts.
03Intent recognition in code
const INTENTS = {track_order: "Where an order or parcel is, or when it will arrive",cancel_order: "Cancel an order that has not been delivered",refund_request: "Money back for a returned, cancelled or failed order",store_hours: "Opening times or location of a store",talk_to_agent: "Wants a person, not the bot",};const schema = {type: "object",properties: {intent: { type: "string", enum: [...Object.keys(INTENTS), "none"] },confidence: { type: "number", minimum: 0, maximum: 1 },},required: ["intent", "confidence"],additionalProperties: false,};const system = ["Classify the customer's WhatsApp message into exactly one intent.",...Object.entries(INTENTS).map(([name, desc]) => "- " + name + ": " + desc),"- none: anything else","Messages may be in English, Hindi or Hinglish. Return JSON only.",].join("\n");export async function recognise(text, llm) {const { intent, confidence } = await llm.json({ system, user: text, schema });// Self-reported confidence is rough: calibrate this threshold on labelled messagesreturn intent !== "none" && confidence >= 0.6 ? intent : "fallback";}
A fixed label set and a schema keep the output routable; the threshold decides when to fall back.
04Why does intent recognition matter?
Intent recognition is a bot's switchboard: every wrong decision sends a customer down the wrong path, and every unrecognised message costs a fallback or an agent's time. Getting it right is what lets a bot contain routine volume — order status, timings, returns — while passing everything else to people quickly. It also gives operations a live map of demand: intent counts per day show what customers are asking about, often before any report does.
05Intent recognition: key facts and limits
- Output
- An intent label plus a confidence score from 0 to 1
- Common starting threshold
- Around 0.6, tuned on labelled data
- Training data
- Often 20–50 varied phrases per intent for a trained classifier
- Interactive replies
- Buttons and list rows return IDs — no classification needed
- Below the threshold
- Fallback intent: rephrase, menu or handoff
- Languages to cover in India
- English, Hindi, Hinglish in Latin script and regional scripts
06Example: Hinglish at a Bhubaneswar broadband provider
A Bhubaneswar broadband provider's WhatsApp bot receives about 6,000 messages a day (illustrative). Intent recognition sends "net nahi chal raha since morning" to outage_report (0.91), "bill zyada aaya" to billing_dispute (0.84) and "plan upgrade karna hai 200 mbps" to plan_change (0.95), each to its own handler: the outage handler checks the area-status API, while billing disputes go to the accounts team with the bill attached. "Hello??" scores 0.38 for everything and gets a menu instead of a guess. The weekly review of low-confidence messages turns up dozens of "wifi password" questions, so the team adds a router_help intent with its own guided answer, and the fallback rate drops the following week.
07 · Common mistakes, and the fix
Common mistakes with intent recognition
Overlapping intents
refund_statusandrefund_requesttrained on near-identical phrases confuse the classifier and the team. Merge them, or split only where the handlers really differ, and check the confusion matrix.Testing on clean English only
Real WhatsApp text is Hinglish, abbreviated and misspelt. Accuracy on tidy test sentences overstates live performance; test on masked real messages.
Trusting an LLM's stated confidence
A model asked for its confidence produces a number, not a calibrated probability. Calibrate the threshold on labelled messages, or use a classifier's probabilities for routing.
Classifying what is already structured
Running button and list replies through NLU adds latency and errors. Route
interactivereplies straight from their IDs.Ignoring messages with two intents
"Cancel the order and refund me" holds two goals. Handle the main one, keep the second in conversation state and pick it up next.
08 · Tips from the bench
Best practices for intent recognition
- Keep a
talk_to_agentintent that bypasses every fallback counter. - Log the intent, score and runner-up for each message; small margins reveal intents that need merging or clearer examples.
- Re-train or re-prompt monthly — launches and campaigns change how customers write.
- Run language detection first if different languages go to different models or agents.