Alert your team in Slack when a VIP customer opens a Gorgias ticket using a Claude Code skill
Install this skill
Download the skill archive and extract it into your .claude/skills/ directory.
vip-escalation.skill.zipPrerequisites
This skill works with any agent that supports the Claude Code skills standard, including Claude Code, Claude Cowork, OpenAI Codex, and Google Antigravity.
- One of the agents listed above
- Gorgias account with API access
- Slack bot with
chat:writepermission added to the target channel
Why a Claude Code skill?
The other approaches in this guide are deterministic: they run the same logic every time, the same way. An Claude Code skill is different. You tell Claude what you want in plain language, and the skill gives it enough context to do it reliably.
That means you can say:
- "Check for new VIP tickets and alert Slack"
- "Lower the VIP threshold to $300 for this run"
- "Which VIP customers contacted us this week?"
- "Post a daily VIP ticket summary instead of individual alerts"
The skill contains workflow guidelines, API reference materials, and a Slack message template that the agent reads on demand. When you invoke the skill, Claude reads these files, writes a script on the fly, runs it, and reports results. If you ask for something different next time — a different LTV threshold, a summary instead of alerts, analysis by customer segment — the agent adapts without you touching any code.
How it works
The skill directory has three parts:
SKILL.md— workflow guidelines telling the agent what steps to follow, which env vars to use, and what pitfalls to avoidreferences/— Gorgias API patterns (ticket listing, customer LTV lookup) so the agent calls the right APIstemplates/— a Slack Block Kit template for VIP escalation alerts
When invoked, the agent reads SKILL.md, consults the reference and template files as needed, writes a Python script, executes it, and reports what it posted.
What is a Claude Code skill?
An Claude Code skill is a reusable command you add to your project that Claude Code can run on demand. Skills live in a .claude/skills/ directory and are defined by a SKILL.md file that tells the agent what the skill does, when to run it, and what tools it's allowed to use.
In this skill, the agent doesn't run a pre-written script. Instead, SKILL.md provides workflow guidelines and points to reference files — API documentation, message templates — that the agent reads to generate and execute code itself.
Once installed, you can invoke a skill as a slash command (e.g., /vip-alert), or the agent will use it automatically when you give it a task where the skill is relevant.
Step 1: Create the skill directory
mkdir -p .claude/skills/vip-alert/{templates,references}This creates the layout:
.claude/skills/vip-alert/
├── SKILL.md # workflow guidelines + config
├── templates/
│ └── slack-alert.md # Block Kit template for VIP alerts
└── references/
└── gorgias-customers-api.md # Gorgias tickets + customer APIStep 2: Write the SKILL.md
Create .claude/skills/vip-alert/SKILL.md:
---
name: vip-alert
description: Check recent Gorgias support tickets for high-value customers and post a Slack alert with ticket details and customer LTV when a VIP is detected.
disable-model-invocation: true
allowed-tools: Bash, Read
---
## Goal
Poll Gorgias for recently opened tickets, check each customer's order history to determine VIP status, and post a rich Slack alert when a VIP customer is detected.
## Configuration
Read these environment variables:
- `GORGIAS_DOMAIN` — your Gorgias subdomain (required)
- `GORGIAS_EMAIL` — Gorgias account email for API auth (required)
- `GORGIAS_API_KEY` — Gorgias API key (required)
- `SLACK_BOT_TOKEN` — Slack bot token with chat:write (required)
- `SLACK_CHANNEL_ID` — Slack channel ID starting with C (required)
- `VIP_LTV_THRESHOLD` — minimum lifetime spend for VIP status (optional, default: 500)
Default VIP criteria: customer has the `vip` tag, OR lifetime value >= threshold, OR 5+ orders. The user may request different criteria.
## Workflow
1. Validate that all required env vars are set. If any are missing, print which ones and exit.
2. Fetch recent open tickets from Gorgias (created in the last 90 minutes). See `references/gorgias-customers-api.md` for the endpoint.
3. For each ticket, fetch the customer's profile via `GET /customers/{id}` to get Shopify LTV and order count.
4. Determine VIP status: customer has `vip` tag, OR `shopify_total_spent >= VIP_LTV_THRESHOLD`, OR `shopify_orders_count >= 5`.
5. Track already-alerted ticket IDs in a local JSON file to avoid duplicate alerts.
6. Post a Slack alert for each VIP ticket using the template in `templates/slack-alert.md`.
7. Print a summary of alerts sent.
## Important notes
- Customer LTV data comes from Shopify integration metadata in the Gorgias customer record (`meta.shopify_total_spent`, `meta.shopify_orders_count`). If you don't use Shopify, adapt the VIP criteria to use tags only.
- `SLACK_CHANNEL_ID` must be the channel ID (starts with `C`), not the channel name.
- The Slack bot must be invited to the target channel.
- Rate limit: Gorgias allows roughly 2 requests per second. Each ticket requires a separate customer lookup, so add delays for large batches.
- Trim the alerted tickets file to the last 500 entries to prevent unbounded growth.
- Use the `requests` library for Gorgias and `slack_sdk` for Slack. Install with pip if needed.Step 3: Add reference files
templates/slack-alert.md
Create .claude/skills/vip-alert/templates/slack-alert.md:
# VIP Escalation Slack Template
Use this Block Kit structure for each VIP customer alert.
## Block Kit JSON
```json
{
"channel": "<SLACK_CHANNEL_ID>",
"text": "VIP ticket from <customer_name>: <subject>",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "VIP Customer — New Support Ticket"
}
},
{
"type": "section",
"fields": [
{ "type": "mrkdwn", "text": "*Customer*\n<customer_name>" },
{ "type": "mrkdwn", "text": "*Email*\n<customer_email>" },
{ "type": "mrkdwn", "text": "*Lifetime Value*\n$<ltv>" },
{ "type": "mrkdwn", "text": "*Total Orders*\n<order_count>" },
{ "type": "mrkdwn", "text": "*Subject*\n<subject>" }
]
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Message*\n<message_preview_400_chars>"
}
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": { "type": "plain_text", "text": "Open in Gorgias" },
"url": "https://<GORGIAS_DOMAIN>.gorgias.com/app/ticket/<ticket_id>",
"style": "primary"
}
]
}
]
}
```
## Notes
- Send via `slack_sdk` `chat.postMessage` with the `SLACK_BOT_TOKEN`.
- Truncate the message preview to 400 characters.
- Use `primary` button style for high visibility.references/gorgias-customers-api.md
Create .claude/skills/vip-alert/references/gorgias-customers-api.md:
# Gorgias Tickets + Customers API Reference
## Authentication
All requests use HTTP Basic Auth:
- Username: `GORGIAS_EMAIL`
- Password: `GORGIAS_API_KEY`
- Base URL: `https://{GORGIAS_DOMAIN}.gorgias.com/api`
## List open tickets
**Request:**
```
GET /api/tickets?status=open&limit=50
```
**Response shape:**
```json
{
"data": [
{
"id": 18501,
"subject": "Missing item from my last order",
"status": "open",
"created_datetime": "2026-03-05T14:30:00+00:00",
"requester": {
"id": 678,
"name": "Marcus Reynolds",
"email": "marcus@example.com"
},
"messages": [
{
"id": 99001,
"body_text": "Hi, I received my order but the blue jacket is missing...",
"source": { "type": "email" }
}
]
}
]
}
```
- Filter by `created_datetime` to only process tickets from the last 90 minutes.
## Get customer details
**Request:**
```
GET /api/customers/{customer_id}
```
**Response shape:**
```json
{
"id": 678,
"name": "Marcus Reynolds",
"email": "marcus@example.com",
"meta": {
"shopify_total_spent": "4820.00",
"shopify_orders_count": "23"
}
}
```
- `meta.shopify_total_spent` is a string — parse to float.
- `meta.shopify_orders_count` is a string — parse to int.
- These fields only exist if the Gorgias-Shopify integration is active.
- If the customer doesn't have Shopify data, these fields may be missing or null.
## VIP Determination Logic
A customer is VIP if ANY of:
1. Customer has a `vip` tag (check `requester.meta.tags` on the ticket)
2. `shopify_total_spent >= VIP_LTV_THRESHOLD` (default $500)
3. `shopify_orders_count >= 5`Step 4: Test the skill
Invoke the skill conversationally:
/vip-alertA typical run looks like:
Checking recent tickets for VIP customers...
Found 12 recent ticket(s)
#18501 "Missing item from last order" LTV=$4,820 VIP=True
-> Slack alert sent
#18505 "Where is my tracking number?" LTV=$45 VIP=False
#18508 "Return request" LTV=$0 VIP=True (tagged vip)
-> Slack alert sent
Done. 2 alert(s) sent.Because the agent generates code on the fly, you can also make ad hoc requests:
- "Lower the VIP threshold to $300" — the agent adjusts the criteria
- "Which VIP customers contacted us this week?" — the agent runs analysis
- "Post a daily summary of VIP tickets" — the agent batches instead of individual alerts
Create a test ticket from a customer with a high Shopify LTV, then run the skill. If no VIP tickets are found, check that your Gorgias-Shopify integration is populating the customer metadata.
Step 5: Schedule it (optional)
Option A: Cron + Claude CLI
# Run every 30 minutes during business hours
*/30 8-18 * * 1-5 cd /path/to/your/project && claude -p "Run /vip-alert" --allowedTools 'Bash(*)' 'Read(*)'Option B: GitHub Actions + Claude
name: VIP Escalation Alerts
on:
schedule:
- cron: '*/30 * * * *' # Every 30 minutes
workflow_dispatch: {}
jobs:
alert:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: anthropics/claude-code-action@v1
with:
prompt: "Run /vip-alert"
allowed_tools: "Bash(*),Read(*)"
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
GORGIAS_DOMAIN: ${{ secrets.GORGIAS_DOMAIN }}
GORGIAS_EMAIL: ${{ secrets.GORGIAS_EMAIL }}
GORGIAS_API_KEY: ${{ secrets.GORGIAS_API_KEY }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
SLACK_CHANNEL_ID: ${{ secrets.SLACK_CHANNEL_ID }}Option C: Cowork Scheduled Tasks
Claude Desktop's Cowork supports built-in scheduled tasks. Open a Cowork session, type /schedule, and configure the cadence — hourly, daily, weekly, or weekdays only. Each scheduled run has full access to your connected tools, plugins, and MCP servers.
Scheduled tasks only run while your computer is awake and Claude Desktop is open. If a run is missed, Cowork executes it automatically when the app reopens. For always-on scheduling, use GitHub Actions (Option B) instead. Available on all paid plans (Pro, Max, Team, Enterprise).
The LTV data (shopify_total_spent, shopify_orders_count) only exists if your Gorgias account is connected to Shopify. If you use a different e-commerce platform, you'll need to rely on the vip tag or adapt the VIP criteria. Tell the agent: "Only use the vip tag for VIP detection, skip LTV checks."
Troubleshooting
When to use this approach
- You want conversational flexibility — adjust VIP thresholds, analyze VIP patterns, batch summaries alongside real-time alerts
- You want on-demand VIP checks during customer reviews or escalation meetings
- You're already using Claude Code and want skills that integrate with your workflow
- You want to run tasks in the background via Claude Cowork while focusing on other work
- You prefer guided references over rigid scripts — the agent adapts while staying reliable
When to switch approaches
- You need instant VIP alerts (under 1 minute) → use Gorgias Rules with a webhook or n8n
- You want a visual workflow builder → use n8n
- You need alerts running 24/7 at zero LLM cost → use Gorgias Rules for tag-based VIP detection
Common questions
Why not just use Gorgias Rules for VIP alerts?
Gorgias Rules can trigger on the vip tag, but they can't check customer LTV or order count in real time. If you define VIP by spend threshold, you need the API-based approach. The skill checks both tags and LTV, catching VIPs that don't have a tag yet.
Does this use Claude API credits?
Yes. The agent reads skill files and generates code each time (~$0.01-0.05 per invocation). No inner Claude calls are needed — VIP detection is data lookup, not classification.
Can I run this skill on a schedule without a server?
Yes. GitHub Actions (Option B in Step 5) runs Claude on a cron schedule using GitHub's infrastructure. The free tier includes 2,000 minutes/month.
Cost
- Claude API — $0.01-0.05 per invocation (the agent reads files and generates code)
- Gorgias API — included in all paid plans, no per-call cost
- Slack API — included in all plans, no per-call cost
- GitHub Actions (if scheduled) — free tier includes 2,000 minutes/month
Looking to scale your AI operations?
We build and optimize automation systems for mid-market businesses. Let's discuss the right approach for your team.