Notify Slack when a HubSpot deal over $50K is created using a Claude Code skill
Install this skill
Download the skill archive and extract it into your .claude/skills/ directory.
large-deal-alert.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
- HubSpot private app with
crm.objects.deals.readscope - 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 large deals created in the last hour and alert Slack"
- "What deals over $100K were created this week?"
- "Post a summary of today's large deals to #executive-deals"
The skill contains workflow guidelines, API reference materials, and a 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 higher threshold, a longer lookback window, a summary instead of individual posts — 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/— HubSpot API patterns (endpoints, request shapes, response formats) so the agent calls the right APIs with the right parameterstemplates/— a Slack Block Kit template so messages are consistently formatted across runs
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. The reference files act as guardrails — the agent knows exactly which endpoints to hit and what the responses look like, so it doesn't have to guess.
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. This is the key difference from a traditional script: the agent can adapt its approach based on what you ask for while still using the right APIs and message formats.
Once installed, you can invoke a skill as a slash command (e.g., /large-deal-alert), or the agent will use it automatically when you give it a task where the skill is relevant. Skills are portable — anyone who clones your repo gets the same commands.
Step 1: Create the skill directory
mkdir -p .claude/skills/large-deal-alert/{templates,references}This creates the layout:
.claude/skills/large-deal-alert/
├── SKILL.md # workflow guidelines + config
├── templates/
│ └── slack-alert.md # Block Kit template for Slack messages
└── references/
└── hubspot-deals-api.md # HubSpot API patternsStep 2: Write the SKILL.md
Create .claude/skills/large-deal-alert/SKILL.md:
---
name: large-deal-alert
description: Check for recently created HubSpot deals over a threshold amount and post alerts to Slack
disable-model-invocation: true
allowed-tools: Bash, Read
---
## Goal
Check for HubSpot deals created in a given time window (default: last 1 hour) with an amount exceeding a threshold (default: $50,000) and post a formatted alert per deal to a Slack channel.
## Configuration
Read these environment variables:
- `HUBSPOT_ACCESS_TOKEN` — HubSpot private app token (required)
- `SLACK_BOT_TOKEN` — Slack bot token starting with xoxb- (required)
- `SLACK_CHANNEL_ID` — Slack channel ID starting with C (required)
- `HUBSPOT_PORTAL_ID` — HubSpot portal ID for building deal links (optional)
Default lookback window: 1 hour. Default amount threshold: $50,000. The user may request different values.
## Workflow
1. Validate that all required env vars are set. If any are missing, print which ones and exit.
2. Calculate a cutoff timestamp for the lookback window.
3. Search for deals created after the cutoff with amount exceeding the threshold using the HubSpot CRM Search API. See `references/hubspot-deals-api.md` for the request and response format.
4. For each matching deal, post a message to Slack using the Block Kit format in `templates/slack-alert.md`.
5. Print a summary of how many alerts were posted.
## Important notes
- HubSpot's CRM Search API expects date filter values as Unix timestamps in **milliseconds** (multiply seconds by 1000).
- The `amount` filter value must be a string (e.g., `"50000"` not `50000`).
- Some deals are created without an amount — the search API's GT filter will exclude them automatically.
- `SLACK_CHANNEL_ID` must be the channel ID (starts with `C`), not the channel name. The `chat.postMessage` API requires the ID.
- The Slack bot must be invited to the target channel or `chat.postMessage` will fail with `not_in_channel`.
- Use `urllib.request` for HTTP calls (no external dependencies required).Understanding the SKILL.md
Unlike the script-based approach, this SKILL.md doesn't contain a Run: command pointing to a script. Instead, it provides:
| Section | Purpose |
|---|---|
| Goal | Tells the agent what outcome to produce |
| Configuration | Which env vars to read and what defaults to use |
| Workflow | Numbered steps with pointers to reference files |
| Important notes | Non-obvious context that prevents common mistakes |
The allowed-tools: Bash, Read setting lets the agent both read reference files and execute code. The agent writes its own script based on the workflow steps and reference materials.
Step 3: Add reference files
templates/slack-alert.md
Create .claude/skills/large-deal-alert/templates/slack-alert.md:
# Slack Alert Template
Use this Block Kit structure for each large deal alert.
## Block Kit JSON
```json
{
"channel": "<SLACK_CHANNEL_ID>",
"text": "New large deal: <deal_name> ($<amount>)",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "New Large Deal Created"
}
},
{
"type": "section",
"fields": [
{ "type": "mrkdwn", "text": "*Deal:*\n<deal_name>" },
{ "type": "mrkdwn", "text": "*Amount:*\n$<amount>" }
]
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": { "type": "plain_text", "text": "View in HubSpot" },
"url": "<hubspot_link>"
}
]
}
]
}
```
## Notes
- The top-level `text` field is required by the Slack API as a fallback for notifications and accessibility. Always include it.
- The HubSpot link format: `https://app.hubspot.com/contacts/<PORTAL_ID>/deal/<DEAL_ID>` (if portal ID is set) or `https://app.hubspot.com/contacts/deal/<DEAL_ID>`.
- Format the amount with comma separators (e.g., $85,000 not $85000).
- To customize, you can add fields like deal owner, stage, or pipeline name.references/hubspot-deals-api.md
Create .claude/skills/large-deal-alert/references/hubspot-deals-api.md:
# HubSpot Deals API Reference
## Search for recently created deals by amount
Use the CRM Search API to find deals created after a cutoff date with an amount exceeding a threshold.
**Request:**
```
POST https://api.hubapi.com/crm/v3/objects/deals/search
Authorization: Bearer <HUBSPOT_ACCESS_TOKEN>
Content-Type: application/json
```
**Body:**
```json
{
"filterGroups": [
{
"filters": [
{
"propertyName": "createdate",
"operator": "GTE",
"value": "<cutoff_timestamp_ms>"
},
{
"propertyName": "amount",
"operator": "GT",
"value": "<threshold>"
}
]
}
],
"properties": ["dealname", "amount", "hubspot_owner_id", "createdate", "dealstage"],
"limit": 100
}
```
- `value` for `createdate` is a Unix timestamp in **milliseconds** (multiply seconds by 1000).
- `value` for `amount` must be a string (e.g., `"50000"` not `50000`).
- `limit` max is 100. If there are more results, use the `after` cursor from `paging.next.after` in the response to paginate.
- Filters within the same filter group use AND logic — both conditions must be true.
**Response shape:**
```json
{
"total": 2,
"results": [
{
"id": "12345",
"properties": {
"dealname": "Acme Corp Enterprise License",
"amount": "85000",
"hubspot_owner_id": "67890",
"createdate": "2026-03-05T14:30:00.000Z",
"dealstage": "qualificationscheduled"
}
}
],
"paging": {
"next": {
"after": "100"
}
}
}
```
## Notes
- Deals created without an `amount` property are automatically excluded by the GT filter.
- The `hubspot_owner_id` is a numeric ID. To get the owner's name, call `GET /crm/v3/owners/{owner_id}`.
- `createdate` is set automatically by HubSpot at deal creation time and cannot be manually overridden.Step 4: Test the skill
Invoke the skill conversationally:
/large-deal-alertClaude will read the SKILL.md, check the reference files, write a script, run it, and report the results. A typical run looks like:
Checking for deals over $50,000 created in the last 1 hour(s)...
Found 2 large deal(s)
Posted: Acme Corp Enterprise License ($85,000)
Posted: Widget Inc Annual Contract ($72,000)
Done. Posted 2 alert(s) to Slack.What the Slack alert looks like
Because the agent generates code on the fly, you can also make ad hoc requests:
- "Check for deals over $100K created this week" — the agent adjusts both the threshold and lookback window
- "What large deals were created today?" — the agent uses today's date as the lookback
- "Post a summary of this week's large deals to #executive-deals" — the agent adapts the output format and channel
Create a deal in HubSpot with an amount over $50,000, then run the skill within an hour. If no large deals were created in the lookback window, you'll see "No large deals found" — which is correct, not an error.
Step 5: Schedule it (optional)
Option A: Cron + Claude CLI
# Run every hour on the hour
0 * * * * cd /path/to/your/project && claude -p "Run /large-deal-alert" --allowedTools 'Bash(*)' 'Read(*)'Option B: GitHub Actions + Claude
name: Large Deal Alerts
on:
schedule:
- cron: '0 * * * *' # Every hour
workflow_dispatch: {} # Manual trigger for testing
jobs:
alert:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: anthropics/claude-code-action@v1
with:
prompt: "Run /large-deal-alert"
allowed_tools: "Bash(*),Read(*)"
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
HUBSPOT_ACCESS_TOKEN: ${{ secrets.HUBSPOT_ACCESS_TOKEN }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
SLACK_CHANNEL_ID: ${{ secrets.SLACK_CHANNEL_ID }}0 * * * * runs at the top of every hour UTC. GitHub Actions cron may also have up to 15 minutes of delay. For time-sensitive alerting, use cron on your own server or a dedicated scheduler instead.
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).
Troubleshooting
When to use this approach
- You want on-demand checks — "what large deals were created this week?" — during pipeline reviews or standups
- You want conversational flexibility — adjust thresholds, time windows, and output formats without editing code
- 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 real-time alerts within seconds of deal creation → use n8n with webhooks or the code approach
- You want a no-code setup with a visual builder → use Zapier or Make
- You need alerts running 24/7 with zero cost and no LLM usage → use the Code + Cron approach
Common questions
Why not just use a script?
A script runs the same way every time. The Claude Code skill adapts to what you ask — different thresholds, time windows, channels, or output formats. The reference files ensure it calls the right APIs even when improvising, so you get flexibility without sacrificing reliability.
Does this use Claude API credits?
Yes. The agent reads skill files and generates code each time. Typical cost is $0.01-0.05 per invocation depending on how many deals are returned. The HubSpot and Slack APIs themselves are free.
Can I change the threshold without editing files?
Yes. Just tell Claude: "Run /large-deal-alert with a $100K threshold." The SKILL.md specifies $50,000 as the default, but the agent can override it based on your request.
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)
- HubSpot API — included in all 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.