AI Email Routing Workflow¶
Automatically classify and route support emails using AI, with urgent escalation
Overview¶
This advanced workflow demonstrates how to use AI to intelligently classify incoming support emails, route them to the appropriate team member, and escalate urgent issues with SMS notifications.
What You'll Build: - Capture inbound support emails - Use AI to classify urgency and category - Route to appropriate team based on AI analysis - Send SMS alerts for urgent issues - Log all support interactions
Real-World Applications: - Customer support triage - Sales inquiry routing - Technical support classification - Priority escalation - Department assignment
Workflow Diagram¶
graph LR
A[Inbound Email<br/>TRIGGER] --> B[AI Prompt<br/>Classify Email]
B --> C{If Statement<br/>Urgent?}
C -->|Yes| D[Edit Client<br/>Assign to Manager]
C -->|No| E{If Statement<br/>Category?}
D --> F[SMS<br/>Alert Manager]
E -->|Sales| G[Edit Client<br/>Assign to Sales]
E -->|Technical| H[Edit Client<br/>Assign to Support]
E -->|Billing| I[Edit Client<br/>Assign to Billing]
F --> J[Workflow Note]
G --> J
H --> J
I --> J Tasks Used¶
| Order | Task Type | Purpose | Difficulty |
|---|---|---|---|
| 1 | Inbound Email | Capture support emails | ⭐⭐ Intermediate |
| 2 | AI Prompt | Classify urgency and category | ⭐⭐⭐ Advanced |
| 3 | If Statement | Check if urgent | ⭐⭐ Intermediate |
| 4 | Edit Client | Assign to team member | ⭐⭐ Intermediate |
| 5 | SMS | Send urgent alerts | ⭐ Beginner |
| 6 | Workflow Note | Log support interaction | ⭐ Beginner |
Total Setup Time: 25-30 minutes
Skill Level: Advanced
Prerequisites: Inbound email configured, AI Prompt credits, team member phone numbers
Step-by-Step Setup¶
Step 1: Configure Inbound Email Trigger¶
- Go to Settings → Automation
- Click Add Workflow
- Name:
AI Email Routing - Support - Click Create Workflow
- Add Inbound Email trigger:
- Email Address: support@yourcompany.com
- Task Name:
Receive Support Email
Output Variables:
{{task_1001_from_email}} // Customer email
{{task_1001_from_name}} // Customer name
{{task_1001_subject}} // Email subject
{{task_1001_body_text}} // Email body (plain text)
{{task_1001_body_html}} // Email body (HTML)
{{task_1001_attachments}} // Attachment URLs
{{task_1001_cc}} // CC'd addresses

Step 2: Add AI Classification Task¶
- Click Add Task below email trigger
- Select AI Prompt
- Configure:
- Parent Task:
Receive Support Email - AI Model: GPT-4 (recommended for classification)
- Prompt:
You are a customer support classifier. Analyze the following email and provide classification. From: {{task_1001_from_name}} ({{task_1001_from_email}}) Subject: {{task_1001_subject}} Body: {{task_1001_body_text}} Classify this email and respond ONLY with a JSON object (no markdown formatting): { "urgency": "urgent|high|normal|low", "category": "sales|technical|billing|general", "sentiment": "positive|neutral|negative", "summary": "brief 1-sentence summary", "suggested_response_time": "immediate|4hours|24hours|48hours" } Classification criteria: - URGENT: Security issues, service outages, data loss, angry customers - HIGH: Product not working, payment problems, time-sensitive requests - NORMAL: Feature requests, general questions, feedback - LOW: Newsletter subscriptions, marketing inquiries - SALES: Pricing, demos, trials, new customer inquiries - TECHNICAL: Bugs, errors, integration issues, API questions - BILLING: Invoices, refunds, subscription changes, payment failures - GENERAL: Everything else Respond with JSON only, no extra text. - Response Format: JSON
- Max Tokens: 300
- Temperature: 0.3 (lower = more consistent)
- Task Name:
AI Classify Email
What This Does: - Analyzes email content with GPT-4 - Returns structured JSON classification - Evaluates urgency, category, and sentiment - Provides summary for quick reference - Suggests response timeframe
Output:
{{task_1002_response}} // Full AI response
{{task_1002_urgency}} // urgent/high/normal/low
{{task_1002_category}} // sales/technical/billing/general
{{task_1002_sentiment}} // positive/neutral/negative
{{task_1002_summary}} // Brief summary
{{task_1002_suggested_response_time}} // Response timeframe

