Send a weekly Slack report on HubSpot sequence performance using a Claude Code skill

low complexityCost: Usage-based
Compatible agents

This skill works with any agent that supports the Claude Code skills standard, including Claude Code, Claude Cowork, OpenAI Codex, and Google Antigravity.

Prerequisites
  • One of the agents listed above
  • HubSpot Sales Hub Professional or Enterprise (required for Sequences API access)
  • HubSpot private app with crm.objects.contacts.read and sequence scopes
  • Slack bot with chat:write permission, added to the target channel
Environment Variables
# HubSpot private app token (Settings > Integrations > Private Apps)
HUBSPOT_ACCESS_TOKEN=your_value_here
# Slack bot token starting with xoxb- (chat:write scope required)
SLACK_BOT_TOKEN=your_value_here
# Slack channel ID starting with C (right-click channel > View channel details)
SLACK_CHANNEL_ID=your_value_here

Why a Claude Code skill?

The other approaches in this guide are deterministic: they run the same sequence report every time. 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:

  • "Post this week's sequence performance report to Slack"
  • "Which sequence has the best reply rate this month?"
  • "Compare the Enterprise and Mid-Market outbound sequences over the last 2 weeks"

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 different time window, a specific sequence comparison, step-level metrics — the agent adapts without you touching any code.

How it works

The skill directory has three parts:

  1. SKILL.md — workflow guidelines telling the agent what steps to follow, which env vars to use, and what pitfalls to avoid
  2. references/ — HubSpot API patterns (sequences endpoint, enrollment search, property names) so the agent calls the right APIs with the right parameters
  3. templates/ — a Slack Block Kit template so sequence reports 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., /sequence-report), 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/sequence-report/{templates,references}

This creates the layout:

.claude/skills/sequence-report/
├── SKILL.md                          # workflow guidelines + config
├── templates/
│   └── slack-sequence-report.md      # Block Kit template for Slack messages
└── references/
    └── hubspot-sequences-api.md      # HubSpot API patterns

Step 2: Write the SKILL.md

Create .claude/skills/sequence-report/SKILL.md:

---
name: sequence-report
description: Generate a weekly performance report for HubSpot sequences and post it to Slack
disable-model-invocation: true
allowed-tools: Bash, Read
---
 
## Goal
 
Fetch all HubSpot sequences, pull enrollment data for the last 7 days, calculate open/reply/meeting rates per sequence, and post a formatted report to Slack.
 
## 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)
 
Default lookback window: 7 days. The user may request a different window.
 
## Workflow
 
1. Validate that all required env vars are set. If any are missing, print which ones and exit.
2. Fetch all sequences from HubSpot. See `references/hubspot-sequences-api.md` for the endpoint.
3. Compute the 7-day lookback timestamp in milliseconds.
4. For each sequence, search for enrollments in the time range. See `references/hubspot-sequences-api.md` for the enrollment search endpoint and properties.
5. Calculate per-sequence metrics: open rate, reply rate, meeting booked rate.
6. Rank sequences by enrollment count descending.
7. Post the report to Slack using the Block Kit format in `templates/slack-sequence-report.md`.
8. Print a summary of how many sequences were reported and aggregate totals.
 
## Important notes
 
- The Sequences API requires **HubSpot Sales Hub Professional or Enterprise**. Free and Starter plans return 403 Forbidden.
- Sequences are accessed via the CRM v3 objects API: `GET /crm/v3/objects/sequences`. Older `/sequences/v2/` endpoints are deprecated.
- Enrollment boolean properties (`hs_was_email_opened`, `hs_was_email_replied`, `hs_was_meeting_booked`) are returned as **strings** `"true"` or `"false"`, not actual booleans.
- The Search API rate limit is 5 requests per second. Add a 200ms delay between enrollment searches.
- The Search API returns max 100 results per request. Use the `after` cursor from `paging.next.after` to paginate if needed.
- Use the `requests` library for HTTP calls and `slack_sdk` for Slack. Install them with pip if needed.

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:

