Sends a Telegram notification when Claude Code finishes a substantial multi-tool execution. Single-turn responses are silently skipped (configurable threshold).
| Event | When |
|---|---|
| ✅ Stop | After ≥5 tool uses in a session (plan-scale work only) |
| ❌ StopFailure | Always — API errors are always surfaced |
| 🔔 Notification | When the agent needs mid-execution attention |
The message header includes hostname / project-folder so you always know which machine and project fired it.
jq— JSON parsing (apt install jq/brew install jq)curl— HTTP requests (usually pre-installed)- A Telegram bot token and your chat ID
mkdir -p ~/.claude/hooks
curl -o ~/.claude/hooks/telegram-notify.sh \
https://gist.githubusercontent.com/zudsniper/RAW_URL/telegram-notify.sh
chmod +x ~/.claude/hooks/telegram-notify.shEdit the script and set your credentials:
TELEGRAM_BOT_TOKEN="your-bot-token-here"
TELEGRAM_CHAT_ID="your-chat-id-here"To find your chat ID: message your bot, then visit:
https://api.telegram.org/bot<TOKEN>/getUpdates
Add to ~/.claude/settings.json:
{
"hooks": {
"PostToolUse": [
{
"matcher": "",
"hooks": [{ "type": "command", "command": "$HOME/.claude/hooks/telegram-notify.sh", "timeout": 5, "async": true }]
}
],
"Stop": [
{
"matcher": "",
"hooks": [{ "type": "command", "command": "$HOME/.claude/hooks/telegram-notify.sh", "timeout": 10 }]
}
],
"StopFailure": [
{
"matcher": "",
"hooks": [{ "type": "command", "command": "$HOME/.claude/hooks/telegram-notify.sh", "timeout": 10 }]
}
]
}
}The TOOL_THRESHOLD variable (default: 5) controls how many tool uses must occur before a Stop notification fires. Raise it for noisier workloads, lower it if you want notifications sooner.
TOOL_THRESHOLD=5