All posts
Setting Up OpenClaw in Telegram Group Chats: Configuration, Permissions, and Multi-Agent

Setting Up OpenClaw in Telegram Group Chats: Configuration, Permissions, and Multi-Agent

|6 min read

Setting Up OpenClaw in Telegram Group Chats: Configuration, Permissions, and Multi-Agent

OpenClaw supports Telegram as a first-class messaging interface. While one-on-one bot conversations are straightforward, group chats introduce challenges around message routing, mention detection, spam prevention, and multi-agent coordination. This guide covers the full lifecycle of running OpenClaw bots in Telegram groups.

Prerequisites

  • A working OpenClaw installation (version 0.9+)
  • A Telegram bot token from BotFather[1]
  • The bot already configured for direct messages in openclaw.json
  • Admin access to the target Telegram group

If you have not set up Telegram at all, start with openclaw pairing approve telegram <CODE>.

Creating a Bot with BotFather

  1. Search for @BotFather in Telegram and send /newbot
  2. Choose a display name and username (must end in bot)
  3. Copy the token: 7123456789:AAHxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Adding the Bot to a Group

From group settings: Open group info, tap "Add Members", search for your bot.

From bot profile: Open the bot chat, tap its name, tap "Add to Group", select the target group.

Discovering the Group Chat ID

Telegram group IDs are negative numbers not shown in the UI. OpenClaw needs this ID for configuration.

Method 1: Check gateway logs. Send any message in the group, then:

sudo journalctl -u openclaw.service -n 100 --no-pager | grep "chat"

Look for: [gateway] incoming message from chat_id: -1001234567890

Method 2: Query the Telegram API directly. If OpenClaw is polling, getUpdates may return empty results because messages are already consumed[2]. Stop OpenClaw first:

openclaw stop
# Send a message in the group, then:
curl -s "https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates" | python3 -m json.tool

Method 3: Forward a group message to @getidsbot or @userinfobot.

Group ID Formats

Group Type ID Format Example
Regular group Negative -123456789
Supergroup Starts with -100 -1001234567890

Groups auto-upgrade to supergroups (and get new IDs) when reaching a certain size. Always use the current supergroup ID.

Configuring openclaw.json for Groups

{
  "telegram": {
    "token": "7123456789:AAHxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "groups": {
      "-1001234567890": {
        "enabled": true,
        "groupPolicy": "closed",
        "requireMention": true,
        "responseStyle": "concise",
        "allowedCommands": ["ask", "summarize", "translate"],
        "cooldown": 5
      }
    }
  }
}

groupPolicy

  • open: Anyone in the group can interact. For small, trusted groups.
  • closed: Only registered OpenClaw users can interact. Prevents outsiders from consuming API credits.
  • admin-only: Only Telegram group admins can interact.

requireMention

When true, the bot only responds to messages containing @yourbotname. This is almost always what you want in groups -- without it, the bot tries to respond to every message, draining API credits and spamming the chat.

responseStyle

  • concise: 1-3 sentences, best for group flow
  • standard: Normal length, like direct messages
  • detailed: Longer responses with more context

cooldown

Minimum seconds between responses. If three @bot messages arrive within 5 seconds, only the first gets a reply.

@Mention Behavior

The bot recognizes several mention formats:

@openclaw_bot what is the weather?        # Standard mention
@openclaw_bot, summarize this thread      # Mention with comma
Reply to bot message: "tell me more"      # Reply counts as mention

Mentions can appear anywhere in the message. OpenClaw strips the mention text before sending to the LLM.

Reply-based context: Replying to a bot message counts as a continuation, enabling natural multi-turn conversations without repeated @mentions.

Multiple Agents in One Group

Run multiple OpenClaw agents (separate instances with separate bot tokens) in the same group. Each has its own personality, skills, and knowledge base.

