Pages · Claude Notifications
/notify-channel — build a custom channel
Build a custom notification channel handler — Telegram, Microsoft Teams, Pushbullet, SMS via a non-Twilio provider, internal company chat, anything. Use when the user wants notifications somewhere the built-in channels don't support, or wants to fork an existing channel for a different API shape.
The dispatcher (scripts/notify.sh) auto-discovers channels in two locations:
${CLAUDE_PLUGIN_ROOT}/scripts/channels/<name>.sh— shipped with the plugin~/.claude-notifications/channels/<name>.sh— user-installed custom channels
Drop a script in #2 and it works. No registration step.
Template
bash
Rules to follow
- Never block Claude Code. Time-bound every network call; non-zero exits are swallowed by the dispatcher but slow handlers will block until the 5s timeout.
- Log instead of printing.
cn_log "..."writes to~/.claude-notifications/logs/notify.log. Stdout/stderr go to the same log file via the dispatcher. - Default-off behavior on missing config. If credentials are absent, log and exit 0 — don't error.
- Respect
level.CN_LEVELisinfo|warn|error|success. Map it to whatever color/severity the target API uses. - Make
enabled: falsean automatic skip. The dispatcher already does this — the channel won't be invoked unlesschannels.<name>.enabledistrue.
Common targets — where to point curl
| Service | Endpoint | Auth |
|---|---|---|
| Telegram | https://api.telegram.org/bot<TOKEN>/sendMessage | bot token in URL |
| MS Teams | Incoming Webhook URL from connector | none (URL is secret) |
| Pushbullet | https://api.pushbullet.com/v2/pushes | Access-Token header |
| Mattermost | Incoming Webhook URL | none |
| ntfy.sh (self) | https://your-ntfy/<topic> | optional bearer |
| Twitter/X DM | OAuth 1.0a — use a small Python helper, not bash | OAuth tokens |
After writing
chmod +x ~/.claude-notifications/channels/<name>.sh- Add the channel block to user config:
bash
- Test with the dispatcher:
bash
- Confirm with one line. Don't paste the script back at the user — they wrote it (or you wrote it for them and they can read it).