Skip to content

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 Inbox

Kapan 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

BisnisRouting ByOutputs
E-commerceJenis inquiryOrder → Sales, Komplain → CS, Return → Logistics
KlinikTipe appointmentBaru → Registration, Follow-up → Doctor, Billing → Finance
AgencyClient tierVIP → Senior, Regular → Junior, New → Sales
SaaSPlan typeEnterprise → Account Manager, Free → Self-service

⚠️ Common Mistakes

  1. ❌ Lupa fallback route → data hilang kalau ga match
  2. ❌ Case-sensitive matching → "Sales" ≠ "sales"
  3. ❌ Terlalu banyak branch → overcomplicate. Max 5-7 branch.

Bootcamp AI Automation — akala.id