Reinventing.AI
AI Agent InsightsBy Reinventing.AI
OpenClaw Guides

Configure Telegram Threaded Chats (Groups + Topics) in OpenClaw

Run OpenClaw safely inside Telegram forum groups by controlling who can trigger it, which topics are enabled, and whether @mentions are required.

What This Setup Gives You

  • Enable OpenClaw in a Telegram group while restricting access to approved users
  • Configure behavior per topic (thread) inside forum-enabled groups
  • Control noise with requireMention
  • Route specific topics to a chosen agent using agentId

🔒 Privacy Note

The example below uses placeholder IDs only. Replace them with your own group ID, user IDs, and topic IDs.

Step 1: Create the Telegram Group, Topics, and Bot Access

A) Create (or choose) a Telegram group

  1. Create a new group in Telegram, or use an existing one
  2. If you want threaded conversations, make sure the group is forum-enabled (topics on)

B) Create your topics

  1. In the group, create the topics you want OpenClaw to work in
  2. Use clear topic names (for example: Ops, Content, Leads, Newsletter)

C) Add your Telegram bot to the group

  1. Add your OpenClaw Telegram bot account as a group member
  2. Confirm the bot can see messages in the topics you want to enable

D) Optional: grant admin permissions

If you want the bot to help with moderation or group actions, grant admin access. Keep permissions minimal and only enable what your workflows require.

  • Good default for most users: non-admin + message replies
  • Use admin only when you need management actions in Telegram
  • Typical admin permissions to consider: delete messages, pin messages, manage topics

Step 2: Gather IDs

A) Find your Telegram user ID

  1. In Telegram, search for IDBot
  2. Open the bot and start it
  3. Copy your numeric user ID

B) Find your forum group ID

  1. Use the same ID bot and open My Forums
  2. Select your target forum-enabled group
  3. Copy the numeric group ID (usually starts with -100...)

C) Find topic IDs

  1. Open each topic in the group
  2. Tap/click Share and copy the topic URL
  3. Use the number at the end of the URL as the topic ID

Step 3: Add Telegram Group + Topic Rules

Edit your OpenClaw config at ~/.openclaw/openclaw.jsonand add a groups section under Telegram.

{
  "channels": {
    "telegram": {
      "enabled": true,
      "token": "YOUR_BOT_TOKEN",
      "groups": {
        "-1001234567890": {
          "requireMention": true,
          "groupPolicy": "allowlist",
          "allowFrom": [
            "1111111111"
          ],
          "topics": {
            "2": {
              "requireMention": false,
              "groupPolicy": "allowlist",
              "allowFrom": [
                "1111111111"
              ],
              "agentId": "main"
            },
            "5": {
              "requireMention": false,
              "groupPolicy": "allowlist",
              "allowFrom": [
                "1111111111"
              ],
              "agentId": "main"
            },
            "7": {
              "requireMention": false,
              "groupPolicy": "allowlist",
              "allowFrom": [
                "1111111111"
              ],
              "agentId": "main"
            },
            "9": {
              "requireMention": false,
              "groupPolicy": "allowlist",
              "allowFrom": [
                "1111111111"
              ],
              "agentId": "main"
            }
          }
        }
      }
    }
  }
}

Step 4: Understand the Key Fields

requireMention

If true, users must mention your bot to trigger a reply in that scope. At topic-level you can override this and set it to false for a more conversational thread.

groupPolicy: allowlist

Restricts access to approved user IDs only. Combine this with allowFromto keep your group safe from random triggers.

topics

Each topic ID acts like a threaded lane with independent behavior. You can tune mention requirements and access per topic.

agentId

Routes that topic to a specific agent session (for example main). Useful when you want separate behaviors by topic.

Step 5: Restart and Test

After saving your config, restart the gateway:

openclaw gateway restart

Then test in order:

  1. Post in a configured topic from an allowlisted user ID
  2. Verify mention behavior matches your settings
  3. Post from a non-allowlisted account and confirm it is blocked
  4. Repeat for each topic ID to confirm routing and permissions

Troubleshooting

Bot does not reply in a topic

  • Confirm topic ID is correct from the share URL
  • Check if requireMention is enabled and mention the bot
  • Verify your user ID is included in allowFrom

Wrong group behavior

Double-check the group ID key in groups. A single digit mismatch means rules won't apply to that group.

Need status diagnostics

Use OpenClaw diagnostics:

openclaw status

Best Practices

  • Keep allowlist enabled for groups
  • Use per-topic rules to reduce accidental triggers
  • Start strict (requireMention: true) then relax only where needed
  • Document each topic's purpose so your team knows how to use it

Next Steps