Prompt
How do I use an AI API to summarize customer support tickets?
Latest observation
Oct 8, 2026
OpenAI APIWeb search: off
To summarize customer support tickets with an AI API, you generally do four things:
- Collect the ticket text
- Send it to the model with a summarization prompt
- Parse the returned summary
- Store or display it in your system
Basic approach
1) Prepare the ticket text
Include the important parts of each ticket, such as:
- Customer message
- Agent replies
- Subject
- Tags or category
- Any resolution notes
Example input:
Subject: Unable to reset password
Customer: I clicked "forgot password" but never received the reset email.
Agent: Please check your spam folder and verify the email address.
Customer: I checked spam and nothing arrived.
Agent: I resent the email and also updated the address.
Resolution: Customer confirmed they received the email and reset access.
2) Ask the AI to summarize
Use a prompt like:
Summarize this support ticket in 2-3 sentences.
Include:
- customer issue
- actions taken
- final resolution
Ticket:
[insert ticket text]
3) Call the AI API
Here’s a simple Python example using a chat-style API:
from openai import OpenAI
client = OpenAI(api_key="YOUR_API_KEY")
ticket_text = """
Subject: Unable to reset password
Customer: I clicked "forgot password" but never received the reset email.
Agent: Please check your spam folder and verify the email address.
Customer: I checked spam and nothing arrived.
Agent: I resent the email and also updated the address.
Resolution: Customer confirmed they received the email and reset access.
"""
response = client.responses.create(
model="gpt-4.1-mini",
input=f"""
Summarize this support ticket in 2-3 sentences.
Include:
- customer issue
- actions taken
- final resolution
Ticket:
{ticket_text}
"""
)
print(response.output_text)
Better results: use structured output
If you want consistent summaries for dashboards or databases, ask for JSON:
response = client.responses.create(
model="gpt-4.1-mini",
input=f"""
Extract a structured summary of this support ticket as JSON with keys:
- issue
- actions_taken
- resolution
- sentiment
Ticket:
{ticket_text}
"""
)
Possible output:
{
"issue": "Customer could not receive password reset email.",
"actions_taken": "Agent checked spam folder, verified email address, and resent the email.",
"resolution": "Customer received the reset email and regained access.",
"sentiment": "frustrated, then resolved"
}
Tips for good summaries
- Keep the prompt specific: say exactly what fields you want.
- Limit length: e.g. “2–3 sentences” or “50 words max.”
- Use structured output if you need consistency.
- Remove sensitive data if necessary, or mask it before sending.
- Batch process tickets if you have many, but respect rate limits.
Common use cases
- Auto-generating ticket summaries for agents
- Creating weekly support reports
- Tagging tickets by issue type
- Measuring sentiment or urgency
- Clustering similar customer problems
Recommended production pattern
For a real system:
- Clean ticket text
- Truncate very long conversations
- Use a system prompt with your rules
- Request JSON output
- Validate the response before saving
- Log failures and retry safely
If you want, I can also give you:
- a Node.js example,
- a Python script for bulk ticket summarization, or
- a prompt template for support summaries.
Brands