Skip to content

Notification dispatcher for Claude Code hooks

License

Notifications You must be signed in to change notification settings

felipeelias/claude-notifier

claude-notifier

CI Go License: MIT

Notification dispatcher for Claude Code hooks. Reads JSON from stdin, fans out to all configured notification channels concurrently. Single static binary, compiled-in plugins, TOML configuration.

Why

Claude Code has notification hooks that run a shell command when the agent needs your attention. Most people write a bash script that curls ntfy or sends a desktop notification. That works fine for one channel on one machine.

It gets annoying when you want notifications on your phone and your desktop, or you move to a different OS and have to rewrite the script, or you want high priority for errors but low priority for routine updates.

claude-notifier is a single binary that handles all of that:

  • Sends to multiple channels from one hook (ntfy, desktop, Slack, etc.)
  • Same binary and config file across Linux, macOS, and Windows
  • Always exits 0 so it never breaks your hook
  • claude-notifier init, edit the TOML, you're done

Install

Homebrew (macOS and Linux)

brew install felipeelias/tap/claude-notifier

Debian / Ubuntu

Download the .deb from GitHub Releases and install:

sudo dpkg -i claude-notifier_*.deb

Fedora / RHEL

Download the .rpm from GitHub Releases and install:

sudo rpm -i claude-notifier_*.rpm

Manual download

Pre-built binaries for macOS, Linux, and Windows (amd64 and arm64) are available on the GitHub Releases page. Download the archive for your platform, extract it, and place the binary in your PATH.

From source

Requires Go 1.24+.

go install github.com/felipeelias/claude-notifier@latest

Setup

Initialize the config file:

claude-notifier init

This creates ~/.config/claude-notifier/config.toml. Edit it to configure your notification channels.

Claude Code hook

Add to your Claude Code settings (~/.claude/settings.json):

{
  "hooks": {
    "Notification": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "claude-notifier"
          }
        ]
      }
    ]
  }
}

Or install the Claude plugin which configures the hook automatically.

Configuration

Run claude-notifier init to generate a config file with all available options documented. See config.example.toml for the full reference.

Template variables

Plugins that support Go templates (like ntfy) have access to the following variables from the Claude Code Notification hook payload:

Variable Source
{{.Message}} Notification message from Claude
{{.Title}} Notification title from Claude
{{.Project}} Project name (last segment of cwd)
{{.Cwd}} Working directory
{{.NotificationType}} permission_prompt, idle_prompt, auth_success, elicitation_dialog
{{.SessionID}} Claude Code session ID
{{.TranscriptPath}} Path to conversation transcript

Plugins can also define custom variables via their config (e.g., [notifiers.ntfy.vars]). User-defined keys are title-cased for template access (env becomes {{.Env}}).

Usage

The primary use case is as a Claude Code hook — it reads JSON from stdin and dispatches to all configured notifiers:

echo '{"message":"Build complete","title":"Claude Code"}' | claude-notifier

Commands

Command Description
claude-notifier Read JSON from stdin, dispatch to all notifiers
claude-notifier init Create default config file
claude-notifier test Send a test notification to all notifiers
claude-notifier --version Print version

Flags

Flag Env Description
--config, -c CLAUDE_NOTIFIER_CONFIG Path to config file (default: ~/.config/claude-notifier/config.toml)

Plugins

Each plugin is configured under [[notifiers.<name>]] in the config file. Run claude-notifier init to generate a config with all plugins and their options documented.

Plugin Description
ntfy HTTP-based push notifications
terminal-notifier macOS desktop notifications

Want to add a plugin? See CONTRIBUTING.md.

Inspiration

  • Telegraf by InfluxData — plugin architecture, TOML config with [[section]] arrays, and the init() registry pattern
  • ntfy by Philipp C. Heckel — simple, self-hostable push notifications

License

MIT

About

Notification dispatcher for Claude Code hooks

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages