mirror of
https://github.com/zhigang1992/claude-code-notification.git
synced 2026-01-12 22:38:41 +08:00
ec61fce85f4ef3a03dbc59010987425462dabb62
- Add detailed setup instructions for ~/.claude/settings.json - Remove duplicate information from notification text - Move project path to the end of the message on its own line 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Claude Code Notification Hook
A bash script that sends notifications to telert.reily.app when Claude Code events occur.
Features
- Receives JSON input from Claude Code hooks
- Extracts message, title, and session_id from the input
- Sends formatted notifications to telert.reily.app
- Includes project name and path in notifications
Setup
-
Clone this repository:
git clone git@github.com:zhigang1992/claude-code-notification.git cd claude-code-notification -
Set up your webhook URL:
export TELERT_WEBHOOK_URL="https://telert.reily.app/t/YOUR-WEBHOOK-ID" -
Make the script executable:
chmod +x claude-notification-hook.sh -
Configure Claude Code to use this hook by editing
~/.claude/settings.json:{ "hooks": { "Notification": [ { "matcher": "", "hooks": [ { "type": "command", "command": "TELERT_WEBHOOK_URL=<YOUR_WEBHOOK_URL> /path/to/claude-notification-hook.sh" } ] } ], "Stop": [ { "matcher": "", "hooks": [ { "type": "command", "command": "TELERT_WEBHOOK_URL=<YOUR_WEBHOOK_URL> /path/to/claude-notification-hook.sh" } ] } ] } }Replace
<YOUR_WEBHOOK_URL>with your actual telert webhook URL and/path/to/claude-notification-hook.shwith the full path to where you cloned this repository.
Usage
The script reads JSON from stdin and expects the following format:
{
"message": "Your notification message",
"title": "Notification title",
"session_id": "optional-session-id"
}
Example
echo '{"message": "Test notification", "title": "Test"}' | ./claude-notification-hook.sh
Environment Variables
TELERT_WEBHOOK_URL(required): Your telert.reily.app webhook URL
Notes
- The script uses basic JSON parsing with grep and cut. For production use, consider using
jqfor more robust JSON parsing. - Notifications include the current working directory and project name for context.
- The script has a 10-second timeout for sending notifications.
Description
Languages
Shell
100%