Get Slack notifications when Claude Code needs your attention.
Stop checking your terminal every few minutes. Get notified instantly when Claude Code needs permission to run a command.
- Rich Slack messages with project context
- Visual indicators for notification types
- Secure configuration via environment variables
- Error handling and input validation
- Easy installation
- Claude Code installed
- A Slack workspace with permission to create webhooks
jqandcurlinstalled
# Clone the repo
git clone https://github.com/SreedharAvvari/claude-code-slack-notify.git
cd claude-code-slack-notify
# Run the installer
./install.sh- Copy the script:
mkdir -p ~/.claude/hooks
cp slack-notify.sh ~/.claude/hooks/
chmod +x ~/.claude/hooks/slack-notify.sh-
Set up your webhook URL (see Configuration)
-
Add hooks to your Claude Code settings (see Claude Code Settings)
- Go to Slack API Apps
- Click Create New App > From scratch
- Name it (e.g., "Claude Code Notifier") and select your workspace
- Go to Incoming Webhooks > Toggle Activate to On
- Click Add New Webhook to Workspace
- Select a channel and click Allow
- Copy the webhook URL
Add to your shell profile (~/.bashrc, ~/.zshrc, etc.):
export CLAUDE_SLACK_WEBHOOK_URL="https://hooks.slack.com/services/YOUR/WEBHOOK/URL"Then reload your shell:
source ~/.zshrc # or ~/.bashrc| Variable | Required | Default | Description |
|---|---|---|---|
CLAUDE_SLACK_WEBHOOK_URL |
Yes | - | Your Slack webhook URL |
Add to ~/.claude/settings.json:
{
"hooks": {
"Notification": [
{
"matcher": "permission_prompt",
"hooks": [
{
"type": "command",
"command": "~/.claude/hooks/slack-notify.sh"
}
]
},
]
}
}After editing, restart Claude Code or run /hooks to reload.
Test the webhook directly:
echo '{"message":"Claude wants to use Bash","cwd":"'"$PWD"'","notification_type":"permission_prompt"}' | ~/.claude/hooks/slack-notify.shYou should see a message in your Slack channel.
Permission Required:
🛡️ Permission Check
Hey Sreedhar! Claude wants to use
Bash📁
my-project· 🌱main· 🕐 Feb 04, 10:30 AM
Make sure you've exported the environment variable and restarted your terminal.
Install jq:
- macOS:
brew install jq - Ubuntu/Debian:
sudo apt install jq - Fedora:
sudo dnf install jq
- Check that your webhook URL is correct
- Test the script manually (see Testing)
- Verify hooks are loaded: run
/hooksin Claude Code - Check that the Slack channel exists and the webhook has access
- Never commit your webhook URL to version control
- The webhook URL is stored as an environment variable, not in the script
- Webhook URLs are write-only (cannot read Slack data)
MIT License. See LICENSE for details.
Contributions welcome! Please open an issue or PR.
P.S. This entire repo was coded by Claude Code. Yes, an AI built its own notification system because it got tired of being ignored. The irony is not lost on us.