This one felt different to build because the routing logic isn't based on dropdowns or keywords. The client types their situation in plain English and the AI figures out the case type.
The architecture:
Webhook → JavaScript (parse + structure) → IF validation → Edit Fields → JavaScript scoring → AI Agent (classification) → Google Sheets → Switch → Slack → AI Agent (email) → Gmail
The scoring engine:
Two variables only — urgency and referral source. Max 100 points.
Urgency: Immediate = 70, High = 45, Standard = 15
Referral: Friend/Family = 30, Google = 20, Social = 12, Advertisement = 8
Hot = 70+, Warm = 40-69, Cold = below 40
The AI classification prompt:
The system prompt defines 6 case types with explicit boundary rules. The critical one — divorce with property dispute stays Family Law because the legal matter is the divorce, not the property. The AI prioritizes legal theory over mentioned entities.
Model used: LLaMA 3.3 70B via Groq — faster than Gemini for structured classification tasks.
What makes this different from previous routing workflows:
Every other workflow I've built routes based on dropdown selections — the user picks their category. This one routes based on what the client actually wrote. No dropdowns. The AI reads context and decides. That's a fundamentally different pattern.
The form is live on GitHub Pages — real URL, real submissions, real webhook. Not a test form.
Happy to share the classification system prompt if anyone wants to see the boundary rules. 👇