Setting up openclaw to have your AI agents talk (or roast each other) on Telegram.
Shared Snippet
I’ve been playing with OpenClaw for a week now, and the configuration file (openclaw.json) never ceases to surprise me. Today, I’m setting up two Main Agents so they can chat with each other in a Telegram group. Watching their interactions is honestly full of surprises.
Setup Instructions:
1. Launch OpenClaw
Run the command: moltbot gateway --verbose
2. Enter the Chat Room
Go to: http://127.0.0.1:18789/chat?session=agent%3Amain%3Amain
3. Command your Primary Agent
Talk to your current Main Agent (e.g., Ash):
“Ash, can you set up another Main Agent named ‘Xiaomin’? Also, please create a group on Telegram where you can chat with him.”
4. Observe the Automated Configuration
You will see the Primary Agent (Ash) begin modifying the openclaw.json config file. It will primarily add new entries to the Agents section:
[*JSON code *]
5. Create a new Telegram Bot
Create another bot on Telegram as usual, then paste the Bot Token to your Main Agent (Ash).
6. Automated Onboarding
Ash will then begin generating the openclaw.json details for Xiaomin and creating his personality files (such as soul.md, etc.).
7. Setting up the Telegram Group
Creating a group in Telegram is intuitive, but to get two OpenClaw Agents to talk to each other smoothly, there are a few “hidden settings” you must handle:
-
Step 1: Create the Base Group
-
Open Telegram and select “New Group.”
-
Add Members: You must invite at least one person or bot to create it. Tip: Directly search for and invite the two bots you created for OpenClaw.
-
Name the Group: (e.g., “OpenClaw Lab”).
-
-
Step 2: Critical Settings (For Agent Interaction)
-
Set Bots as Admins: Go to Group Settings -> Edit -> Administrators. Add both bots as admins and ensure they have “Send Messages” permissions.
-
Disable “Privacy Mode”: This is the most important part. If you don’t do this, they might be “blind” to each other.
-
Message @BotFather ->
/mybots-> Select your bot -> Bot Settings -> Group Privacy -> Click “Turn off.” -
Reason: If Privacy Mode is ON, bots only see messages that explicitly mention (@) them. Turning it off allows them to “listen” to the other bot’s dialogue.
-
-
-
Step 3: Get the Chat ID
-
Invite a helper bot like
@username_to_id_botto the group or forward a message to it to get the Group ID (usually starts with a dash, e.g.,-100123456789). -
Enter this ID into your OpenClaw
target_group_idor relevant config fields.
-
💡 Pro Tip: If your group is a Private Group, double-check that both bots are on the member list. If they aren’t responding, it’s almost always because the @BotFather Group Privacy hasn’t been turned off yet.
8. The Final Step
Tell your first Main Agent the Group Chat ID and instruct it to join the group along with Xiaomin.
9. Enjoy the Three-Way Conversation!
Here is a preview of these two adorable/clueless Agents chatting away:
