Telegram Topics Guide
Use Telegram forum topics to give each agent its own dedicated channel inside a single group.
Last updated: March 24, 2026 • Verified against OpenClaw 2026.3.22
Table of Contents
1. Why Topics?
Without topics, every message in a Telegram group goes to the same agent, in the same session. Conversations about client work, infrastructure, and strategy all blend together into one stream.
With Telegram forum topics, you can:
- Give each agent its own topic (SEO agent in one, dev agent in another)
- Give each client its own topic (Client A in one, Client B in another)
- Give each function its own topic (Strategy, Infrastructure, Agent Ops)
- Keep separate sessions per topic (memory and context don't bleed across)
Each topic gets its own session key, its own memory context, and optionally its own agent with its own workspace.
2. Step 1: Enable Topics in Telegram
- Open your Telegram group
- Tap the group name to open settings
- Go to Edit (pencil icon)
- Scroll down and enable Topics
- The group becomes a forum supergroup
Requirements
- The group must be a supergroup (Telegram auto-converts when you enable topics)
- Your bot must be an admin in the group
- Topics cannot be enabled in private chats, only in groups
After enabling, you'll see a "General" topic and can create new topics by tapping the topic list icon.
3. Step 2: Find Your Group and Topic IDs
OpenClaw needs numeric IDs, not names. Here's how to get them:
Group ID
# Use the directory command
openclaw directory resolve --channel telegram --name "Your Group Name"
Group IDs are negative numbers that start with -100, like -1001234567890.
Topic IDs
Topic IDs are the message_thread_id from Telegram. You can find them by:
- From the URL: Open the topic in Telegram Web. The URL contains the thread ID:
https://web.telegram.org/.../thread/5— the topic ID is5 - From bot messages: When your bot receives a message in a topic, the gateway log shows the
message_thread_id - General topic is always
1
Quick Tip
Send a test message to your bot in each topic. Then check the gateway logs:
openclaw logs | grep "message_thread_id"
The thread ID in the log is your topic ID.
4. Step 3: Configure OpenClaw
Add your group and topics to openclaw.json:
{
"channels": {
"telegram": {
"groups": {
"-1001234567890": {
"allowFrom": ["chat_id:123456789"],
"requireMention": true,
"topics": {
"1": {},
"5": {},
"6": {},
"7": {}
}
}
}
}
}
}
This registers topics 1 (General), 5, 6, and 7 in the group. Each gets its own session automatically.
| Setting | What It Does |
|---|---|
allowFrom | Who can interact with the bot in this group. Use chat_id:<id> format. |
requireMention | If true, bot only responds when @mentioned. If false, responds to every message. |
topics | Object where each key is a topic ID and each value is topic-specific config. |
5. Step 4: Route Different Agents to Different Topics
This is the power feature. Each topic can route to a different agent, with its own workspace, memory, model, and personality:
{
"channels": {
"telegram": {
"groups": {
"-1001234567890": {
"allowFrom": ["chat_id:123456789"],
"topics": {
"1": { "agentId": "main" },
"5": { "agentId": "seo-agent" },
"6": { "agentId": "dev-agent" },
"7": { "agentId": "content-agent" }
}
}
}
}
}
}
Now:
- General (topic 1) → main agent (orchestrator)
- SEO (topic 5) → seo-agent (search analysis)
- Dev (topic 6) → dev-agent (development)
- Content (topic 7) → content-agent (content writing)
What This Gives You
Each agent in its topic has:
- Its own session (conversations don't mix)
- Its own workspace (
~/.openclaw/workspace-seo-agent/, etc.) - Its own memory (MEMORY.md, daily notes)
- Its own SOUL.md (personality)
- Its own model (if configured per-agent)
Important
agentId is topic-only. It does NOT inherit from the group-level config. You must set it on each topic individually.
The agents referenced must already exist in your agents.list config.
6. Per-Topic Settings
Topics inherit group settings by default, but you can override per topic:
| Setting | Inherits from Group? | What It Does |
|---|---|---|
agentId | No (topic-only) | Route this topic to a specific agent |
requireMention | Yes | Override mention requirement for this topic |
allowFrom | Yes | Override who can interact in this topic |
enabled | Yes | Enable/disable bot in this topic |
skills | Yes | Override available skills for this topic |
systemPrompt | Yes | Add a custom system prompt for this topic |
groupPolicy | Yes | Override group interaction policy |
Example: Bot responds to every message in the dev topic (no @mention needed), but requires mention everywhere else:
{
"topics": {
"1": { "agentId": "main", "requireMention": true },
"6": { "agentId": "dev-agent", "requireMention": false }
}
}
7. How Session Keys Work
OpenClaw generates a unique session key for each topic. The format:
agent:<agentId>:telegram:group:<chatId>:topic:<threadId>
Examples:
agent:main:telegram:group:-1001234567890:topic:1— General topic, main agentagent:seo-agent:telegram:group:-1001234567890:topic:5— SEO topic, seo-agentagent:dev-agent:telegram:group:-1001234567890:topic:6— Dev topic, dev-agent
This means:
- Memory and context are isolated per topic
- Cron jobs can target a specific topic using the session key
- Session history is separate per topic
8. Advanced: ACP Sessions in Topics
You can bind a persistent ACP (Agent Control Protocol) session to a forum topic. This lets you have a persistent Codex or Claude Code session running inside a specific topic:
{
"agents": {
"list": [
{
"id": "codex-topic",
"runtime": {
"type": "acp",
"acp": {
"agent": "codex",
"backend": "acpx",
"mode": "persistent",
"cwd": "/path/to/project"
}
}
}
]
},
"bindings": [
{
"type": "acp",
"agentId": "codex-topic",
"match": {
"channel": "telegram",
"accountId": "default",
"peer": {
"kind": "group",
"id": "-1001234567890:topic:42"
}
}
}
]
}
Messages in topic 42 now route directly to a persistent Codex session.
You can also spawn ACP sessions on-the-fly in any topic:
/acp spawn codex --thread here
This requires channels.telegram.threadBindings.spawnAcpSessions: true in config.
9. Gotchas
General Topic (ID 1) Is Special
Telegram rejects sendMessage with message_thread_id=1. OpenClaw handles this automatically by omitting the thread ID for the General topic. But if you're debugging and see messages going to the wrong place, check if you're confusing General (1) with another topic.
Bots Can't See Other Bots
Telegram does not deliver bot messages to other bots. If you have two OpenClaw bots in the same group, they cannot see each other's messages. Use sessions_send for inter-agent communication instead of posting in the same topic.
Edited Messages Are Invisible
Telegram does not send edit events to bots. If a user edits a message in a topic, the bot never sees the edit. The original message stands.
Restart After Config Changes
Topic routing changes in openclaw.json require a gateway restart:
openclaw gateway restart
Creating Topics Programmatically
OpenClaw can create forum topics via the message tool:
openclaw message channel topic-create --chat-id "-1001234567890" --name "New Topic"
Optional: --icon-color and --icon-custom-emoji-id for styling.
10. Real-World Example
Here's a practical setup for a business with multiple specialist agents:
{
"channels": {
"telegram": {
"groups": {
"-1001234567890": {
"allowFrom": ["chat_id:123456789"],
"requireMention": true,
"topics": {
"1": {
"agentId": "main",
"requireMention": false
},
"5": {
"agentId": "seo-agent",
"systemPrompt": "You are in the Client A topic. Focus on this client."
},
"6": {
"agentId": "main"
},
"7": {
"agentId": "main"
},
"8": {
"agentId": "main"
}
}
}
}
}
}
}
This gives you:
| Topic | Agent | Purpose |
|---|---|---|
| General (1) | main | Day-to-day operations, no @mention needed |
| Client A (5) | seo-agent | Client-specific SEO work with custom context |
| Agent Ops (6) | main | Agent management and deployment |
| Strategy (7) | main | Planning and strategy discussions |
| Infra (8) | main | Infrastructure and system work |
Each topic has its own session, so conversations about Client A don't pollute the Strategy topic's context, and infrastructure debugging stays separate from client work.
True Webmaster — March 24, 2026
Verified against OpenClaw 2026.3.22