Route refund requests from Gorgias using Claude Cowork
Prerequisites
- Claude Desktop with Cowork enabled
- Gorgias account email, API key, and domain
- A computer that stays awake during business hours (or a dedicated machine running Claude Desktop)
Overview
Claude Cowork lets you define a recurring task in plain English and have Claude execute it on a schedule — no script required. You describe the refund detection and routing logic, and Claude uses its built-in tools to call the Gorgias API, read ticket content, determine if it's a refund request, and assign it to the right team. This is the fastest way to get refund routing working with zero code.
Step 1: Find your Gorgias API credentials
In Gorgias, go to Settings → API → REST API and create a new key. You'll need:
- Domain:
your-store(fromyour-store.gorgias.com) - Email: Your Gorgias account email
- API key: Copy from the REST API settings (shown once)
Step 2: Identify your refund team
Go to Settings → Teams in Gorgias and note the exact name of the team that handles refunds. If you don't have one yet, create a team called Refund Team and add only agents who are authorized to process refunds and issue credits.
Step 3: Create the Cowork task
Open Claude Desktop and go to the Cowork tab. Click + New task.
Title: Route refund requests to the refund team
Description:
You are a support ops assistant. Your job is to identify refund and return requests in Gorgias and route them to the authorized refund team.
Steps:
1. Fetch open tickets from the Gorgias API that are NOT already assigned to a team.
GET https://your-store.gorgias.com/api/tickets?status=open&limit=50
Auth: HTTP Basic — username: your-email@company.com, password: YOUR_API_KEY
2. For each unassigned ticket, read the subject and first message body.
3. Determine if the ticket is a refund or return request. Look for:
- Direct refund language: refund, money back, reimburse, credit back, store credit
- Return language: return, send back, exchange, swap, replace
- Order issues implying refund: wrong item, damaged, defective, broken, never arrived
- Cancellation: cancel order, don't want this, changed my mind
Use your judgment — "this isn't what I ordered and I want my money" is a refund request even without the word "refund."
4. For tickets that ARE refund/return requests:
a. Add the tag "refund-request" via the Gorgias API:
PUT https://your-store.gorgias.com/api/tickets/{id}
Body: {"tags": [EXISTING_TAGS + {"name": "refund-request"}], "assignee_team": {"name": "Refund Team"}}
b. Do NOT remove any existing tags — merge the new tag with what's already there.
5. For tickets that are NOT refund requests, skip them entirely. Do not modify them.
6. Print a summary of how many tickets you checked and how many you routed.
Important:
- Only process tickets that have no assignee_team set.
- Never remove existing tags — only add.
- If a ticket already has the "refund-request" tag, skip it.Replace your-store, your-email@company.com, and YOUR_API_KEY with your real values.
Instead of putting credentials directly in the task description, store them as shell environment variables (GORGIAS_EMAIL, GORGIAS_API_KEY, GORGIAS_DOMAIN) and reference them in your description as "use the value from the GORGIAS_API_KEY environment variable." Claude can read env vars when running bash commands.
Step 4: Set the schedule
Frequency: Every 30 minutes (refund requests are time-sensitive — hourly may be too slow)
Cowork will execute the task on this cadence and show you the output each time.
Scheduled Cowork tasks only execute while Claude Desktop is open and your computer is awake. If you close the app or your laptop sleeps, tasks are skipped until the next scheduled interval. For 24/7 coverage, use the Agent Skill approach with cron or GitHub Actions instead.
Step 5: Run manually first
Before trusting the schedule, click Run now in Cowork to test it. Claude will:
- Call the Gorgias tickets API
- Filter to unassigned tickets
- Read each ticket's subject and body
- Determine if it's a refund/return request
- Route matching tickets to the refund team with the tag
- Print a run summary
A successful run looks like:
Fetched 38 open tickets. Found 15 without a team assignment.
Checked 15 tickets for refund intent:
#14301 "I'd like a refund please" → REFUND — routed to Refund Team, tagged ✓
#14305 "Where is my tracking number?" → not a refund — skipped
#14308 "Item arrived damaged, want my money back" → REFUND — routed to Refund Team, tagged ✓
#14312 "Can I exchange for a larger size?" → RETURN — routed to Refund Team, tagged ✓
#14315 "Login not working" → not a refund — skipped
... (10 more)
Done. Routed 4 of 15 tickets to Refund Team.Step 6: Refine the task description
After the first few runs, review routed tickets in Gorgias. If classifications are off, add clarifications to the task description:
"Tickets asking about return policies or shipping timelines should NOT be routed — only route tickets where the customer is actively requesting a refund or return. Tickets about warranty claims should be routed as refund requests."
Cowork's task description is your prompt — the more specific you are, the better Claude performs.
When to use this approach
- You want refund routing working today without writing or deploying any code
- Your ticket volume is under 200/day and 30-minute batching is acceptable
- You're testing refund routing logic before committing to Gorgias Rules
- You want AI-quality intent detection without setting up a separate API key
When to switch approaches
- You need routing to run 24/7 reliably → use the Agent Skill with cron or GitHub Actions
- You need instant routing (under 1 minute) → use Gorgias native Rules
- You want to extend the workflow with Slack alerts or spreadsheet logging → use n8n
Use Gorgias Rules to instantly catch the obvious keywords (refund, return, money back). Use Cowork to sweep through remaining unrouted tickets every 30 minutes and catch conversational or ambiguous refund requests that keywords missed.
Need help implementing this?
We build and optimize automation systems for mid-market businesses. Let's discuss the right approach for your team.