How to Automate Support Ticket Priority Scoring
Score ticket urgency automatically based on content and customer value.
Jay Banlasan
The AI Systems Guy
When you automate support ticket priority scoring, the most urgent issues get handled first without a human making that judgment call on every ticket. I build these for support teams where everything feels urgent and nothing gets properly triaged. The system scores each ticket on content severity, customer value, and sentiment.
Two inputs drive the score: what the ticket says and who sent it.
What You Need Before Starting
- A ticketing system with API access
- Customer data (account value, plan tier, history)
- Python 3.8+ with the Anthropic SDK
- A database for scoring history
Step 1: Define Your Scoring Dimensions
Score tickets on three axes, then combine:
def calculate_priority_score(content_score, customer_score, sentiment_score):
"""Each score is 1-10. Weighted combination produces final priority."""
weights = {
"content": 0.4,
"customer": 0.3,
"sentiment": 0.3,
}
total = (
content_score * weights["content"] +
customer_score * weights["customer"] +
sentiment_score * weights["sentiment"]
)
return round(total, 1)
Step 2: Score Content Severity with AI
import anthropic
import json
client = anthropic.Anthropic()
def score_content(subject, body):
response = client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=50,
messages=[{
"role": "user",
"content": f"""Score this support ticket's urgency from 1-10.
10 = system down, data loss, security breach
7-9 = can't use core features, payment issues
4-6 = feature questions, minor bugs
1-3 = general questions, feedback
Subject: {subject}
Body: {body}
Respond with ONLY: {{"score": 7, "reason": "brief reason"}}"""
}]
)
return json.loads(response.content[0].text)
Step 3: Score Customer Value
Pull customer data and score based on account attributes:
def score_customer(customer_id):
customer = get_customer(customer_id)
score = 1
tier_scores = {"enterprise": 10, "business": 7, "pro": 5, "free": 2}
score = tier_scores.get(customer.get("plan", "free"), 2)
if customer.get("monthly_revenue", 0) > 1000:
score = min(score + 2, 10)
if customer.get("churn_risk", False):
score = min(score + 3, 10)
return score
Step 4: Score Sentiment
Detect frustration level from the ticket text:
def score_sentiment(text):
response = client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=50,
messages=[{
"role": "user",
"content": f"""Rate the frustration level in this message from 1-10.
1 = calm, informational
5 = mildly frustrated
10 = furious, threatening to leave
Message: {text}
Respond with ONLY: {{"score": 5}}"""
}]
)
return json.loads(response.content[0].text)["score"]
Step 5: Apply Priority and Route
def process_ticket(ticket):
content = score_content(ticket["subject"], ticket["body"])
customer = score_customer(ticket["customer_id"])
sentiment = score_sentiment(ticket["body"])
priority = calculate_priority_score(content["score"], customer, sentiment)
if priority >= 8:
level = "critical"
elif priority >= 6:
level = "high"
elif priority >= 4:
level = "medium"
else:
level = "low"
update_ticket(ticket["id"], {
"priority": level,
"priority_score": priority,
"content_reason": content["reason"],
"sentiment_score": sentiment
})
if level == "critical":
alert_on_call_team(ticket)
return {"priority": level, "score": priority}
What to Build Next
Build a priority drift detector. If a ticket sits at "medium" for 4 hours and gets two follow-up messages, bump it to "high" automatically. Stale tickets with active customers are a bigger problem than new tickets.
Related Reading
- AI in Customer Service - priority scoring in the context of full support automation
- The Priority Matrix for AI Projects - prioritization frameworks that apply to ticket management
- Identifying Your Biggest Bottleneck - ticket triage is often the hidden bottleneck
Want this system built for your business?
Get a free assessment. We will map every system your business needs and show you the ROI.
Get Your Free Assessment