OpenClaw + Telegram Group Topics — Setup Guide

Separate your AI sessions into independent chat topics :sparkles:


:clipboard: What This Guide Covers

Telegram’s Group Topics feature (also called Forum mode) lets you divide a single group chat into multiple independent threads — each with its own name, message history, and isolated conversation. When your OpenClaw bot is set up correctly, each topic also gets its own isolated AI session, meaning the bot remembers completely separate conversations per topic.

This guide walks you through every step:

Step What you’ll do
:mobile_phone: Part 1 Enable Topics in your Telegram group
:card_index_dividers: Part 2 Create and name topics for different sessions
:id_button: Part 3 Find your group Chat ID and topic Thread IDs
:gear: Part 4 Configure OpenClaw for topic-based sessions

:warning: Before you begin: You need admin rights in your Telegram group and access to your OpenClaw configuration file (openclaw.config.js or equivalent YAML/JSON). Your bot must already be added to the group.


:brain: How It Works — The Big Picture

Normally, all messages in a Telegram group go to one shared chat. Everyone — including your bot — sees a single, tangled thread. Group Topics turns the group into a supergroup forum with separate thread panels, like channels inside a server.

OpenClaw tracks each topic by appending the topic thread ID to the session key. The internal session identifier looks like this:

agent:<AGENT_ID>:telegram:group:<CHAT_ID>:topic:<THREAD_ID>

Example:

agent:default:telegram:group:-1001234567890:topic:42

:white_check_mark: Takeaway: The bot keeps separate memory and context for Topic #42 vs Topic #78 in the same group — coding help, general chat, and project threads never interfere with each other.


:mobile_phone: Part 1 — Enable Forum/Topics in Your Telegram Group

Step-by-step on mobile (Android & iOS)

  1. :gear: Open your group’s settings
    Tap the group name at the top of the chat to open the group info page.

  2. :pencil: Tap the Edit (pencil) icon
    This opens the group editing screen.

  3. :thread: Find the Topics toggle
    Scroll to Permissions or Group Type and turn Topics (or Enable Topics) ON.

  4. :white_check_mark: Save changes
    Tap the checkmark or Done to save.

:pushpin: Note: After you enable Topics, existing messages move into a default “General” topic (Thread ID = 1). That topic is permanent and cannot be deleted.


:card_index_dividers: Part 2 — Create Topics for Different Sessions

Once Forum mode is on, you can create as many topics as you like. Each one becomes an independent AI session for your OpenClaw bot.

Creating a new topic

  • :pushpin: Tap or click Topics in the group header
  • :plus: Tap New Topic (or use + / the menu)
  • :label: Name it for its purpose — e.g. Code Review, Research, Project Alpha, General Q&A
  • :sparkles: Optionally add a cover emoji or description
  • :floppy_disk: Save — the topic is live

:light_bulb: Tip: Keep topic names short and descriptive — you’ll use them when tuning per-topic settings in OpenClaw.

Example topic structure

Topic Name Purpose Bot Behavior
General Casual chat & announcements Responds only when mentioned
Code Review Paste code for review/explanation Always responds, coding persona
Research Deep research & analysis Always responds, research persona
Project Alpha Project-specific planning Always responds, project context
Support Troubleshooting & help Always responds, support persona

:id_button: Part 3 — Find Your Group and Topic IDs

To configure OpenClaw you need two things:

You need What it is
:speech_balloon: Group Chat ID Identifies the group (usually a negative number)
:thread: Topic Thread ID Identifies which topic / thread the message is in

Finding your Group Chat ID

Telegram group/supergroup IDs are always negative, e.g. -1001234567890.

:robot: Use a helper bot

  • Add @userinfobot or @getidsbot to your group
  • Forward any group message to that bot in a private DM
  • The bot replies with the group chat ID
  • Remove the helper bot when you’re done

Finding a Topic’s Thread ID

:desktop_computer: From Telegram Desktop

  • Open the group and open the topic you care about
  • Right-click the first message in that topic
  • Choose Copy Message Link
  • Link shape: https://t.me/c/[group_id]/[topic_id]/[msg_id]
  • The middle number is your Thread ID

:pushpin: Remember: The General topic always has Thread ID = 1. For other topics, the Thread ID matches the message ID of the service message that created the topic.


:gear: Part 4 — Configure OpenClaw for Group Topics

Add your Chat ID and Topic Thread IDs to your OpenClaw config. Settings apply at the group level first; you can still override per topic when you need to.

Minimal working configuration

This is the simplest setup: the bot can work in your group and treat each topic as its own session automatically.

// openclaw.config.js

module.exports = {
  channels: {
    telegram: {
      enabled: true,
      botToken: process.env.TELEGRAM_BOT_TOKEN, // should ideally come from env
      groupPolicy: "allowlist",
      groupAllowFrom: ["826444"], // only your Telegram user ID can trigger it
      groups: {
        "-100375": {
          requireMention: false,
        },
      },
      streaming: "partial",
      mediaMaxMb: 50,
    },
  },
};

:light_bulb: Optional: You can ask OpenClaw to apply this setup — you don’t have to open or edit the config file by hand.

:white_check_mark: Even with this minimal config, OpenClaw isolates each topic’s session for you. No extra boilerplate — topic isolation is built in.


:speech_balloon: Questions?

If anything is unclear or you hit a snag, reply with your question — we can work through it together.