Auto-close stale Gorgias tickets using Claude Cowork
Prerequisites
- Claude Desktop with Cowork enabled
- Gorgias account email, API key, and domain
Overview
Claude Cowork lets you schedule a recurring task where Claude checks for stale tickets, sends a polite follow-up, and closes tickets that have gone unanswered — no code required. You describe the logic in plain text, and Claude handles the API calls. This is the fastest way to set up auto-close without writing any code or configuring automation Rules.
Step 1: Plan your auto-close policy
Before creating the task, decide on your rules:
- Follow-up delay: How long after the last agent reply before sending the follow-up (commonly 48 hours)
- Close delay: How long after the follow-up before closing (commonly 24 hours)
- Exclusions: Which tickets should never be auto-closed (VIP, escalated, billing disputes)
- Follow-up message: The text to send before closing
Follow-up message:
Hi [name], just checking in — did our previous reply resolve your question?
If you still need help, simply reply and we'll pick things right back up.
If we don't hear from you, we'll close this ticket shortly. You can always
reach out again anytime. — The Support TeamStep 2: Create the Cowork task
Open Claude Desktop → Cowork tab → + New task.
Title: Auto-close stale Gorgias tickets
Description:
You are a support operations assistant. Find stale Gorgias support tickets
and either send a follow-up message or close them.
Gorgias credentials:
- Domain: your-store
- Auth: HTTP Basic (username: you@company.com, password: YOUR_API_KEY)
Step 1 — Get pending tickets:
GET https://your-store.gorgias.com/api/tickets?status=pending&limit=50
Step 2 — For each ticket, check:
- Is the last message from an agent? (source.type = "helpdesk")
- How many hours since the ticket was last updated?
- Does the ticket have any of these tags: "vip", "escalated", "priority"?
If yes, SKIP this ticket entirely.
Step 3 — If the ticket has been waiting 48+ hours AND does NOT have the
tag "auto-close-sent":
- Send a follow-up message:
POST https://your-store.gorgias.com/api/tickets/{id}/messages
Body: {
"body_text": "Hi {customer_firstname}, just checking in — did our
previous reply resolve your question? If you still need help, simply
reply and we'll pick things right back up. If we don't hear from you,
we'll close this ticket shortly. You can always reach out again anytime.
— The Support Team",
"channel": "email",
"from_agent": true,
"source": {"type": "helpdesk", "from": {"name": "Support Team",
"address": "support@your-store.com"}}
}
- Then tag the ticket with "auto-close-sent":
PUT https://your-store.gorgias.com/api/tickets/{id}
Body: {"tags": [{"name": "auto-close-sent"}]}
Step 4 — If the ticket HAS the tag "auto-close-sent" AND has been waiting
72+ hours total:
- Close the ticket:
PUT https://your-store.gorgias.com/api/tickets/{id}
Body: {"status": "closed", "tags": [{"name": "auto-closed"}]}
Step 5 — Print a summary showing:
- How many tickets were checked
- Which tickets received a follow-up (ticket ID, subject, hours waiting)
- Which tickets were closed (ticket ID, subject, hours waiting)
- Which tickets were skipped and why (VIP, not stale enough, etc.)Step 3: Set the schedule
Frequency: Every 1–2 hours
Running hourly keeps your queue clean without excessive API calls. Tickets will be processed within an hour of hitting the 48-hour mark.
Cowork tasks only execute while Claude Desktop is open and your computer is awake. For overnight or weekend coverage, use the Agent Skill approach with a cron job instead.
Step 4: Run manually and review
Click Run now and watch the output. A typical run looks like:
Checked 35 pending tickets.
Follow-ups sent (3):
#15201 "Order hasn't arrived" (Maria R.) — 52h since last update → follow-up sent
#15187 "Wrong color received" (Jake P.) — 49h since last update → follow-up sent
#15176 "Discount code not working" (Sam L.) — 55h since last update → follow-up sent
Tickets closed (2):
#15102 "Tracking number request" (Emily T.) — 78h, follow-up sent 26h ago → closed
#15098 "Return label needed" (Chris W.) — 80h, follow-up sent 28h ago → closed
Skipped (4):
#15210 — tagged "vip", excluded
#15205 — last message from customer, not stale
#15199 — only 12h since last update
#15195 — only 30h since last updateReview the first few runs carefully. If the wrong tickets are being closed, adjust your exclusion criteria or timing in the task description.
Step 5: Fine-tune the task
After a week of runs, you may want to adjust:
- Timing: If too many tickets reopen after auto-close, increase the wait from 48 to 72 hours
- Exclusions: Add more tags to skip (e.g.,
billing,legal,complaint) - Message tone: Update the follow-up text based on customer feedback
Edit the Cowork task description directly — changes take effect on the next run.
Ask Claude to include a count of tickets tagged "auto-closed" that were later reopened. If the reopen rate exceeds 10%, your auto-close window is too aggressive.
Step 6: Scale up or move to code
Cowork is ideal for getting started quickly. Consider switching to the Agent Skill approach when:
- You need the task to run while your laptop is closed
- You're processing more than 100 tickets per run and need better error handling
- You want to integrate with other systems (Slack notifications, CRM updates) before closing
The Cowork task description serves as excellent documentation for what the code version should do.
When to use this approach
- You want auto-close running today without writing code
- Your ticket volume is moderate (under 200 pending tickets)
- You want easy adjustability — just edit the task description in plain text
When to switch to another approach
- You need 24/7 reliability without your laptop → use the Agent Skill with cron
- You want native Gorgias integration with no external dependencies → use Gorgias Rules
- You need complex routing logic or CRM lookups before closing → use n8n
Need help implementing this?
We build and optimize automation systems for mid-market businesses. Let's discuss the right approach for your team.