SectionPurpose
GoalTells the agent what outcome to produce
ConfigurationWhich env vars to read and what defaults to use
WorkflowNumbered steps with pointers to reference files
Important notesNon-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-sequence-report.md

Create .claude/skills/sequence-report/templates/slack-sequence-report.md:

# Slack Sequence Report Template
 
Use this Block Kit structure for the weekly sequence performance report.
 
## Block Kit JSON
 
```json
{
  "channel": "<SLACK_CHANNEL_ID>",
  "text": "Weekly Sequence Performance Report",
  "blocks": [
    {
      "type": "header",
      "text": {
        "type": "plain_text",
        "text": "📧 Weekly Sequence Performance Report"
      }
    },
    {
      "type": "section",
      "fields": [
        {
          "type": "mrkdwn",
          "text": "*Total Enrolled*\n<total_enrolled>"
        },
        {
          "type": "mrkdwn",
          "text": "*Total Replies*\n<total_replied>"
        },
        {
          "type": "mrkdwn",
          "text": "*Meetings Booked*\n<total_meetings>"
        }
      ]
    },
    {
      "type": "divider"
    },
    {
      "type": "section",
      "text": {
        "type": "mrkdwn",
        "text": "*Per-Sequence Breakdown*\n\n<sequence_lines>"
      }
    },
    {
      "type": "context",
      "elements": [
        {
          "type": "mrkdwn",
          "text": "Last 7 days | Generated <date_string>"
        }
      ]
    }
  ]
}
```
 
## Sequence line format
 
Each sequence line should follow this format:
```
*Sequence Name* (X enrolled)
    Open: Y% | Reply: Z% | Meeting: W%
```
 
Separate sequences with blank lines for readability.
 
## Notes
 
- The top-level `text` field is required by Slack as a fallback for notifications.
- Section text has a 3,000-character limit. If there are many sequences, truncate to the top 10.

references/hubspot-sequences-api.md

Create .claude/skills/sequence-report/references/hubspot-sequences-api.md:

# HubSpot Sequences API Reference
 
## List sequences
 
Fetch all sequences to get IDs and names.
 
**Request:**
 
```
GET https://api.hubapi.com/crm/v3/objects/sequences?limit=100&properties=hs_sequence_name
Authorization: Bearer <HUBSPOT_ACCESS_TOKEN>
```
 
**Response shape:**
 
```json
{
  "results": [
    {
      "id": "12345",
      "properties": {
        "hs_sequence_name": "Outbound — Enterprise"
      }
    }
  ],
  "paging": {
    "next": {
      "after": "100"
    }
  }
}
```
 
## Search for enrollments
 
Find enrollments for a specific sequence in a time range.
 
**Request:**
 
```
POST https://api.hubapi.com/crm/v3/objects/sequence_enrollments/search
Authorization: Bearer <HUBSPOT_ACCESS_TOKEN>
Content-Type: application/json
```
 
**Body:**
 
```json
{
  "filterGroups": [
    {
      "filters": [
        {
          "propertyName": "hs_sequence_id",
          "operator": "EQ",
          "value": "<sequence_id>"
        },
        {
          "propertyName": "hs_enrollment_start_date",
          "operator": "GTE",
          "value": "<start_timestamp_ms>"
        }
      ]
    }
  ],
  "properties": [
    "hs_sequence_id",
    "hs_enrollment_state",
    "hs_was_email_opened",
    "hs_was_email_replied",
    "hs_was_meeting_booked"
  ],
  "limit": 100
}
```
 
- `value` for timestamps is a Unix timestamp in **milliseconds**.
- `limit` max is 100. Use the `after` cursor for pagination.
 
**Response shape:**
 
