I built an AI intent router workflow that classifies incoming messages and routes them to different handlers based on the detected intent.
What it does
A single webhook receives any message. An AI classifier (gpt-4o-mini via OpenRouter) determines the intent — support, sales, billing, feedback, or general — and routes it to the appropriate handler.
Architecture
- Webhook Trigger — receives POST with
{"message": "your text here"} - Code Node — builds the classification prompt
- HTTP Request — calls OpenRouter/OpenAI for intent classification
- Code Node — parses the AI response into structured JSON
- Respond to Webhook — returns the classified intent with confidence score
Why this approach?
- HTTP Request > langchain nodes for the classifier. More reliable, easier to debug, and you can use any OpenAI-compatible API.
- gpt-4o-mini is plenty for classification — fast and cheap (~$0.15/1M tokens).
- JSON output parsing with fallback — if the AI returns bad JSON, it falls back to keyword matching.
Example response
{
"status": "routed",
"intent": "BILLING",
"confidence": 0.9,
"summary": "Payment failure and refund request.",
"handler": "billing_team",
"originalMessage": "My payment failed and I need a refund"
}
Tested with 5 different message types — all classified correctly.
The workflow JSON is available free at turtletools.app. Happy to answer questions about the implementation!