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
- Create a new group in Telegram, or use an existing one
- If you want threaded conversations, make sure the group is forum-enabled (topics on)
B) Create your topics
- In the group, create the topics you want OpenClaw to work in
- Use clear topic names (for example: Ops, Content, Leads, Newsletter)
C) Add your Telegram bot to the group
- Add your OpenClaw Telegram bot account as a group member
- 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
- In Telegram, search for IDBot
- Open the bot and start it
- Copy your numeric user ID
B) Find your forum group ID
- Use the same ID bot and open My Forums
- Select your target forum-enabled group
- Copy the numeric group ID (usually starts with
-100...)
C) Find topic IDs
- Open each topic in the group
- Tap/click Share and copy the topic URL
- 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 restartThen test in order:
- Post in a configured topic from an allowlisted user ID
- Verify mention behavior matches your settings
- Post from a non-allowlisted account and confirm it is blocked
- 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
requireMentionis 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 statusBest Practices
- Keep
allowlistenabled 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