```json
{
  "total": 42,
  "results": [
    {
      "id": "67890",
      "properties": {
        "hs_sequence_id": "12345",
        "hs_enrollment_state": "EXECUTING",
        "hs_was_email_opened": "true",
        "hs_was_email_replied": "false",
        "hs_was_meeting_booked": "false"
      }
    }
  ],
  "paging": {
    "next": {
      "after": "100"
    }
  }
}
```
 
**Important:** Boolean properties are returned as the **strings** `"true"` or `"false"`, not actual boolean values. Compare with `=== "true"` in JavaScript or `== "true"` in Python.

Step 4: Test the skill

Invoke the skill conversationally:

/sequence-report

Claude will read the SKILL.md, check the reference files, write a script, install any missing dependencies, run it, and report the results. A typical run looks like:

Fetching sequences... found 3 active sequences
Fetching enrollments per sequence...
  Outbound — Enterprise: 85 enrolled
  Outbound — Mid-Market: 124 enrolled
  Re-engagement — Churned: 42 enrolled
Posting report to Slack...
Done. 3 sequences, 251 total enrollments, 31 replies, 9 meetings booked.

What the Slack report looks like

What you'll get
#sales-ops
Sequence Botapp9:41 AM

📧 Weekly Sequence Performance Report

Period: Feb 24 – Mar 2 | 3 active sequences

Outbound — Enterprise — 68% open, 12% reply, 4% booked

Outbound — Mid-Market — 54% open, 8% reply, 2% booked

Re-engagement — Churned — 41% open, 5% reply, 1% booked

Total: 251 enrolled, 31 replies, 9 meetings

Because the agent generates code on the fly, you can also make ad hoc requests:

  • "Which sequence has the best reply rate this month?" — the agent adjusts the lookback and ranking metric
  • "Compare Enterprise vs Mid-Market outbound over the last 2 weeks" — the agent filters to specific sequences
  • "Add bounce rate and unsubscribe rate to the report" — the agent includes additional enrollment properties
Test with real data

Make sure at least one sequence has enrollments in the lookback window. If no sequences had new enrollments, the skill correctly reports "No enrollment data" — that's not an error.

Step 5: Schedule it (optional)

Option A: Cron + Claude CLI

# Run every Monday at 9 AM
0 9 * * 1 cd /path/to/your/project && claude -p "Run /sequence-report" --allowedTools 'Bash(*)' 'Read(*)'

Option B: GitHub Actions + Claude

name: Weekly Sequence Report
on:
  schedule:
    - cron: '0 14 * * 1'  # 9 AM ET = 2 PM UTC, Mondays only
  workflow_dispatch: {}
jobs:
  report:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: anthropics/claude-code-action@v1
        with:
          prompt: "Run /sequence-report"
          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 }}

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).

GitHub Actions cron uses UTC

0 14 * * 1 runs at 2 PM UTC (9 AM ET) on Mondays. GitHub Actions cron may also have up to 15 minutes of delay.

Troubleshooting

When to use this approach

  • You want conversational flexibility — compare specific sequences, adjust lookback windows, or ask which sequence performs best
  • You want on-demand reports during sales standups or pipeline reviews
  • 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 reliable weekly scheduling with zero manual intervention → use n8n or the code approach
  • You want a no-code setup with a visual builder → use Make
  • You need reports 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 lookback windows, specific sequence comparisons, additional metrics like bounce rate. 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.02-0.08 per invocation depending on the number of sequences and enrollments. The HubSpot and Slack APIs themselves are free (though HubSpot requires Sales Hub Professional+).

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 — more than enough for weekly runs.

Can I add step-level analytics to the report?

Yes. Ask the agent to include step-level data in the enrollment query. The agent can read the reference files and adapt the code to pull additional properties and calculate per-step metrics.

Cost

  • Claude API — $0.02-0.08 per invocation (the agent reads files and generates code)
  • HubSpot API — included in Sales Hub Professional or Enterprise, 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.