# Claude Code Notification Hook A bash script that sends notifications to [telert.reily.app](https://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 1. Clone this repository: ```bash git clone git@github.com:zhigang1992/claude-code-notification.git cd claude-code-notification ``` 2. Set up your webhook URL: ```bash export TELERT_WEBHOOK_URL="https://telert.reily.app/t/YOUR-WEBHOOK-ID" ``` 3. Make the script executable: ```bash chmod +x claude-notification-hook.sh ``` 4. Configure Claude Code to use this hook by editing `~/.claude/settings.json`: ```json { "hooks": { "Notification": [ { "matcher": "", "hooks": [ { "type": "command", "command": "TELERT_WEBHOOK_URL= /path/to/claude-notification-hook.sh" } ] } ], "Stop": [ { "matcher": "", "hooks": [ { "type": "command", "command": "TELERT_WEBHOOK_URL= /path/to/claude-notification-hook.sh" } ] } ] } } ``` Replace `` with your actual telert webhook URL and `/path/to/claude-notification-hook.sh` with the full path to where you cloned this repository. ## Usage The script reads JSON from stdin and expects the following format: ```json { "message": "Your notification message", "title": "Notification title", "session_id": "optional-session-id" } ``` ### Example ```bash 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 `jq` for 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.