# AI Support Router with Tools

> Process customer inquiries, verify enterprise status with CRM tools, draft AI responses, and escalate urgent issues to Slack.

**The full picture · about 25 minutes · 5 steps**

Turn raw inbound customer inquiries into structured, resolved tickets. An AI Agent equipped with CRM and knowledge tools checks the customer's account status, drafts a grounded resolution, and routes enterprise or urgent issues directly to your on-call team in Slack.

[Webhook trigger](/build/triggers/webhook) → [AI Agent](/build/ai-features/ai-agent) → [Switch](/build/action-steps/switch) → Slack escalation → Zendesk reply

## What you will use

- A **Webhook** trigger to capture submissions from contact forms or support inboxes.
- In-field **[Data Transformation](/build/core-concepts/data-transformation)** to clean and normalize text without extra steps.
- An **[AI Agent](/build/ai-features/ai-agent)** equipped with **Search the web** and **HubSpot** tools to look up account tier and relevant docs.
- A **[Switch](/build/action-steps/switch)** step to split standard resolutions from VIP escalations.

## Prerequisites

- A connected **Slack** workspace (for alert notifications).
- A connected **Zendesk** or **Intercom** account (or your primary ticketing tool).
- A connected **HubSpot** or **Salesforce** account (to look up account tier).

---

## Building the Workflow

### 1. The Trigger: Form or Webhook Submission

Add a **Webhook** trigger to receive inbound support submissions. Each payload delivers the user's name, email address, subject, and message.

Sample incoming JSON:

```json
{
  "name": "Ada Lovelace",
  "email": "ada@example.com",
  "subject": "SSO login issue after SAML certificate rotation",
  "message": "<p>We rotated our Okta cert and our team is locked out. Urgent help needed!</p>"
}
```

### 2. The AI Agent: Triage and Solution Drafting

Add an **AI Agent** step.

1. **Brain (Model):** Select `Gemini 2.5 Flash` for fast, cost-effective reasoning.
2. **Tools:** Turn on **Search the web** (or a workflow tool that searches your internal docs) and toggle on your **HubSpot** account.
3. **Primary goals:** Write instructions that leverage in-field token transformations to sanitize the input:

```markdown
You are an expert technical support engineer for our SaaS platform.

Customer: {{ 1.name | trim | title_case }}
Email: {{ 1.email | trim | lower }}
Company Domain: {{ 1.email | extract_domain }}
Subject: {{ 1.subject | trim }}
Issue: {{ 1.message | strip_html | trim }}

Instructions:

1. Use the HubSpot tool to check if the company domain belongs to an Enterprise or VIP customer tier.
2. Search the knowledge base for resolutions matching the subject and issue.
3. Classify urgency: "Critical" if Enterprise customer or system outage; otherwise "Normal".
4. Draft a courteous, accurate response.
5. Return a strict JSON object with:
   - "urgency": "Critical" | "Normal"
   - "tier": "Enterprise" | "Standard" | "Unknown"
   - "category": "Authentication" | "Billing" | "Bug" | "General"
   - "draft_reply": "string"
   - "summary": "one-sentence summary of issue"
```

4. Toggle on **Parse JSON result** in the agent settings so downstream steps can read `{{ 2.result.urgency }}` directly.

### 3. The Logic: Switch Step

Add a **Switch** step after the agent to determine the handling path:

- **Case 1 (Escalate):** `{{ 2.result.urgency }}` equals `Critical` OR `{{ 2.result.tier }}` equals `Enterprise`.
- **Fallback (Automated Reply):** Standard tickets that do not require immediate on-call escalation.

### 4. Branch A: Urgent Escalation (Slack + Zendesk)

On the **Case 1 (Escalate)** route, connect two parallel or sequential actions:

1. **Slack: Send Message**
   - Channel: `#urgent-support`
   - Message:

```markdown
🚨 _VIP Customer Incident Escalated!_
• _Customer:_ {{ 1.name | title_case }} ({{ 1.email | lower }})
• _Company:_ {{ 1.email | extract_domain }} [Tier: {{ 2.result.tier }}]
• _Category:_ {{ 2.result.category }} | _Urgency:_ {{ 2.result.urgency }}
• _Summary:_ {{ 2.result.summary }}

_AI Suggested Resolution:_

> {{ 2.result.draft_reply }}
```

2. **Zendesk: Create Urgent Ticket**
   - Priority: `Urgent`
   - Tags: `vip`, `ai-triaged`, `{{ 2.result.category | lower }}`
   - Internal Note: Include `{{ 2.result.draft_reply }}` so the assigned engineer can review and send with one click.

### 5. Branch B: Standard Resolution

On the **Fallback** route:

1. **Zendesk: Create & Respond**
   - Status: `Pending`
   - Public Reply: `{{ 2.result.draft_reply }}`
   - Tags: `ai-automated-reply`, `{{ 2.result.category | lower }}`

> **Human in the Loop:** For sensitive categories (such as Billing refunds),
> place a **[Human Review](/build/action-steps/user-approval)** step before
> sending the public reply so an agent can review the draft before it reaches
> the customer.

## Test and go live

### Send the sample payload

Use the Webhook trigger's test URL and send the JSON above. Confirm the agent's stored `result` contains all five fields from the requested response shape before you wire the Switch or either destination.

### Prove both routes

First use an urgent outage message and confirm **Escalate** creates the urgent ticket and Slack alert. Then change the message to a routine question and confirm **Fallback** creates the standard pending response without notifying the urgent channel.

### Review what the agent used

Read the agent execution and the records it found through its tools. A successful step means it returned an answer; verify the account tier, category and suggested resolution against the source records before allowing an automatic public reply.

### Set the workflow Live

Switch the workflow to **Live**, send one controlled request to the Live webhook URL and confirm one ticket reaches the intended branch. Keep Human Review in front of public replies until your test set consistently produces acceptable drafts.

---

## What's Next?

👉 **[Continue to AI Invoice Processing →](/getting-started/cookbook/ai-invoice-processing)**

- Explore autonomous AI capabilities in **[AI Agent](/build/ai-features/ai-agent)**.
- Sanitize and format data effortlessly with **[Data Transformation](/build/core-concepts/data-transformation)**.
- Learn about branching and fallback routes in **[Switch Step](/build/action-steps/switch)**.