Step 3: Check if Urgent¶
- Click Add Task after AI Classify
- Select If Statement
- Configure:
- Parent Task:
AI Classify Email - Condition Type: Text comparison
- Field 1:
{{task_1002_urgency}} - Operator: Equals
- Field 2:
urgent - Task Name:
Check if Urgent
What This Does: - Branches workflow based on AI classification - Urgent issues go to manager with SMS alert - Non-urgent issues go to appropriate team member
Step 4a: Assign Urgent to Manager (TRUE Branch)¶
- Click Add Task on TRUE branch
- Select Edit Client
- Configure:
- Parent Task:
Check if Urgent(TRUE) - Client Email:
{{task_1001_from_email}} - Action: Update Fields
- Fields:
assigned_to=manager_user_id(your manager's ID)support_priority=urgentsupport_category={{task_1002_category}}
- Tags: Add
Urgent Support - Task Name:
Assign to Manager
Step 4b: Send SMS Alert to Manager¶
- Click Add Task after Assign to Manager
- Select SMS
- Configure:
- Parent Task:
Assign to Manager - To:
+1234567890(manager's phone) - Message:
- Task Name:
Alert Manager via SMS
Step 5: Category Routing (FALSE Branch)¶
Add nested If Statements for each category:
5a: Check if Sales¶
- Click Add Task on FALSE branch of urgent check
- Select If Statement
- Configure:
- Parent Task:
Check if Urgent(FALSE) - Field 1:
{{task_1002_category}} - Operator: Equals
- Field 2:
sales - Task Name:
Check if Sales
5b: Assign to Sales (TRUE of Sales Check)¶
- Click Add Task on TRUE branch
- Select Edit Client
- Configure:
- Client Email:
{{task_1001_from_email}} - Fields:
assigned_to=sales_team_lead_idsupport_category=salesresponse_time={{task_1002_suggested_response_time}}
- Tags: Add
Sales Inquiry - Task Name:
Assign to Sales
5c: Check if Technical (FALSE of Sales Check)¶
- Click Add Task on FALSE branch of sales check
- Select If Statement
- Configure:
- Field 1:
{{task_1002_category}} - Operator: Equals
- Field 2:
technical - Task Name:
Check if Technical
5d: Assign to Technical Support¶
Similar to sales assignment, assign to technical support team.
5e: Check if Billing and Assign¶
Continue pattern for billing category.
5f: Assign General Inquiries (Final FALSE Branch)¶
Catch-all for uncategorized emails.

Step 6: Log Support Interaction¶
Add Workflow Note after all assignment branches:
- Select Workflow Note
- Configure:
- Parent Task: (Connect from all assignment tasks)
- Client Email:
{{task_1001_from_email}} - Note Type: Support
- Note:
Support email received via {{task_1001_to_email}} Subject: {{task_1001_subject}} AI Classification: - Urgency: {{task_1002_urgency}} - Category: {{task_1002_category}} - Sentiment: {{task_1002_sentiment}} - Summary: {{task_1002_summary}} Assigned to: {{task_XXXX_assigned_to_name}} Response Time: {{task_1002_suggested_response_time}} - Task Name:
Log Support Email
Step 7: Test with Sample Emails¶
Test 1: Urgent Technical Issue¶
Create test email record:
From: test@customer.com
Subject: URGENT: Website is down, losing sales!
Body: Our entire website has been offline for 2 hours.
We're losing thousands in sales. This is critical -
please help immediately!
Expected AI Classification: - Urgency: urgent - Category: technical - Sentiment: negative
Expected Routing: - Assigned to manager - SMS alert sent
Test 2: Normal Sales Inquiry¶
From: prospect@company.com
Subject: Interested in pricing for enterprise plan
Body: Hi, I'm evaluating your platform for our team of 50.
Could you send me information about enterprise pricing
and features? Thanks!
Expected: - Urgency: normal - Category: sales - Assigned to sales team
Test 3: Billing Question¶
From: customer@example.com
Subject: Invoice question
Body: I received invoice #1234 but the amount seems
incorrect. Can you review and clarify?
Expected: - Urgency: high (payment-related) - Category: billing - Assigned to billing team

Expected Output¶
For Urgent Issues:¶
- ✅ AI classifies as urgent within 2-5 seconds
- ✅ Assigned to manager immediately
- ✅ SMS alert sent to manager's phone
- ✅ Tagged "Urgent Support" in CRM
- ✅ Support interaction logged
For Normal Issues:¶
- ✅ AI classifies by category within 2-5 seconds
- ✅ Routed to appropriate team
- ✅ Priority and response time set
- ✅ Tagged with category
- ✅ Support interaction logged
Common Issues & Solutions¶
Issue: AI returning incorrect format¶
Cause: AI not following JSON-only instruction
Solution: - Add "Respond with JSON only, no extra text" to prompt - Lower temperature to 0.1-0.3 for more consistent responses - Use GPT-4 instead of GPT-3.5 - Add example JSON in prompt - Use Code task to parse and validate JSON
Issue: All emails classified as "urgent"¶
Cause: Classification criteria too broad
Solution: - Tighten urgent criteria in prompt:
URGENT only for: security breaches, service outages,
data loss, legal threats, extremely angry customers
Issue: Variables showing as empty ({{task_1002_urgency}})¶
Cause: AI response not parsed correctly
Solution: 1. Check AI response format in output panel 2. If response includes markdown (``json), use Code task: 3. Access via`}
Issue: SMS not sending¶
Cause: Phone number format or SMS credits
Solution: 1. Verify phone number in E.164 format: +1234567890 2. Check SMS credits in Settings → Billing 3. Test SMS task independently with your own number 4. Verify SMS provider configured correctly
Issue: Multiple team members receiving assignments¶
Cause: If Statement logic overlap
Solution: 1. Use mutually exclusive conditions (equals, not contains) 2. Ensure FALSE branches properly chained 3. Add "else/catch-all" branch at end 4. Test each category independently
Workflow Enhancements¶
Add Auto-Reply Email¶
After AI classification, send acknowledgment:
Subject: RE: {{task_1001_subject}}
Body:
Hi {{task_1001_from_name}},
Thank you for contacting support. Your email has been
received and classified as {{task_1002_category}}
({{task_1002_urgency}} priority).
Expected Response Time: {{task_1002_suggested_response_time}}
A team member will respond shortly.
Best regards,
Support Team
Add Slack Notification¶
Post to support channel:
Webhook URL: https://hooks.slack.com/your-webhook
Body:
{
"text": "📧 New support email from {{task_1001_from_name}}",
"attachments": [{
"color": "{{task_1002_urgency == 'urgent' ? 'danger' : 'good'}}",
"fields": [
{"title": "Subject", "value": "{{task_1001_subject}}"},
{"title": "Urgency", "value": "{{task_1002_urgency}}"},
{"title": "Category", "value": "{{task_1002_category}}"},
{"title": "Summary", "value": "{{task_1002_summary}}"}
]
}]
}
Add Sentiment-Based Actions¶
If negative sentiment, add special handling:
If {{task_1002_sentiment}} equals negative:
- Add tag "Unhappy Customer"
- Set priority to HIGH
- CC manager on assignment
- Send "We're sorry" auto-reply
Add Follow-Up Reminders¶
Use Delay task for response tracking:
Related Workflows¶
- Lead Capture to CRM - Customer capture
- Support Ticket Creation - Ticket management
- Birthday Automation - Customer engagement
Related Tasks¶
- Inbound Email - Email trigger
- AI Prompt - AI classification
- If Statement - Routing logic
- Edit Client - Assignment
- SMS - Urgent alerts
- Workflow Note - Activity logging
Next Steps¶
✅ You've built an intelligent AI-powered support system!
Try these enhancements: 1. Add more categories (refunds, features, partnerships) 2. Train AI with your specific product terminology 3. Add auto-reply based on category 4. Create reports of classification accuracy 5. Build escalation workflows for unresponded tickets
Need help? Check AI Prompt Best Practices or Advanced Workflows