Connecting a Telegram Bot to OpenClaw

SETUP GUIDE
Route OpenClaw agent notifications and responses through a private Telegram supergroup using Topics for clean per-bot threading.

Prerequisites
Item Details
Telegram account Active account with admin rights on a supergroup
Telegram supergroup A supergroup (not a basic group) — required for Topics
4–5 bots added Telegram requires at least 200 members (bots count) to unlock the Topics toggle — add 4–5 bots to reach this threshold quickly
SingIDBot @SingIDBot — a custom bot built by the author of this guide, used to retrieve the chat ID and topic thread ID. Responds in Singlish, so don't be surprised by the personality.
Your bot token Obtain from @BotFather via /newbot
OpenClaw running OpenClaw agent installed and accessible on your local machine
1  ·  Add 4–5 Bots to Unlock Topics

Telegram's Topics feature is only available in supergroups with 200 or more members. Bots count toward this threshold, making them the fastest way to unlock it.

In your supergroup, go to Add Members and search for any public bots. Add 4–5 bots (e.g. @gif, @pic, @vid, @bing, @wiki). Once the member count crosses 200, the Topics toggle will appear under Group Settings → Topics.

2  ·  Create a Topic for the Bot

With Topics enabled, create a dedicated topic for your OpenClaw bot to keep its messages isolated from other group activity.

Tap the pencil / new topic icon in your supergroup and give it a clear name such as:

OpenClaw-Bot

Note the topic thread ID — you will retrieve this precisely in Step 3 using SingIDBot.

3  ·  Get IDs from SingIDBot

SingIDBot (@SingIDBot) returns the exact numeric IDs that OpenClaw needs: the supergroup's chat ID and the topic's thread ID.

  1. Add @SingIDBot to your supergroup and grant it member access.
  2. Navigate into your OpenClaw-Bot topic (not the General topic) before sending the command.
  3. Inside the topic, send: /getids
  4. SingIDBot will reply with a block like this:
Chat ID     : -1001234567890
Thread ID : 42
User ID     : 987654321

Copy the Chat ID and Thread ID. You will pass them to OpenClaw in Step 4.

4  ·  Ask OpenClaw to Build the Config Tool

Rather than editing the .env file manually, ask the OpenClaw agent to write a Python tool that does it for you. Use this prompt in your OpenClaw chat interface:

Create a Python tool called update_telegram_config that accepts bot_token, chat_id, and topic_id as arguments and writes the values of TELEGRAM_BOT_TOKEN, TELEGRAM_CHAT_ID, and TELEGRAM_TOPIC_ID into the OpenClaw .env file.

OpenClaw will scaffold the tool, register it, and confirm it is ready to call. Proceed to Step 5 once the agent confirms the tool is available.

5  ·  Run the Tool and Reload OpenClaw

With the IDs from Step 3 in hand, instruct OpenClaw to run the tool using your actual values:

Run update_telegram_config with: bot_token = “YOUR_BOT_TOKEN_HERE” chat_id = “-1001234567890” topic_id = “42”

Replace the placeholder values with the token from @BotFather and the IDs from Step 3. After the tool executes, reload OpenClaw so the new environment variables are picked up:

# In your terminal (if running OpenClaw locally) Ctrl+C # stop the current process openclaw # restart
6  ·  Test the Setup

Verify the integration by asking OpenClaw to send a test message to the topic:

Send a test message to Telegram: “OpenClaw connected successfully.”

Check your OpenClaw-Bot topic in Telegram. The message should appear within a few seconds, threaded inside the correct topic rather than the General channel. If it does, the integration is complete.


SingIDBot Quick Reference

@SingIDBot is a custom Telegram bot built by the author of this guide. It does one job well: return the IDs you need for bot configuration. It also speaks Singlish, so expect replies like “Wah, your chat ID here lah” — perfectly normal, just read past the flavour text and grab your numbers.

Command What it returns Notes
/getids Chat ID, Thread ID (topic), and your User ID Must be run inside the target topic to get the correct Thread ID

Also tested on Hermes Agent: The same setup process works with the NousResearch Hermes Agent framework. The update_telegram_config tool and environment variable structure are identical — simply run the same steps with Hermes Agent in place of OpenClaw.
Your agent is now wired to a dedicated Telegram topic. Every notification, response, or alert it sends will land in the OpenClaw-Bot thread, keeping it separate from general group activity. To add more agents or tools later, repeat Steps 2–5 with a new topic and a new set of environment variable names.

✦ This article was generated with the assistance of Claude by Anthropic

Leave a comment