Skip to content

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

  1. Go to Settings → Automation
  2. Click Add Workflow
  3. Name: AI Email Routing - Support
  4. Click Create Workflow
  5. Add Inbound Email trigger:
  6. Email Address: support@yourcompany.com
  7. 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

Email Trigger Configuration


Step 2: Add AI Classification Task

  1. Click Add Task below email trigger
  2. Select AI Prompt
  3. Configure:
  4. Parent Task: Receive Support Email
  5. AI Model: GPT-4 (recommended for classification)
  6. 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.
    
  7. Response Format: JSON
  8. Max Tokens: 300
  9. Temperature: 0.3 (lower = more consistent)
  10. 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

AI Prompt Configuration


Step 3: Check if Urgent

  1. Click Add Task after AI Classify
  2. Select If Statement
  3. Configure:
  4. Parent Task: AI Classify Email
  5. Condition Type: Text comparison
  6. Field 1: {{task_1002_urgency}}
  7. Operator: Equals
  8. Field 2: urgent
  9. 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)

  1. Click Add Task on TRUE branch
  2. Select Edit Client
  3. Configure:
  4. Parent Task: Check if Urgent (TRUE)
  5. Client Email: {{task_1001_from_email}}
  6. Action: Update Fields
  7. Fields:
    • assigned_to = manager_user_id (your manager's ID)
    • support_priority = urgent
    • support_category = {{task_1002_category}}
  8. Tags: Add Urgent Support
  9. Task Name: Assign to Manager

Step 4b: Send SMS Alert to Manager

  1. Click Add Task after Assign to Manager
  2. Select SMS
  3. Configure:
  4. Parent Task: Assign to Manager
  5. To: +1234567890 (manager's phone)
  6. Message:
    🚨 URGENT SUPPORT EMAIL
    
    From: {{task_1001_from_name}}
    Subject: {{task_1001_subject}}
    
    AI Summary: {{task_1002_summary}}
    Category: {{task_1002_category}}
    Sentiment: {{task_1002_sentiment}}
    
    Check email now: support@yourcompany.com
    
  7. Task Name: Alert Manager via SMS

Step 5: Category Routing (FALSE Branch)

Add nested If Statements for each category:

5a: Check if Sales

  1. Click Add Task on FALSE branch of urgent check
  2. Select If Statement
  3. Configure:
  4. Parent Task: Check if Urgent (FALSE)
  5. Field 1: {{task_1002_category}}
  6. Operator: Equals
  7. Field 2: sales
  8. Task Name: Check if Sales

5b: Assign to Sales (TRUE of Sales Check)

  1. Click Add Task on TRUE branch
  2. Select Edit Client
  3. Configure:
  4. Client Email: {{task_1001_from_email}}
  5. Fields:
    • assigned_to = sales_team_lead_id
    • support_category = sales
    • response_time = {{task_1002_suggested_response_time}}
  6. Tags: Add Sales Inquiry
  7. Task Name: Assign to Sales

5c: Check if Technical (FALSE of Sales Check)

  1. Click Add Task on FALSE branch of sales check
  2. Select If Statement
  3. Configure:
  4. Field 1: {{task_1002_category}}
  5. Operator: Equals
  6. Field 2: technical
  7. 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.

Category Routing Logic


Step 6: Log Support Interaction

Add Workflow Note after all assignment branches:

  1. Select Workflow Note
  2. Configure:
  3. Parent Task: (Connect from all assignment tasks)
  4. Client Email: {{task_1001_from_email}}
  5. Note Type: Support
  6. 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}}
    
  7. 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

Test Classification Results


Expected Output

For Urgent Issues:

  1. ✅ AI classifies as urgent within 2-5 seconds
  2. ✅ Assigned to manager immediately
  3. ✅ SMS alert sent to manager's phone
  4. ✅ Tagged "Urgent Support" in CRM
  5. ✅ Support interaction logged

For Normal Issues:

  1. ✅ AI classifies by category within 2-5 seconds
  2. ✅ Routed to appropriate team
  3. ✅ Priority and response time set
  4. ✅ Tagged with category
  5. ✅ 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
- Add examples of each urgency level - Review AI responses and adjust prompt - Consider using HIGH urgency for most issues


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:

const response = '{{task_1002_response}}';
// Remove markdown code blocks
const cleaned = response.replace(/```json\n?/g, '').replace(/```/g, '');
const data = JSON.parse(cleaned);
return data;
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:

Delay: 4 hours
Then check if response sent
If not, send reminder to assigned team member




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