Files
claude-code-notification/README.md
Kyle Fang ec61fce85f Update README with Claude Code configuration instructions and improve notification format
- 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>
2025-07-18 09:17:14 +08:00

2.2 KiB

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

  1. Clone this repository:

    git clone git@github.com:zhigang1992/claude-code-notification.git
    cd claude-code-notification
    
  2. Set up your webhook URL:

    export TELERT_WEBHOOK_URL="https://telert.reily.app/t/YOUR-WEBHOOK-ID"
    
  3. Make the script executable:

    chmod +x claude-notification-hook.sh
    
  4. 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.sh with 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 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.