Skip to content

Repository files navigation

Claude Bot

Remote control for Claude Code via Telegram. Handle permission prompts and idle states from your phone.

Architecture

┌─────────────────┐     ┌──────────────────┐     ┌─────────────────┐
│  Claude Code    │────▶│  Telegram Bot    │────▶│  Your Phone     │
│  (in tmux)      │◀────│  (on your Mac)   │◀────│  (click button) │
└─────────────────┘     └──────────────────┘     └─────────────────┘

Setup

1. Create Telegram Bot

  1. Message @BotFather
  2. Send /newbot, follow prompts
  3. Save the bot token

2. Get Your Chat ID

Send any message to your bot, then:

curl "https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates"

Find "chat":{"id": YOUR_CHAT_ID} in the response.

3. Configure

cp .env.example .env
# Edit .env with your values

4. Install & Run

pnpm install
pnpm dev   # Development with hot reload

5. Run Claude in tmux

Add to ~/.zshrc:

alias cc='tmux new-session -A -s claude -c "$(pwd)" claude'

Now cc command automatically runs Claude Code in tmux.

Usage

Bot Commands

Command Action
/y Approve (send "y" + Enter)
/n Deny (send "n" + Enter)
/ping Check if bot is running
Any text Send as input to terminal

Inline Buttons

When receiving a permission request, tap:

  • Approve - sends y + Enter
  • Deny - sends n + Enter
  • Skip - sends s + Enter
  • Escape - sends Escape key

Send from Claude Code Hook

# In your hook script
pnpm --prefix /path/to/claude-bot send "Permission required: $MESSAGE"

Integration with Claude Code Hooks

Update ~/.claude/settings.json to trigger notifications:

{
  "hooks": {
    "PermissionRequest": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "pnpm --prefix /path/to/claude-bot send \"Claude needs permission\""
          }
        ]
      }
    ]
  }
}

Scripts

Script Description
pnpm dev Run with hot reload
pnpm build Compile TypeScript
pnpm start Run compiled version
pnpm send Send message with buttons

About

Remote control for Claude Code via Telegram

Resources

Stars

1 star

Watchers

0 watching

Forks

Contributors

Languages