← All tutorialsNOTIFICATIONS

How to get a Slack notification when Claude Code finishes

You can write a Claude Code Stop hook that posts to a Slack incoming webhook, or connect the machine with PeerBand and add a Slack webhook in the dashboard. PeerBand needs no scripts, works for Codex and other agents too, and can alert only on blocked agents.

Option 1: a Claude Code hook

Claude Code runs hooks on events. A Stop hook fires when Claude finishes responding, and a Notification hook fires when it waits for you. Either can run a command that posts to Slack:

curl -s -X POST -H 'Content-Type: application/json' \
  -d '{"text":"Claude Code finished"}' "$SLACK_WEBHOOK_URL"

This works, but you maintain a hook per machine and per agent, it fires on every response rather than when the task is done, and it doesn't cover Codex, Gemini CLI or other agents.

Option 2: a PeerBand webhook

Herdr already tracks each agent's status. PeerBand turns status changes into webhook calls, for every agent on every connected machine.

  1. Connect the machine: npm install -g peerband, then peerband setup.
  2. In Slack, create an app, turn on Incoming Webhooks and add one to your channel. Copy the https://hooks.slack.com/services/… URL.
  3. In the dashboard, open Webhooks and press + Add webhook.
  4. Name it, for example slack-alerts, choose the Slack format and paste the URL.
  5. Under Events, keep Status changes, and under Status changes to send, pick idle (finished) and blocked (waiting for you). Add Agent notes to receive peerband notify messages.
  6. Save. PeerBand posts a test message and the webhook turns Active.

From then on, Slack gets a line such as PeerBand · office-pc · claude (api) is blocked when an agent stops or waits.

Add a summary of what it did

A status alert says that the agent stopped, not what it did. Install the PeerBand skill (peerband setup offers it) and agents send a note when they finish a long task:

peerband notify "Migration done: 42 files changed, 3 tests failing in billing"

Questions

Does the Slack message include the agent's output?

No. Webhooks carry metadata (machine, agent label, workspace, status) and note text only, never terminal output. Read the output from the dashboard or your MCP client.

Will I get a message for every response?

Only for the statuses you pick. Choosing just blocked gives you one message each time an agent waits for you.

Does it work for Codex and other agents?

Yes. Any agent Herdr detects reports status the same way.