
हे ऑटोमेशन बिल्डर्स — अगर आप OpenClaw को टेलीग्राम से जोड़ रहे हैं और सोच रहे हैं कि जब मैसेज डीएम, ग्रुप्स, और टॉपिक्स से आने लगते हैं तो रूटिंग कैसे काम करती है, तो साथ बने रहें।
मैंने पिछले दो हफ्ते OpenClaw को तीन अलग-अलग सेटअप में टेलीग्राम के जरिए चलाया: व्यक्तिगत डीएम, टीम ग्रुप्स, और फोरम टॉपिक्स। डेमो परिदृश्य नहीं। वास्तविक रूटिंग परीक्षण जहां मैंने जानबूझकर सेशन आइसोलेशन को तोड़ा, इसे समवर्ती अनुरोधों से भर दिया, और देखा कि गेटवे ने मल्टी-अकाउंट कॉन्फ़िग्स को कैसे संभाला।
जिस प्रश्न पर मैं बार-बार वापस आया: क्या यह वास्तव में स्वच्छ सेशन बाउंड्रीज़ बनाए रख सकता है जब आप कई चैट्स को मैनेज कर रहे हों, या यह सब एक गंदे बातचीत थ्रेड में बदल जाता है?
यहाँ मैंने क्या पाया, साथ ही सटीक कॉन्फ़िग पैटर्न जो सफल रहे।
संदर्भ के लिए, OpenClaw (पहले Moltbot और Clawdbot) ने 2026 की शुरुआत में एक ओपन-सोर्स स्वायत्त AI सहायक के रूप में 100,000 से अधिक GitHub सितारे प्राप्त किए। इसे पीटर स्टीनबर्गर द्वारा बनाया गया था, यह मैसेजिंग प्लेटफार्म्स जैसे टेलीग्राम को AI एजेंट्स से जोड़ता है जो लोकली या निजी सर्वर पर चलते हैं।

Every OpenClaw Telegram setup starts with @BotFather, Telegram's official bot creation interface. This hasn't changed since Telegram launched bots — it's still the only way to generate API tokens.
What you'll need:

/start to see available commands/newbot
bot (e.g., YourProjectBot)123456789:ABCdefGHIjklMNOpqrsTUVwxyz/revoke in BotFather to generate a new oneCritical BotFather settings (optional but recommended):
/setjoingroups → Allow/deny adding bot to groups
/setprivacy → OFF = bot sees all group messages
ON = bot only sees mentions and commands
I learned this the hard way: if you set privacy to ON and wonder why your bot ignores group messages, that's why. OpenClaw's routing expects full message access by default.
Getting the token into OpenClaw is where most setup guides stop — but that's where real testing should start.
OpenClaw supports two token input methods:
Environment variable (quick testing):
export TELEGRAM_BOT_TOKEN="your_token_here"
openclaw gateway
Config file (production approach):
{
"channels": {
"telegram": {
"enabled": true,
"botToken": "123456789:ABCdefGHIjklMNOpqrsTUVwxyz",
"dmPolicy": "pairing"
}
}
}
Here's the sequence I run every time to confirm the Gateway actually sees Telegram updates:
openclaw gateway --log-level debug
/start to your bot in Telegram
dmPolicy: "pairing"openclaw logs --follow
Common failure point: Bot token typo. If you see 401 Unauthorized in logs, regenerate the token in BotFather and update your config. Don't waste an hour troubleshooting like I did.
सुरक्षा नोट: उत्पादन परिनियोजन के लिए, DigitalOcean के सख्त OpenClaw छवि का उपयोग करने पर विचार करें, जिसमें फायरवॉल नियम, कंटेनर अलगाव, और डिफ़ॉल्ट रूप से गैर-रूट निष्पादन शामिल है।

OpenClaw की कमांड प्रणाली वह जगह है जहां रूटिंग लॉजिक मायने रखता है। गेटवे सभी चैनलों में स्लैश कमांड को पहचानता है, लेकिन Telegram अपनी खुद की कमांड ऑटोकम्प्लीट लेयर जोड़ता है।
आधिकारिक OpenClaw रिपॉजिटरी में पूरा कमांड सेट प्रलेखित है, लेकिन वास्तविक दुनिया परीक्षण के बाद, केवल कुछ ही आवश्यक साबित होते हैं।
ये वे कमांड हैं जिनका मैं उत्पादन सेटअप में वास्तव में उपयोग करता हूँ (पूरा सूची नहीं — बस वही जो वास्तविक उपयोग में जीवित रहते हैं):
Important: /activation always only affects the current session. To persist it, add it to your config's requireMention settings.
This is what makes your bot feel native in Telegram:
/mybots → Select your bot → Edit Commandsnew - Start fresh sessionstatus - Check session statehelp - Show all commands
/ autocomplete menuReality check: I initially set up 15 commands. After two weeks, I only use 4. Start minimal.
For deeper understanding of Telegram's bot architecture, see the official Telegram Bot tutorial which covers the Bot API fundamentals.

