AI Support Ticket Routing & Resolution
AI Support Ticket Routing & Resolution
As of v1.0.73, SaaS Factory includes a fully autonomous customer support engine. Incoming support tickets are classified, routed, and resolved by AI — no human support team required.
How It Works
When a support ticket arrives (via direct submission or an inbound webhook), the ingestAndProcessTicket pipeline executes the following 12 steps automatically:
| Step | Action |
|---|---|
| 1 | Generate a unique ticket number |
| 2 | Fetch product/project context |
| 3 | Classify the ticket with Claude (category, priority, intent) |
| 4 | Insert the ticket into the database |
| 5 | Store the customer's opening message in the thread |
| 6 | Retrieve relevant Knowledge Base articles |
| 7 | Resolve the ticket using Claude + KB context |
| 8 | Update the ticket record with the AI decision |
| 9 | Send a reply email to the customer via Resend |
| 10 | Store the AI reply in the ticket thread |
| 11 | Append a system escalation note if needed |
Classification
The classifyTicket() function sends the ticket content to Claude (claude-3-5-haiku-20241022) with a structured JSON prompt. The model returns:
- Category — e.g. billing, technical, account, general
- Priority — e.g. low, medium, high, urgent
- Intent — a short description of what the customer is asking
This classification determines how the ticket is stored, displayed in the dashboard, and whether an escalation note is added.
Resolution
The resolveTicket() function makes a second Anthropic API call, this time providing:
- The classified ticket and its full context
- Relevant Knowledge Base articles retrieved for this ticket
The model generates a resolution response that is sent directly to the customer and stored in the ticket thread.
Knowledge Base
Knowledge Base articles power the resolution step. Articles are matched to tickets using keyword overlap scoring — the engine ranks articles by how many of their keywords appear in the ticket text.
Note: Keyword scoring works well for small to medium Knowledge Bases. For larger KBs, semantic (vector embedding) search will be introduced in a future release to improve match accuracy.
Managing Articles
Articles can be managed via the support router:
listArticles — List all KB articles
createArticle — Add a new article
updateArticle — Edit an existing article
Ticket Lifecycle
Incoming Ticket (submit / ingestWebhook)
│
▼
Classify (Claude)
│
▼
Retrieve KB Articles
│
▼
Resolve (Claude + KB)
│
├──▶ Send Email Reply (Resend API)
│
├──▶ Store Thread Message
│
└──▶ Escalation Note (if needed)
API Endpoints
All support operations are exposed through the support router:
| Endpoint | Description |
|---|---|
list | List tickets with pagination, search, and sort |
get | Fetch a single ticket by ID |
getSummary | Get a summary view of a ticket |
submit | Submit a new support ticket |
reply | Post a reply to a ticket thread |
update | Update ticket status or metadata |
listArticles | List Knowledge Base articles |
createArticle | Create a new KB article |
updateArticle | Update an existing KB article |
ingestWebhook | Ingest a ticket from an external source |
Database Schema
Three tables back the support engine:
supportTickets
Stores core ticket records including ticket number, classification output, status, and AI decision.
ticketMessages
Stores the full threaded message history for each ticket — customer messages, AI replies, and system notes are all recorded here.
knowledgeBaseArticles
Stores articles used during the resolution step. Each article contributes to the keyword matching pool.
Email Delivery
Customer-facing replies are sent via the Resend API (https://api.resend.com/emails). Each time the AI generates a resolution, an email is dispatched to the customer automatically.
Escalation
If the AI determines a ticket cannot be reliably resolved, a system escalation note is appended to the ticket thread (Step 11). This flags the ticket for review and is visible in the support dashboard.