{
  "telegram": { "token": "TOKEN_1", "groups": { "-1001234567890": { "enabled": true, "requireMention": true } } },
  "agent": { "name": "Research", "personality": "You are a research assistant..." }
}
{
  "telegram": { "token": "TOKEN_2", "groups": { "-1001234567890": { "enabled": true, "requireMention": true } } },
  "agent": { "name": "CodeReview", "personality": "You are a code reviewer..." }
}

Lobstalk Skill for Inter-Agent Communication

openclaw skills install lobstalk

With lobstalk, agents can see and reference each other's messages:

User:        @research_bot find papers on transformer attention
Research:    Here are 3 relevant papers...
User:        @codereview_bot look at Research's summary and find implementations
CodeReview:  Based on Research's findings...

Coordination patterns: Sequential pipeline (A's output feeds B), parallel consultation (same question to multiple agents), or specialist routing (a router agent delegates).

Privacy Mode in BotFather

Telegram bots have a privacy mode that controls what messages they receive in groups[3].

Enabled (default): Bot only receives @mentions, replies to its messages, /commands, and service messages. This aligns with requireMention: true.

Disabled: Bot receives every message. To toggle:

  1. Open BotFather, send /mybots
  2. Select bot > Bot Settings > Group Privacy > Disable

Only disable if the bot needs full conversation awareness. This increases traffic to your OpenClaw instance even with requireMention: true.

Preventing Spam in Busy Groups

Rate limiting with cooldown:

{ "cooldown": 15 }

Message length filters:

{ "messageFilters": { "minLength": 10, "maxLength": 2000, "ignoreForwarded": true } }

Quiet hours:

{ "quietHours": { "enabled": true, "start": "23:00", "end": "07:00", "timezone": "UTC" } }

Block specific users:

{ "groups": { "-1001234567890": { "blockedUsers": [123456789] } } }

Per-Group Customization

Each group gets independent configuration, including separate system prompts:

{
  "telegram": {
    "token": "YOUR_TOKEN",
    "groups": {
      "-1001234567890": {
        "enabled": true,
        "groupPolicy": "open",
        "requireMention": true,
        "systemPrompt": "You are a DevOps assistant. Focus on Docker, Kubernetes, and CI/CD."
      },
      "-1009876543210": {
        "enabled": true,
        "groupPolicy": "closed",
        "systemPrompt": "You are a data science assistant. Focus on Python, pandas, and ML."
      }
    }
  }
}

Group Admin Commands

/status    - Bot status and uptime
/config    - Current group configuration (sanitized)
/pause     - Stop responding in this group
/resume    - Resume responding
/clear     - Clear conversation context
/stats     - Usage statistics

Define custom commands that map to skills:

{
  "commands": {
    "summarize": { "skill": "text-summarizer", "description": "Summarize last N messages" },
    "translate": { "skill": "translator", "description": "Translate text" }
  }
}

Troubleshooting

Bot does not respond: Check privacy mode, group ID, groupPolicy, requireMention setting, and logs (journalctl -u openclaw -f).

Bot responds to everything: Set requireMention: true, enable privacy mode in BotFather, increase cooldown.

Duplicate responses: Multiple instances polling the same token. Ensure one token per instance.

Context window exhaustion:

{ "groups": { "-1001234567890": { "maxContextMessages": 50, "contextWindow": "sliding" } } }

Managed Alternative

For teams that want group chat bots without infrastructure management, ClawTank supports Telegram group integrations through a web dashboard, eliminating manual JSON editing and log parsing.

Summary

The key configuration decisions for Telegram group integration are:

  1. Group policy (open/closed/admin-only) to control access
  2. Require mention to prevent responding to every message
  3. Cooldown and filters to manage API costs
  4. Per-group system prompts to tailor behavior
  5. Privacy mode in BotFather to control message visibility

With these settings tuned correctly, OpenClaw bots participate naturally in group conversations without being disruptive.

References

  1. BotFather - Telegram Bot API
  2. Telegram Bot API - getUpdates
  3. Telegram Bot API - Privacy Mode

Ready to deploy OpenClaw?

No Docker, no SSH, no DevOps. Deploy in under 1 minute.

Get started free