Durasi: 12 menit | Block: 2
🧠 Anthropic Routing Pattern
INPUT
│
┌──────▼──────┐
│ CLASSIFIER │ (Switch/If node)
└──┬───┬───┬──┘
│ │ │
┌────┘ │ └────┐
▼ ▼ ▼
Path A Path B Path C
(Sales) (Support) (FAQ)Prinsip: Jangan handle semua di satu node. Classify dulu, route kemudian.
🔀 If Node vs Switch Node
If Node (2 branch: True/False)
Kondisi: email contains "gmail.com"
├─ TRUE → Route A (personal email handler)
└─ FALSE → Route B (business email handler)Kapan pakai: Binary decision, 2 outcome saja.
Switch Node (Multi-branch)
Kondisi: category
├─ "sales" → Sales Pipeline
├─ "support" → Support Queue
├─ "billing" → Finance Team
└─ (fallback) → General InboxKapan pakai: Multi-category routing, 3+ outcome.
🛠️ Build: Lead Router
Scenario
Form inquiry masuk → classify → route ke tim yang tepat.
[Webhook Trigger]
│
▼
[Set Node: Extract category]
│
▼
[Switch Node: Route by category]
├── "sales" → [Slack: #sales-leads]
├── "support" → [Email: support team]
├── "billing" → [Sheets: billing log]
└── (fallback) → [Email: general]Switch Node Configuration
Routing Rules:
1. Value: \{{ $json.category }}
Condition: equals "sales" → Output 0: Sales
2. Value: \{{ $json.category }}
Condition: equals "support" → Output 1: Support
3. Value: \{{ $json.category }}
Condition: equals "billing" → Output 2: Billing
4. Fallback → Output 3: General🧠 AI-Powered Classification (Bonus)
Kalau category ga diisi user, bisa pakai AI untuk classify:
[Webhook] → [AI Node: Classify]
│
Prompt: "Classify inquiry ini ke salah satu:
sales, support, billing, general.
Inquiry: \{{ $json.pesan }}
Reply HANYA dengan category name."
│
▼
[Switch Node: Route]Model tip: Pakai model murah (GPT-4o-mini) untuk classification. Ga perlu model mahal.
📊 Real-World Examples
| Bisnis | Routing By | Outputs |
|---|---|---|
| E-commerce | Jenis inquiry | Order → Sales, Komplain → CS, Return → Logistics |
| Klinik | Tipe appointment | Baru → Registration, Follow-up → Doctor, Billing → Finance |
| Agency | Client tier | VIP → Senior, Regular → Junior, New → Sales |
| SaaS | Plan type | Enterprise → Account Manager, Free → Self-service |
⚠️ Common Mistakes
- ❌ Lupa fallback route → data hilang kalau ga match
- ❌ Case-sensitive matching → "Sales" ≠ "sales"
- ❌ Terlalu banyak branch → overcomplicate. Max 5-7 branch.