This is where OpenClaw's session architecture either makes sense or falls apart. Session keys determine whether conversations stay isolated or bleed together.
OpenClaw generates session keys using this pattern:
agent:<agentId>:telegram:<chatType>:<chatId>[:topic:<topicId>]
Breakdown:
main sessiontelegram:group:<chatId>):topic:<threadId> suffix)Here's a real config I ran for testing three separate Telegram bots routing to different agents:
{
"channels": {
"telegram": {
"accounts": [
{
"name": "personal",
"botToken": "token1...",
"routing": { "agent": "main" }
},
{
"name": "work",
"botToken": "token2...",
"routing": { "agent": "work-agent" }
},
{
"name": "testing",
"botToken": "token3...",
"routing": { "agent": "sandbox" }
}
]
}
}
}
Each account routes to a separate agent workspace with independent memory and tools. No cross-contamination.
Default behavior: groups require @mention to trigger responses. Override per-group:
{
"channels": {
"telegram": {
"groups": {
"*": { "requireMention": true },
"-1001234567890": {
"requireMention": false
}
}
}
}
}
Group ID discovery: Add bot to group, send a message, check openclaw logs --follow for the chat.id value (always negative for groups).

Telegram forums add message_thread_id to messages. OpenClaw appends :topic:<threadId> to session keys automatically.
Critical edge case I hit: Topic ID 1 (general topic) requires special handling. OpenClaw omits message_thread_id when sending to topic 1 because Telegram rejects it.
Config example for per-topic system prompts:
{
"telegram": {
"groups": {
"-1003595003457": {
"requireMention": false,
"topics": {
"14": {
"requireMention": false,
"systemPrompt": "You are a coding assistant."
},
"27": {
"systemPrompt": "You focus on deployment issues."
}
}
}
}
}
}
Each topic maintains isolated conversation history.
When messages disappear into the void, it's usually one of these three culprits.
/mybots → Your Bot → Bot Settings → Group Privacy → OFF
openclaw logs --follow | grep "skipping group message"
channels.telegram.groups is defined, unlisted groups are ignored.openclaw logs --level debug --filter telegram
I run this sequence weekly to catch routing drift:
# List active sessions
openclaw sessions list
# Check specific session state
openclaw sessions show <sessionKey>
# Force session cleanup (last resort)
openclaw sessions prune --older-than 7d
When sessions leak: If you see context bleeding between chats, it's usually a config error where multiple chats map to the same session key. Review channels.telegram.accounts[].routing.agent settings.
After two weeks of daily use across three different Telegram setups, here's what survived:
{
"channels": {
"telegram": {
"enabled": true,
"botToken": "env:TELEGRAM_BOT_TOKEN",
"dmPolicy": "pairing",
"groups": {
"*": { "requireMention": true }
}
}
}
}
Why this works:
/new, /status, /help — Users forget themOpenClaw Telegram routing is solid for:
It gets messy when:
Security reminder: As noted in security analysis, OpenClaw stores session transcripts and credentials locally. Treat your ~/.openclaw directory as sensitive — use encrypted drives and restrict file permissions.
अगर OpenClaw + Telegram आपको वहाँ पहुँचाता है जहाँ आपको जाना है, तो इसके साथ चलें। बस सेशन कुंजियों को साफ रखें और जानें कि कौन से समूहों को कौन सा एजेंट मिलता है।
Macaron में, हम वही रूटिंग चुनौतियों को स्वचालित रूप से संभालते हैं — प्लेटफॉर्म्स के बीच सेशन अलगाव, जब आप चैनल जोड़ते हैं तो कोई मैनुअल कॉन्फ़िग पैचिंग नहीं। अगर आप बिना हर बार कॉन्फ़िग्स को पुनर्निर्माण किए मल्टी-प्लेटफॉर्म रूटिंग का परीक्षण करना चाहते हैं, इसे एक वास्तविक वर्कफ़्लो के साथ आज़माएँ और देखें यह आपके सेटअप को कैसे संभालता है।
सामान्य प्रश्न
प्रश्न: मेरा बॉट समूह संदेशों का बिल्कुल भी जवाब नहीं दे रहा। मुझे पहले कहाँ जाँच करनी चाहिए? BotFather प्राइवेसी सेटिंग्स। अगर यह ON पर सेट है, तो बॉट केवल सीधे @mentions देखता है — बाकी सब कुछ चुपचाप छोड़ दिया जाता है। BotFather → /mybots → Bot Settings → Group Privacy → इसे OFF पर कर दें। यह समूह सेटअप के लिए सबसे सामान्य "यह क्यों काम नहीं कर रहा" होता है।
प्रश्न: मैं अपने समूह का चैट ID कैसे ढूँढूँ? बॉट को समूह में जोड़ें, कोई भी संदेश भेजें, फिर openclaw logs --follow चलाएँ। इनकमिंग अपडेट में chat.id दिखाई देगा — समूहों के लिए यह एक नकारात्मक संख्या होगी। यही वह मूल्य है जिसे आप अपनी व्हाइटलिस्ट कॉन्फ़िग में डालते हैं।
प्रश्न: क्या मुझे प्रत्येक Telegram खाते के लिए एक अलग बॉट टोकन की आवश्यकता है जिसे मैं रूट कर रहा हूँ? हाँ। channels.telegram.accounts[] में प्रत्येक प्रविष्टि को अपना BotFather टोकन चाहिए। एक टोकन, एक बॉट पहचान। अगर आप कई बॉट चला रहे हैं और चीजें आपस में मिल रही हैं, तो OpenClaw गेटवे कॉन्फ़िग संदर्भ यह बताता है कि खाता-स्तरीय रूटिंग अलगाव वास्तव में कैसे काम करता है।
प्रश्न: फोरम विषय — क्या मुझे प्रत्येक को मैन्युअली कॉन्फ़िगर करना होगा? केवल तभी जब आप प्रति-विषय सिस्टम प्रॉम्प्ट चाहते हैं। OpenClaw सत्र कुंजी अलगाव को स्वचालित रूप से संभालता है (:topic:<threadId> प्रत्यय), इसलिए बातचीत बिना किसी कॉन्फ़िगरेशन के अलग रहती है। मैन्युअल सेटअप की आवश्यकता केवल तब होती है जब आप प्रति विषय भिन्न एजेंट व्यवहार चाहते हैं।
प्रश्न: गेटवे पुनरारंभ के बाद सत्र संदर्भ खो देते हैं। क्या यह अपेक्षित है? डिफ़ॉल्ट रूप से, हाँ — सत्र स्थिति पुनरारंभ के बाद जारी नहीं रहती जब तक कि आपने स्थायित्व को कॉन्फ़िगर नहीं किया हो। यदि यह आपके उपयोग के मामले के लिए समस्या है, तो गेटवे स्तर पर उपलब्ध स्थायित्व विकल्पों के लिए OpenClaw त्वरित प्रारंभ मार्गदर्शिका देखें।
प्रश्न: मैं इसे VPS पर सेट कर रहा हूँ। क्या कुछ टेलीग्राम-विशेष मुझे जानना चाहिए? सुनिश्चित करें कि आपके सर्वर की आउटबाउंड कनेक्शंस api.telegram.org पर अवरुद्ध नहीं हैं — कुछ सस्ते VPS प्रदाता इसे प्रतिबंधित करते हैं। इसके अलावा, सामान्य सुरक्षा उपाय लागू होते हैं: नॉन-रूट निष्पादन, फ़ायरवॉल नियम, एनव वेरिएबल्स में टोकन हार्डकोड नहीं। यदि आप शुरुआत से शुरू कर रहे हैं तो OpenClaw VPS परिनियोजन मार्गदर्शिका पूरी सेटअप को कवर करती है।
प्रश्न: मैंने टेलीग्राम के लिए Moltbot चलाया था। क्या माइग्रेशन सरल है? अधिकांशतः हाँ, लेकिन कॉन्फ़िगरेशन संरचना बदल गई है। यदि स्विचिंग के बाद संघर्ष या अप्रत्याशित व्यवहार हो तो Moltbot टेलीग्राम सेटअप तुलना देखना सार्थक है — यह दर्शाता है कि दोनों के बीच क्या बदला।