Skip to content

Instantly share code, notes, and snippets.

@knowsuchagency
Created April 6, 2026 04:01
Show Gist options
  • Select an option

  • Save knowsuchagency/7e153c276c73ab9c56c3828e32d8d969 to your computer and use it in GitHub Desktop.

Select an option

Save knowsuchagency/7e153c276c73ab9c56c3828e32d8d969 to your computer and use it in GitHub Desktop.
How to wire up the Claude Code Telegram plugin to a Telegram group chat

Wiring Up the Claude Code Telegram Plugin to a Group Chat

A step-by-step guide for connecting the Claude Code Telegram plugin to a Telegram group chat.

Prerequisites

  • Claude Code installed and running
  • The Telegram plugin installed (/install-plugin telegram or via the plugin marketplace)
  • A Telegram bot token from @BotFather

Step 1: Create a Bot & Configure Privacy

  1. Message @BotFather on Telegram and run /newbot
  2. Save the bot token
  3. Disable Group Privacy: /mybots → select your bot → Bot SettingsGroup PrivacyTurn off
    • By default, bots in groups only see /commands and @mentions. Disabling privacy lets the bot see all messages.

Step 2: Configure the Plugin

Run the Telegram access skill in Claude Code to set up your bot token:

/telegram:configure

Paste your bot token when prompted.

Step 3: Pair Your DM (Optional but Recommended)

DM your bot on Telegram. It will reply with a 6-character pairing code. Approve it in Claude Code:

/telegram:access pair <code>

Step 4: Add the Bot to Your Group

  1. Open your Telegram group
  2. Go to group settings → Add Members → search for your bot
  3. Add the bot to the group

Step 5: Get the Group Chat ID

This is the tricky part. The Telegram plugin's channel server consumes all updates via polling, so you can't just call getUpdates. Here's the workaround:

  1. Stop the channel server temporarily:

    # Find the process
    ps aux | grep telegram | grep -v grep
    # Kill it
    kill <PID>
  2. Send a message in the group (mention the bot: @yourbot hello)

  3. Fetch the group chat ID using the Bot API:

    curl -s "https://api.telegram.org/bot<TOKEN>/getUpdates" \
      | jq '.result[] | select(.message.chat.type == "group" or .message.chat.type == "supergroup") | .message.chat | {id, title}'
  4. The group ID will be a negative number (e.g., -5100294780). Save it.

  5. Restart the channel server — reload plugins in Claude Code:

    /reload-plugins
    

Step 6: Add the Group to the Access Config

In Claude Code, run:

/telegram:access group add <groupId>

For example:

/telegram:access group add -5100294780

By default, requireMention is true — the bot only responds when @mentioned. To let it see all messages:

/telegram:access group add -5100294780 --no-mention

Options

Flag Effect
(default) Bot only responds to @mentions in the group
--no-mention Bot sees and can respond to all messages
--allow id1,id2 Restrict which group members can interact with the bot

Step 7: Test It

Send a message in the group. If requireMention is enabled, mention the bot:

@yourbot hello

The bot should respond in the group chat.

Access Config Reference

The config lives at ~/.claude/channels/telegram/access.json:

{
  "dmPolicy": "pairing",
  "allowFrom": ["<userId1>", "<userId2>"],
  "groups": {
    "-5100294780": {
      "requireMention": false,
      "allowFrom": []
    }
  },
  "pending": {}
}

Troubleshooting

  • Bot doesn't see group messages: Make sure Group Privacy is disabled in BotFather
  • getUpdates returns empty: The channel server is consuming updates — stop it first (Step 5)
  • Bot sees messages but doesn't reply: Check that the group ID is in access.json under groups
  • "Typing" indicator but no reply: The MCP connection may need a refresh — run /reload-plugins

Tips

  • The bot uses judgment on when to reply in group chats — it doesn't need to respond to every message
  • You can react to messages with emoji instead of sending full replies
  • DM access and group access are configured independently
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment