claude-telegram-notifier
v1.1.1
Published
Telegram notifications for Claude Code - get notified when Claude needs input and reply directly from Telegram
Maintainers
Readme
Claude Telegram Notifier
Get Telegram notifications when Claude Code needs your input, and reply directly from Telegram.
Features
- Notifications: Receive Telegram messages when Claude Code asks a question
- Reply from Telegram: Send responses directly from Telegram to your Claude Code session
- Auto-detection: Automatically finds your Claude Code tmux session
- Cross-platform: Works on Linux (systemd) and macOS (launchd)
Prerequisites
- Node.js 18+
- tmux (for receiving Telegram replies in Claude Code)
- curl, jq (for shell scripts)
- A Telegram bot (create one via @BotFather)
Installation
npm
npm install -g claude-telegram-notifierFrom source
git clone https://github.com/yourusername/claude-telegram-notifier.git
cd claude-telegram-notifier
npm install
npm linkQuick Start
Run the setup wizard:
claude-telegram-notifier setupStart Claude Code in tmux:
tmux new-session -s claude claudeThat's it! When Claude asks a question, you'll get a Telegram notification.
Commands
| Command | Description |
|---------|-------------|
| setup | Interactive setup wizard |
| status | Show configuration and poller status |
| start-poller | Start the Telegram polling daemon |
| stop-poller | Stop the Telegram polling daemon |
| enable-service | Enable auto-start on login |
| disable-service | Disable auto-start |
| install-hooks | Install Claude Code hooks |
| uninstall-hooks | Remove Claude Code hooks |
| test | Send a test notification |
Configuration
Configuration is stored in ~/.config/claude-telegram-notifier/config.json:
{
"telegramToken": "your-bot-token",
"telegramChatId": "your-chat-id",
"tmuxTarget": "",
"pollInterval": 2
}Environment Variables
Environment variables override the config file:
| Variable | Description |
|----------|-------------|
| TELEGRAM_TOKEN | Telegram bot token |
| TELEGRAM_CHAT_ID | Your Telegram chat ID |
| TMUX_TARGET | Tmux target (e.g., main:0.0) |
| POLL_INTERVAL | Polling interval in seconds (default: 2) |
How It Works
Claude Code hooks: When Claude Code calls
AskUserQuestion, a hook runstelegram-notify.shwhich sends you a Telegram message.Telegram poller: The
telegram-poller.shscript polls Telegram for replies and injects them into your tmux session running Claude Code.
Architecture
┌─────────────────┐ ┌──────────────────┐ ┌─────────────┐
│ Claude Code │────>│ telegram-notify │────>│ Telegram │
│ (in tmux) │ │ (hook) │ │ Bot │
└─────────────────┘ └──────────────────┘ └─────────────┘
▲ │
│ │
│ ┌──────────────────┐ │
└───────────│ telegram-poller │<──────────────┘
│ (daemon) │
└──────────────────┘Getting Your Telegram Credentials
Bot Token
- Open Telegram and search for @BotFather
- Send
/newbotand follow the instructions - Copy the bot token provided
Chat ID
- Start a chat with your new bot
- Send any message to the bot
- Visit
https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates - Find
"chat":{"id":123456789}in the response
Or simply message @userinfobot and it will tell you your ID.
Troubleshooting
Poller not detecting tmux session
Set the tmux target explicitly:
# In config file
{
"tmuxTarget": "claude:0.0"
}
# Or via environment
export TMUX_TARGET="claude:0.0"Notifications not sending
- Check configuration:
claude-telegram-notifier status - Test connection:
claude-telegram-notifier test - Verify hooks are installed: Check
~/.claude/settings.json
Replies not reaching Claude
- Ensure Claude Code is running in tmux
- Check poller is running:
claude-telegram-notifier status - Check poller logs:
journalctl --user -u claude-telegram-poller -f
License
MIT
