Alert your support lead in Slack when Gorgias tickets approach SLA deadline using Claude Cowork
Prerequisites
- Claude Desktop with Cowork enabled
- Gorgias account email, API key, and domain
- Slack Incoming Webhook URL for your SLA warnings channel
- Your SLA targets defined: first-response time per channel (e.g., 4 hours for email, 15 minutes for chat)
Overview
Claude Cowork lets you set up a recurring task that polls Gorgias for open tickets, calculates how much SLA time remains on each, and posts a Slack alert for any ticket approaching its deadline. No code to deploy, no webhook infrastructure to maintain — you describe the job in plain language and Claude handles the rest. This is the fastest way to get proactive SLA monitoring running, especially if you don't have an ops engineer on the team.
Step 1: Create a Slack Incoming Webhook
In Slack:
- Go to api.slack.com/apps → your app → Incoming Webhooks
- Toggle on → Add New Webhook to Workspace
- Choose your SLA warnings channel (e.g.,
#support-sla-warnings) - Copy the webhook URL
Step 2: Document your SLA targets
Before creating the task, write down your SLA targets. Claude needs these to calculate whether a ticket is at risk.
Example:
| Channel | First Response Target |
|---|---|
| 4 hours (240 min) | |
| Chat | 15 minutes |
| Contact form | 4 hours (240 min) |
Also decide your warning threshold — the percentage of SLA time that must elapse before alerting. A good default is 75% (e.g., alert at 3 hours for a 4-hour SLA).
Step 3: Create the Cowork task
Open Claude Desktop → Cowork tab → + New task.
Title: SLA breach warning — Slack alert
Description:
You are a support operations monitor. Check for open Gorgias tickets approaching their SLA first-response deadline and alert the team lead in Slack.
Gorgias credentials:
- Domain: your-store
- Auth: HTTP Basic — username: you@company.com, password: YOUR_API_KEY
Slack Incoming Webhook: https://hooks.slack.com/services/YOUR/WEBHOOK/URL
SLA targets (first response):
- email: 240 minutes
- chat: 15 minutes
- contact-form: 240 minutes
- default: 240 minutes
Warning threshold: alert when 75% of SLA time has elapsed.
Steps:
1. Fetch open tickets:
GET https://your-store.gorgias.com/api/tickets?status=open&limit=100
2. For each ticket, check if it has received an agent reply:
Look at ticket.messages — if any message has sender.type = "agent" or source.type = "internal", it has been replied to. Skip these tickets.
3. For unreplied tickets, calculate SLA status:
- Get the ticket's created_datetime
- Determine the SLA target based on ticket.channel (use the targets above)
- Calculate elapsed minutes = (now - created_datetime) in minutes
- Calculate remaining minutes = SLA target - elapsed minutes
- If elapsed >= 75% of the SLA target, this ticket is at risk
4. For at-risk tickets, post a Slack message:
POST [your Slack webhook URL]
Content-Type: application/json
Body:
{
"text": "SLA Warning — Ticket Approaching Deadline",
"blocks": [
{"type": "header", "text": {"type": "plain_text", "text": "SLA Warning — Ticket Approaching Deadline"}},
{"type": "section", "fields": [
{"type": "mrkdwn", "text": "*Customer*\n[customer name]"},
{"type": "mrkdwn", "text": "*Channel*\n[channel]"},
{"type": "mrkdwn", "text": "*Time Remaining*\n[X min or BREACHED]"},
{"type": "mrkdwn", "text": "*SLA Target*\n[target] min"}
]},
{"type": "section", "text": {"type": "mrkdwn", "text": "*Subject*\n[ticket subject]"}},
{"type": "section", "text": {"type": "mrkdwn", "text": "<https://your-store.gorgias.com/app/ticket/[id]|Open in Gorgias>"}}
]
}
Fill in the bracketed values from the ticket data.
5. Do not re-alert on the same ticket ID within the same run or if you've alerted on it in the last hour. Keep a running list of alerted ticket IDs and timestamps in a local JSON file at ~/.sla-alerted.json.
6. If multiple tickets are at risk, batch them into a single Slack message with one line per ticket instead of posting separate messages.
7. Print a summary: total tickets checked, at-risk tickets found, alerts sent.Update the SLA targets in the task description to match your actual policy. If you have per-priority SLAs (e.g., urgent tickets get a 1-hour target), add those as additional rules in step 3.
Step 4: Set the schedule
Frequency: Every 15 minutes during business hours
For teams with 24/7 chat support, run continuously. For email-only teams, business hours is sufficient since email SLAs typically don't count off-hours.
If your machine sleeps or Claude Desktop closes, scheduled tasks are skipped. A ticket approaching its SLA at 2 AM won't trigger an alert until the next run after Claude Desktop opens. If you need round-the-clock SLA monitoring, use the Agent Skill with a cron job on a server.
Step 5: Test it manually
Click Run now and watch the output. A typical run looks like:
Checking open Gorgias tickets for SLA risk...
Fetched 42 open tickets.
Ticket #18201 — "Shipping delay on order #4892" (Sarah M.)
Channel: email | Created: 3h 12m ago | SLA: 240 min | Remaining: 48 min
-> AT RISK — Slack alert sent
Ticket #18195 — "Wrong item received" (James K.)
Channel: email | Created: 4h 38m ago | SLA: 240 min | Remaining: 0 min
-> BREACHED — Slack alert sent
Ticket #18210 — "Chat about sizing" (Alex P.)
Channel: chat | Created: 8m ago | SLA: 15 min | Remaining: 7 min
-> Within SLA (53% elapsed) — skipped
Ticket #18215 — "Return label request" (Maria T.)
Channel: email | Created: 1h 20m ago | SLA: 240 min | Remaining: 160 min
-> Within SLA (33% elapsed) — skipped
Summary: 42 tickets checked, 2 at risk, 2 alerts sent.Check your Slack channel to verify the message format. If no tickets are at risk, temporarily lower the warning threshold in the description (e.g., change 75% to 10%) to force alerts for testing, then revert.
Step 6: Brief your team lead
Let your support lead know what to expect:
- Alerts appear in
#support-sla-warningsevery 15 minutes (only when tickets are at risk) - Each alert includes customer name, channel, time remaining, and a direct Gorgias link
- Multiple at-risk tickets are batched into a single message to reduce noise
- The lead should reassign, escalate, or respond to flagged tickets immediately
When to use this approach
- You want SLA monitoring running today with no infrastructure
- Your team handles fewer than 100 open tickets at a time
- You're experimenting with SLA targets and want to adjust thresholds easily by editing the task description
When to switch approaches
- You need 24/7 monitoring without depending on your laptop → use the Agent Skill with cron
- You need sub-5-minute alerting for chat SLAs → use n8n with a 5-minute schedule trigger
- You want to auto-reassign tickets approaching SLA (not just alert) → use n8n, which can chain a Gorgias API call to reassign after alerting
Cost
- Claude Desktop with Cowork: included in your Claude subscription
- Gorgias API: included in your plan
- Slack Incoming Webhooks: free
Need help implementing this?
We build and optimize automation systems for mid-market businesses. Let's discuss the right approach for your team.