How to Automate Support Tickets with AI Agents

Your helpdesk has an API. Your AI can use it. Here's how to wire them together.

The Idea

You've got a helpdesk full of tickets. Some need urgent attention, some are routine questions with known answers, and some just need to be tagged and routed to the right person. An AI agent can handle most of this — if it has access to the right API.

GoPimi exposes every operation through REST endpoints. That means any tool that can make HTTP requests — Claude, ChatGPT, a custom Python script, an MCP server — can read tickets, draft replies, assign agents, add tags, and close resolved issues. No special SDK, no plugins, no vendor lock-in.

What Your AI Agent Can Do

With API access, your agent can handle the repetitive parts of support:

The key difference from chatbot-based support: your AI works behind the scenes, augmenting your team. Customers still interact with real humans through real email threads. The AI is your team's assistant, not the customer's chatbot.

Give Your AI the Full API Schema

The fastest way to make an AI agent productive with your helpdesk is to give it the complete API specification. GoPimi publishes an OpenAPI 3.1 schema that describes every endpoint, parameter, and response format.

If you're using Claude Code, add a reference to the schema in your project's CLAUDE.md file:

# CLAUDE.md

## GoPimi Helpdesk API

API Base URL: https://core.gopimi.com/api/v1
Auth: Bearer token in Authorization header
OpenAPI Schema: https://gopimi.com/docs/api.json

Use this API to manage support tickets, conversations, contacts,
and tags. Refer to the OpenAPI schema for all available endpoints,
request/response formats, and required parameters.

API Token: (store in .env, reference via environment variable)

Now when you ask Claude to "check for unassigned high-priority tickets" or "draft a reply to ticket #42", it knows exactly which endpoints to call, what parameters to pass, and what the response looks like.

Example: Triage with Claude

Here's a practical workflow. You have new tickets coming in and want Claude to classify and prioritize them:

# Fetch open tickets that haven't been assigned
curl -s -H "Authorization: Bearer $GOPIMI_TOKEN" \
  "https://core.gopimi.com/api/v1/workspaces/$WS_ID/tickets?status=open&agent_id=unassigned" \
  | jq '.data[] | {id, subject, priority}'

Feed the results to your AI with a prompt like:

You are a support triage agent. For each ticket below, determine:
1. Priority (low/medium/high/urgent) based on the subject
2. Category tag (billing, bug, feature-request, question, account)
3. Whether it needs immediate human attention

Tickets:
{tickets_json}

Respond with JSON: [{id, priority, tag, needs_human: bool}]

Then apply the AI's decisions through the API:

# Set priority
curl -X PUT -H "Authorization: Bearer $GOPIMI_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"priority": "high"}' \
  "https://core.gopimi.com/api/v1/workspaces/$WS_ID/tickets/42"

# Add tag
curl -X POST -H "Authorization: Bearer $GOPIMI_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"tag_id": 5}' \
  "https://core.gopimi.com/api/v1/workspaces/$WS_ID/tickets/42/tags"

Example: Draft Replies with ChatGPT

OpenAI's API works just as well. Pull the ticket thread, send it to GPT-4 for a draft, then save it:

import openai
import requests

GOPIMI_URL = "https://core.gopimi.com/api/v1"
headers = {"Authorization": f"Bearer {GOPIMI_TOKEN}"}

# Get ticket messages
ticket = requests.get(
    f"{GOPIMI_URL}/workspaces/{ws_id}/tickets/{ticket_id}/messages",
    headers=headers
).json()

# Build conversation for GPT
messages = [
    {"role": "system", "content": "You are a helpful support agent. "
     "Draft a professional reply to the customer's latest message. "
     "Be concise and helpful."},
    {"role": "user", "content": f"Ticket subject: {ticket['subject']}\n\n"
     + "\n---\n".join(
         f"{m['sender']['name']}: {m['body']}"
         for m in ticket['data']
     )}
]

# Get draft from GPT-4
draft = openai.chat.completions.create(
    model="gpt-4o",
    messages=messages
).choices[0].message.content

# Save as draft in GoPimi (human reviews before sending)
requests.post(
    f"{GOPIMI_URL}/workspaces/{ws_id}/tickets/{ticket_id}/draft",
    headers=headers,
    json={"body": draft}
)

The draft shows up in the ticket detail view. Your support agent reviews it, edits if needed, and hits send. The AI did the heavy lifting; the human makes sure it's right.

Using Claude Code Directly

If you're a developer who uses Claude Code, you can manage support without leaving your terminal. With the CLAUDE.md reference to the OpenAPI schema set up, just ask:

Claude reads the OpenAPI schema, figures out the right endpoints, and makes the calls. You review what it's about to do and approve. That's it — support management from your IDE.

Webhook-Driven Automation

Instead of polling for new tickets, use webhooks to trigger your AI agent in real-time. GoPimi fires events for 15 different actions — ticket created, reply received, SLA breach, and more.

# Your webhook handler (e.g., Express.js)
app.post('/webhooks/gopimi', (req, res) => {
  const { event, data } = req.body;

  if (event === 'ticket.created') {
    // Send to AI for triage
    triageWithAI(data.ticket);
  }

  if (event === 'ticket.replied' && data.message.sender.type === 'contact') {
    // Customer replied — AI drafts a response
    draftReplyWithAI(data.ticket_id, data.message);
  }

  res.sendStatus(200);
});

New ticket arrives, your AI classifies it within seconds. Customer replies, your AI has a draft ready before your agent opens the ticket. The whole loop runs automatically.

What You Need

The API is the same regardless of which AI you use. Swap models, chain them together, or run different models for different tasks. The helpdesk doesn't care — it just processes API calls.

Start building. Grab your API token, point your AI at the OpenAPI schema, and automate the parts of support that don't need a human. Full API Reference | Free Trial