Get real-time Telegram notifications when Claude Code performs actions in your projects.
- Message @BotFather on Telegram
- Send
/newbotand follow prompts - Save the bot token (looks like:
1234567890:ABCdefGHI...)
Option A: Message @userinfobot → Get your ID
Option B:
- Message your new bot
- Visit:
https://api.telegram.org/botYOUR_TOKEN/getUpdates - Find
"chat":{"id":YOUR_ID}
# Clone repo
git clone https://github.com/yourusername/claud-code-telegram-notify-hook.git
cd claud-code-telegram-notify-hook
# Set environment variables
export CC_HOOK_TELEGRAM_BOT_TOKEN="your_bot_token"
export CC_HOOK_TELEGRAM_CHAT_ID="your_chat_id"
# Build the Go binary (optional - pre-built binary included)
cd .claude/hooks
./build.sh
# Install hooks
cp -r .claude ~/.claudecurl -X POST "https://api.telegram.org/botYOUR_TOKEN/sendMessage" \
-d "chat_id=YOUR_CHAT_ID" \
-d "text=Test message"Claude Code triggers hooks → Go binary reads event → Sends formatted message to Telegram
Message Format:
🤖 Project: `my-project`
⏰ 2024-01-20 15:30:45
✅ Event: `Notification`
📌 Stop Hook Active: `false`
Notification- General Claude Code notificationsStop- Operation completionSubagentStop- Sub-agent task completion
- Go 1.20+ (for building from source)
- Or use the pre-built binary included
| Issue | Solution |
|---|---|
| No notifications | Check token/ID, ensure bot conversation started |
| Token errors | Copy token exactly, it's case-sensitive |
| Permission denied | Run chmod +x ~/.claude/hooks/notification-bin |
| Group chats | Use negative chat ID (e.g., -1001234567890) |
| Build fails | Ensure Go 1.20+ installed, run go mod tidy |
- Never commit tokens to git
- Add
.envto.gitignore - Rotate tokens with BotFather's
/revokeif compromised
MIT