All Docs
FeaturesSaaS FactoryUpdated February 19, 2026

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:

StepAction
1Generate a unique ticket number
2Fetch product/project context
3Classify the ticket with Claude (category, priority, intent)
4Insert the ticket into the database
5Store the customer's opening message in the thread
6Retrieve relevant Knowledge Base articles
7Resolve the ticket using Claude + KB context
8Update the ticket record with the AI decision
9Send a reply email to the customer via Resend
10Store the AI reply in the ticket thread
11Append 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:

EndpointDescription
listList tickets with pagination, search, and sort
getFetch a single ticket by ID
getSummaryGet a summary view of a ticket
submitSubmit a new support ticket
replyPost a reply to a ticket thread
updateUpdate ticket status or metadata
listArticlesList Knowledge Base articles
createArticleCreate a new KB article
updateArticleUpdate an existing KB article
ingestWebhookIngest 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.