Email-to-Case with AI: Auto-Classify, Route, and Draft Replies in Salesforce
How to turn inbound support email into routed, prioritized Salesforce Cases with a draft reply already waiting, using Claude. The build, the guardrails, and where to keep a human.
If you run support on Salesforce, you already know the first ten minutes of every case are the same ten minutes. Someone reads the inbound email, figures out what it’s actually about, decides how urgent it is, picks the right queue, and starts a reply from a blank box. Do that a few hundred times a week across a team and you’ve got real hours going into triage before anyone solves a single problem.
In our 10 automations every Salesforce admin should build in 2026, AI-enhanced Email-to-Case was on the list. This is the full build. By the end you’ll know how an inbound email becomes a classified, routed Salesforce Case with a draft reply already attached, and exactly where you keep a person in the loop.
What standard Email-to-Case does, and where it stops
Salesforce Email-to-Case is solid plumbing. It catches inbound email, creates a Case, threads replies. The routing on top of it is the weak part. Most teams route on keyword rules and a few hard-coded addresses, so “URGENT” in a subject line jumps the queue whether or not anything is actually urgent, and a calm email describing an outage sits in the general bucket for an hour.
The gap is meaning. A keyword rule reads strings. It can’t tell that “I can’t log in and our event starts in 20 minutes” is a different animal from “how do I change my password.” That’s the part Claude is good at, and it’s the part we’re going to bolt on.
The build: classify, route, draft
Three moves, in order. Claude classifies the email. Salesforce routes the Case on that classification. Claude drafts a first reply that an agent approves before it ever sends. The plumbing stays native (Email-to-Case, assignment rules, queues); the judgment is the new layer.
Stage 1: Classify with structured output
When a Case is created from email, hand the subject and body to Claude and ask for a fixed shape, not a paragraph. Tool use (function calling) lets you define the schema and force the response into it, so your Apex or your Worker parses a predictable object every time.
const tools = [{
name: "classify_case",
description: "Classify an inbound support email for routing and prioritization.",
input_schema: {
type: "object",
properties: {
topic: { type: "string", enum: ["billing", "technical", "account", "sales", "other"] },
urgency: { type: "string", enum: ["low", "normal", "high", "critical"] },
sentiment: { type: "string", enum: ["calm", "frustrated", "angry"] },
team: { type: "string", description: "The queue this should route to" },
summary: { type: "string", description: "One sentence an agent can read at a glance" },
confidence:{ type: "number", description: "0-1. How sure you are of topic + urgency." }
},
required: ["topic", "urgency", "team", "confidence"]
}
}];
Write those fields back onto the Case. Now your routing has something real to act on: topic, urgency, sentiment, a one-line summary, and a confidence score. The summary alone earns its keep, because an agent can triage a queue by reading one line per Case instead of opening each one.
A note on entities, because it matters for how you build: this is a “custom Claude” pattern, calling the Anthropic API from outside Salesforce and writing back through the REST API. If you’d rather keep the whole thing inside the Salesforce trust boundary, the Agentforce and Einstein route is the alternative. We laid out exactly when to pick which in Agentforce vs. Custom Claude. For background email processing like this, the external Claude pattern is usually cheaper and faster to iterate.
Stage 2: Route on the classification
This part stays native. Once topic, urgency, and team are on the Case, your existing assignment rules and queues do the work they’re already good at. Critical-urgency Cases page the on-call queue. Billing goes to billing. Frustrated-sentiment Cases on a high-value account get flagged for a senior agent.
The win here isn’t a new routing engine. It’s that the routing is finally reacting to what the email means instead of which words it happened to contain.
Stage 3: Draft the reply, but don’t send it
For most topics, Claude can draft a competent first response: answer the obvious question, ask for the one missing detail, set expectations on timing. Save that draft as a private Note or an unsent Email Message on the Case. The agent reads it, fixes what’s wrong, and sends.
This is the line we don’t cross: the AI drafts, a human sends. Auto-sending replies is how you end up apologizing to a customer for a confident, wrong answer. A draft removes the blank-page problem, which is where most of the time goes, while keeping a person on the one decision that carries risk.
Guardrails
A few rules keep this trustworthy:
- Route on confidence. Below your threshold, send the Case to a general triage queue with the AI’s best guess attached, not straight to a specialized team that will bounce it back.
- Never auto-send. Drafts are drafts. The agent is the send button.
- Escalate, don’t guess, on critical. If urgency comes back
criticalor sentimentangryon a key account, flag it for a human immediately rather than trusting the rest of the pipeline. - Log the classification. Store topic, urgency, and confidence on the Case so you can audit how often the model was right and tune from real data.
What it costs and how long it takes to build
A first version (one inbound channel, classify, route, draft) is roughly a one-week build for someone comfortable in Salesforce plus an LLM API. Per-email cost is a fraction of a cent, so spend tracks volume, not any single call. As we noted in the Agentforce vs. Claude cost breakdown, for background automation the API bill is noise next to the labor it replaces.
Start with one queue. Pick your highest-volume support channel, get classify-route-draft working end to end, then add channels and topics. Each addition is mostly a few new enum values and a routing rule.
Where these builds go wrong
- Auto-sending replies. Covered above, and worth repeating. Draft, review, send.
- Trusting urgency blindly. Pair the model’s urgency call with hard rules for known-critical accounts or keywords, so a misread can’t bury a real emergency.
- No fallback queue. Low-confidence Cases need somewhere safe to land. Don’t force every Case into a specialized team.
- Skipping the log. If you don’t store the classification, you can’t measure accuracy, and you can’t improve the prompt with anything better than a hunch.
Where to start
You’ve already got Email-to-Case running. Add the classification call first and just write the fields to the Case without changing any routing. Watch it for a week. Once you trust the topic and urgency calls, wire them into your assignment rules. Add the draft-reply step last, because that’s the one that needs the most agent feedback to get right.
If you want a second set of eyes on the classification schema, or you’d rather have the whole pipeline built and handed over, get in touch. Walking through your real support inbox and sketching the routing is usually a thirty-minute conversation, and you’ll leave knowing whether this is a week of work or two.
10 Automations Every Salesforce Admin Should Build in 2026
Build times, impact ratings, and the exact patterns we use for clients.
More in Salesforce
Claude Code for Salesforce Admins: A Practical Starter Guide
How Salesforce admins and developers can use Claude Code to ship Apex, LWC, and Flow work in hours instead of days — without replacing the discipline that keeps production orgs healthy.
Why Your Team Isn't Using Salesforce (and How to Fix It)
Low Salesforce adoption is almost never a discipline problem. It's a signal that the CRM costs your reps more than it returns. Here are the five real reasons teams avoid Salesforce and how to fix each one.
How to Build AI Lead Scoring in Salesforce with Claude: A Complete Technical Guide
A step-by-step guide to building real AI lead scoring in Salesforce using Claude's API — including Named Credentials, Queueable Apex, Custom Metadata Types, a test class, cost estimates, and data security considerations. No Agentforce license required.
Have a system you'd like us to build?
We turn repetitive work into automations that run in the background — so your team does the work that matters.
Multiply Your Output