Telegram (Bot API)
स्थिति: grammY के माध्यम से बॉट DMs + ग्रुप्स के लिए प्रोडक्शन-रेडी। डिफ़ॉल्ट रूप से लॉन्ग-पोलिंग; वेबहुक वैकल्पिक।त्वरित सेटअप (शुरुआती)
- @BotFather के साथ एक बॉट बनाएं (डायरेक्ट लिंक)। पुष्टि करें कि हैंडल बिल्कुल
@BotFatherहै, फिर टोकन कॉपी करें। - टोकन सेट करें:
- Env:
TELEGRAM_BOT_TOKEN=... - या config:
channels.telegram.botToken: "..."। - यदि दोनों सेट हैं, तो config को प्राथमिकता मिलेगी (env fallback केवल default-account के लिए है)।
- Env:
- Gateway प्रारंभ करें।
- DM एक्सेस डिफ़ॉल्ट रूप से pairing है; पहली बार संपर्क पर pairing कोड को अनुमोदित करें।
यह क्या है
- Gateway के स्वामित्व वाला Telegram Bot API चैनल।
- Deterministic routing: उत्तर वापस Telegram पर जाते हैं; मॉडल कभी चैनल नहीं चुनता।
- DMs एजेंट के मुख्य सत्र को साझा करते हैं; समूह अलग-थलग रहते हैं (
agent:<agentId>:telegram:group:<chatId>)।
सेटअप (त्वरित मार्ग)
1. बॉट टोकन बनाएँ (BotFather)
- Telegram खोलें और @BotFather से चैट करें (डायरेक्ट लिंक)। पुष्टि करें कि हैंडल बिल्कुल
@BotFatherहै। /newbotचलाएँ, फिर प्रॉम्प्ट्स का पालन करें (नाम + उपयोगकर्ता नाम जोbotपर समाप्त होता हो)।- टोकन कॉपी करें और सुरक्षित रखें।
/setjoingroups— बॉट को समूहों में जोड़ने की अनुमति/अस्वीकृति।/setprivacy— नियंत्रित करें कि बॉट सभी समूह संदेश देखे या नहीं।
2. टोकन कॉन्फ़िगर करें (env या config)
उदाहरण:TELEGRAM_BOT_TOKEN=... (डिफ़ॉल्ट अकाउंट के लिए काम करता है)।
यदि env और config दोनों सेट हैं, तो config को प्राथमिकता मिलेगी।
मल्टी-अकाउंट समर्थन: प्रति-अकाउंट टोकन और वैकल्पिक name के साथ channels.telegram.accounts का उपयोग करें। शेयर्ड पैटर्न के लिए gateway/configuration देखें।
- Gateway प्रारंभ करें। टोकन रेज़ॉल्व होने पर Telegram शुरू होता है (पहले कॉन्फ़िग, फिर env फ़ॉलबैक)।
- DM एक्सेस डिफ़ॉल्ट रूप से पेयरिंग पर सेट होता है। जब बॉट से पहली बार संपर्क किया जाए, तो कोड को स्वीकृत करें।
- समूहों के लिए: बॉट जोड़ें, privacy/admin व्यवहार तय करें (नीचे), फिर mention gating + allowlists नियंत्रित करने के लिए
channels.telegram.groupsसेट करें।
Token + privacy + permissions (Telegram पक्ष)
टोकन निर्माण (BotFather)
/newbotबॉट बनाता है और टोकन लौटाता है (इसे गोपनीय रखें)।- यदि टोकन लीक हो जाए, तो @BotFather के माध्यम से इसे revoke/regenerate करें और अपना config अपडेट करें।
समूह संदेश दृश्यता (Privacy Mode)
Telegram बॉट्स डिफ़ॉल्ट रूप से Privacy Mode में होते हैं, जो यह सीमित करता है कि वे कौन से ग्रुप संदेश प्राप्त करते हैं। यदि आपके बॉट को सभी ग्रुप संदेश देखने हों, तो आपके पास दो विकल्प हैं:/setprivacyसे privacy mode अक्षम करें या- बॉट को समूह admin के रूप में जोड़ें (admin बॉट सभी संदेश प्राप्त करते हैं)।
समूह अनुमतियाँ (admin अधिकार)
एडमिन स्टेटस ग्रुप के अंदर (Telegram UI) सेट किया जाता है। एडमिन बॉट्स हमेशा सभी ग्रुप संदेश प्राप्त करते हैं, इसलिए यदि आपको पूर्ण दृश्यता चाहिए तो एडमिन का उपयोग करें।यह कैसे काम करता है (व्यवहार)
- इनबाउंड संदेश reply context और media placeholders के साथ साझा चैनल envelope में normalize किए जाते हैं।
- समूह उत्तरों के लिए डिफ़ॉल्ट रूप से mention आवश्यक है (native @mention या
agents.list[].groupChat.mentionPatterns/messages.groupChat.mentionPatterns)। - Multi-agent override:
agents.list[].groupChat.mentionPatternsपर प्रति-एजेंट पैटर्न सेट करें। - उत्तर हमेशा उसी Telegram चैट पर वापस रूट होते हैं।
- Long-polling grammY runner का उपयोग प्रति-चैट sequencing के साथ करता है; समग्र concurrency
agents.defaults.maxConcurrentद्वारा सीमित है। - Telegram Bot API read receipts का समर्थन नहीं करता; कोई
sendReadReceiptsविकल्प नहीं है।
Draft streaming
OpenClawsendMessageDraft का उपयोग करके Telegram DMs में आंशिक उत्तर स्ट्रीम कर सकता है।
आवश्यकताएँ:
- @BotFather में बॉट के लिए Threaded Mode सक्षम (forum topic mode)।
- केवल private chat threads (Telegram इनबाउंड संदेशों पर
message_thread_idशामिल करता है)। channels.telegram.streamModeको"off"पर सेट न किया गया हो (डिफ़ॉल्ट:"partial","block"chunked draft updates सक्षम करता है)।
Formatting (Telegram HTML)
- आउटबाउंड Telegram टेक्स्ट
parse_mode: "HTML"(Telegram द्वारा समर्थित टैग उपसमुच्चय) का उपयोग करता है। - Markdown-जैसा इनपुट Telegram-safe HTML (bold/italic/strike/code/links) में रेंडर होता है; block elements को newlines/bullets के साथ टेक्स्ट में flatten किया जाता है।
- मॉडलों से आने वाला raw HTML Telegram parse त्रुटियों से बचने के लिए escaped किया जाता है।
- यदि Telegram HTML payload अस्वीकार करता है, तो OpenClaw वही संदेश plain text के रूप में पुनः प्रयास करता है।
Commands (native + custom)
OpenClaw स्टार्टअप पर Telegram के बॉट मेनू के साथ नेटिव कमांड (जैसे/status, /reset, /model) रजिस्टर करता है।
आप कॉन्फ़िग के माध्यम से मेनू में कस्टम कमांड जोड़ सकते हैं:
सेटअप समस्या-निवारण (commands)
- लॉग्स में
setMyCommands failedआमतौर पर यह दर्शाता है किapi.telegram.orgके लिए outbound HTTPS/DNS अवरुद्ध है। - यदि
sendMessageयाsendChatActionविफलताएँ दिखें, तो IPv6 routing और DNS जाँचें।
- Custom commands केवल menu entries हैं; OpenClaw उन्हें तब तक लागू नहीं करता जब तक आप उन्हें कहीं और हैंडल न करें।
- Some commands can be handled by plugins/skills without being registered in Telegram’s command menu. These still work when typed (they just won’t show up in
/commands/ the menu). - Command नाम normalize किए जाते हैं (leading
/हटाया जाता है, lowercased) औरa-z,0-9,_(1–32 chars) से मेल खाने चाहिए। - कस्टम कमांड नेटिव कमांड को ओवरराइड नहीं कर सकते। कॉन्फ्लिक्ट्स को अनदेखा किया जाता है और लॉग किया जाता है।
- यदि
commands.nativeअक्षम है, तो केवल custom commands रजिस्टर किए जाते हैं (या यदि कोई नहीं, तो साफ़ कर दिए जाते हैं)।
Device pairing commands (device-pair plugin)
If the device-pair plugin is installed, it adds a Telegram-first flow for pairing a new phone:
/pairgenerates a setup code (sent as a separate message for easy copy/paste).- Paste the setup code in the iOS app to connect.
/pair approveapproves the latest pending device request.
Limits
- आउटबाउंड टेक्स्ट
channels.telegram.textChunkLimitतक chunk किया जाता है (डिफ़ॉल्ट 4000)। - वैकल्पिक newline chunking: लंबाई chunking से पहले blank lines (paragraph boundaries) पर विभाजित करने के लिए
channels.telegram.chunkMode="newline"सेट करें। - Media downloads/uploads
channels.telegram.mediaMaxMbद्वारा सीमित हैं (डिफ़ॉल्ट 5)। - Telegram Bot API रिक्वेस्ट्स
channels.telegram.timeoutSeconds(grammY के माध्यम से डिफ़ॉल्ट 500) के बाद टाइम आउट हो जाती हैं। लंबे हैंग से बचने के लिए कम मान सेट करें। - ग्रुप हिस्ट्री कॉन्टेक्स्ट
channels.telegram.historyLimit(याchannels.telegram.accounts.*.historyLimit) का उपयोग करता है, औरmessages.groupChat.historyLimitपर फ़ॉलबैक करता है। अक्षम करने के लिए0सेट करें (डिफ़ॉल्ट 50)। - DM हिस्ट्री को
channels.telegram.dmHistoryLimit(यूज़र टर्न्स) के साथ सीमित किया जा सकता है। प्रति-यूज़र ओवरराइड्स:channels.telegram.dms["<user_id>"].historyLimit।
Group activation modes
डिफ़ॉल्ट रूप से, बॉट ग्रुप्स में केवल मेंशन पर ही प्रतिक्रिया देता है (@botname या agents.list[].groupChat.mentionPatterns में पैटर्न)। इस व्यवहार को बदलने के लिए:
Config के माध्यम से (अनुशंसित)
channels.telegram.groups सेट करने से एक allowlist बनती है — केवल सूचीबद्ध ग्रुप्स (या "*") ही स्वीकार किए जाएंगे।
फ़ोरम टॉपिक्स अपने पैरेंट ग्रुप कॉन्फ़िग (allowFrom, requireMention, skills, prompts) को इनहेरिट करते हैं, जब तक कि आप channels.telegram.groups.<groupId> के तहत प्रति-टॉपिक ओवरराइड्स न जोड़ें।1. .topics.<topicId>`.
सभी समूहों को always-respond के साथ अनुमति देने के लिए:
Command के माध्यम से (session-level)
समूह में भेजें:/activation always- सभी संदेशों पर प्रतिक्रिया दें/activation mention- mentions आवश्यक (डिफ़ॉल्ट)
Group chat ID प्राप्त करना
किसी भी समूह संदेश को@userinfobot या @getidsbot पर forward करें ताकि chat ID (जैसे -1001234567890 जैसी नकारात्मक संख्या) दिखाई दे।
Tip: अपने user ID के लिए, बॉट को DM करें और यह आपके user ID (pairing संदेश) के साथ उत्तर देगा, या commands सक्षम होने पर /whoami का उपयोग करें।
गोपनीयता नोट: @userinfobot एक थर्ड-पार्टी बॉट है। यदि आप चाहें, तो बॉट को समूह में जोड़ें, एक संदेश भेजें, और chat.id पढ़ने के लिए openclaw logs --follow का उपयोग करें, या Bot API getUpdates का उपयोग करें।
Config writes
डिफ़ॉल्ट रूप से, Telegram को चैनल इवेंट्स या/config set|unset द्वारा ट्रिगर किए गए config अपडेट लिखने की अनुमति है।
यह तब होता है जब:
- किसी समूह को सुपरग्रुप में अपग्रेड किया जाता है और Telegram
migrate_to_chat_idजारी करता है (चैट ID बदल जाती है)। OpenClawchannels.telegram.groupsको स्वचालित रूप से माइग्रेट कर सकता है। - आप Telegram चैट में
/config setया/config unsetचलाते हैं (इसके लिएcommands.config: trueआवश्यक है)।
Topics (forum supergroups)
Telegram फ़ोरम टॉपिक्स में प्रत्येक संदेश के लिए एकmessage_thread_id शामिल होता है। OpenClaw:
- प्रत्येक टॉपिक को अलग रखने के लिए Telegram group session key में
:topic:<threadId>जोड़ता है। - typing indicators भेजता है और
message_thread_idके साथ उत्तर देता है ताकि प्रतिक्रियाएँ उसी टॉपिक में रहें। - General topic (thread id
1) विशेष है: संदेश भेजते समयmessage_thread_idछोड़ा जाता है (Telegram इसे अस्वीकार करता है), लेकिन typing indicators में यह शामिल रहता है। - routing/templating के लिए template context में
MessageThreadId+IsForumउजागर करता है। - टॉपिक-विशिष्ट कॉन्फ़िगरेशन
channels.telegram.groups.<chatId>11. .topics.<threadId>(skills, allowlists, auto-reply, system prompts, disable). - टॉपिक configs समूह सेटिंग्स (requireMention, allowlists, skills, prompts, enabled) को विरासत में लेते हैं जब तक प्रति-टॉपिक override न किया जाए।
message_thread_id in some edge cases. OpenClaw DM सत्र कुंजी को अपरिवर्तित रखता है, लेकिन जब यह मौजूद हो तो उत्तरों/ड्राफ्ट स्ट्रीमिंग के लिए थ्रेड ID का उपयोग करता है।
Inline Buttons
Telegram callback buttons के साथ inline keyboards का समर्थन करता है।off— inline buttons अक्षमdm— केवल DMs (group targets अवरुद्ध)group— केवल समूह (DM targets अवरुद्ध)all— DMs + समूहallowlist— DMs + समूह, लेकिन केवलallowFrom/groupAllowFromद्वारा अनुमत प्रेषक (control commands जैसे ही नियम)
allowlist.
लीगेसी: capabilities: ["inlineButtons"] = inlineButtons: "all".
Buttons भेजना
message tool का उपयोगbuttons पैरामीटर के साथ करें:
callback_data: value
Configuration विकल्प
Telegram क्षमताएँ दो स्तरों पर कॉन्फ़िगर की जा सकती हैं (ऊपर object form दिखाया गया है; legacy string arrays भी समर्थित हैं):channels.telegram.capabilities: सभी Telegram खातों पर लागू global default capability config, जब तक override न किया जाए।channels.telegram.accounts.<account>.capabilities: प्रति-अकाउंट क्षमताएँ जो उस विशिष्ट अकाउंट के लिए ग्लोबल डिफ़ॉल्ट्स को ओवरराइड करती हैं।
Access control (DMs + groups)
DM access
- डिफ़ॉल्ट:
channels.telegram.dmPolicy = "pairing"। अज्ञात प्रेषकों को एक पेयरिंग कोड मिलता है; स्वीकृति तक संदेश अनदेखे रहते हैं (कोड 1 घंटे बाद समाप्त हो जाते हैं)। - अनुमोदन करें:
openclaw pairing list telegramopenclaw pairing approve telegram <CODE>
- पेयरिंग Telegram DMs के लिए डिफ़ॉल्ट टोकन एक्सचेंज है। विवरण: Pairing
channels.telegram.allowFromसंख्यात्मक यूज़र IDs (अनुशंसित) या@usernameएंट्रीज़ स्वीकार करता है। यह बॉट का यूज़रनेम नहीं है; मानव प्रेषक की ID का उपयोग करें। विज़ार्ड@usernameस्वीकार करता है और जब संभव हो तो उसे संख्यात्मक ID में रिज़ॉल्व करता है।
अपना Telegram user ID ढूँढना
अधिक सुरक्षित (कोई third-party बॉट नहीं):- Gateway प्रारंभ करें और अपने बॉट को DM करें।
openclaw logs --followचलाएँ औरfrom.idदेखें।
- अपने बॉट को DM करें।
-
अपने बॉट टोकन के साथ updates प्राप्त करें और
message.from.idपढ़ें:
@userinfobotया@getidsbotको DM करें और लौटाया गया user id उपयोग करें।
Group access
दो स्वतंत्र नियंत्रण: **1. कौन से समूह अनुमत हैं (channels.telegram.groups के माध्यम से समूह allowlist):
- कोई
groupsconfig नहीं = सभी समूह अनुमत groupsconfig के साथ = केवल सूचीबद्ध समूह या"*"अनुमत- उदाहरण:
"groups": { "-1001234567890": {}, "*": {} }सभी समूहों की अनुमति देता है
channels.telegram.groupPolicy के माध्यम से प्रेषक फ़िल्टरिंग):
"open"= अनुमत समूहों के सभी प्रेषक संदेश भेज सकते हैं"allowlist"= केवलchannels.telegram.groupAllowFromमें प्रेषक संदेश भेज सकते हैं"disabled"= कोई भी समूह संदेश स्वीकार नहीं डिफ़ॉल्टgroupPolicy: "allowlist"है (जब तक आपgroupAllowFromन जोड़ें, तब तक अवरुद्ध)।
groupPolicy: "allowlist" + groupAllowFrom + channels.telegram.groups में सूचीबद्ध विशिष्ट समूह
किसी विशिष्ट समूह में किसी भी सदस्य को बात करने की अनुमति देने के लिए (जबकि control commands केवल authorized senders तक सीमित रहें), प्रति-समूह override सेट करें:
Long-polling बनाम webhook
- डिफ़ॉल्ट: long-polling (कोई सार्वजनिक URL आवश्यक नहीं)।
- Webhook मोड:
channels.telegram.webhookUrlऔरchannels.telegram.webhookSecretसेट करें (वैकल्पिकchannels.telegram.webhookPath)।- local listener
0.0.0.0:8787पर bind करता है और डिफ़ॉल्ट रूप सेPOST /telegram-webhookसर्व करता है। - यदि आपका public URL अलग है, तो reverse proxy का उपयोग करें और
channels.telegram.webhookUrlको public endpoint पर point करें।
- local listener
Reply threading
Telegram टैग्स के माध्यम से वैकल्पिक threaded replies का समर्थन करता है:[[reply_to_current]]— triggering संदेश को reply।[[reply_to:<id>]]— किसी विशिष्ट message id को reply।
channels.telegram.replyToMode द्वारा नियंत्रित:
first(डिफ़ॉल्ट),all,off।
Audio messages (voice बनाम file)
Telegram वॉइस नोट्स (गोल बबल) और ऑडियो फ़ाइल्स (मेटाडेटा कार्ड) में अंतर करता है। OpenClaw बैकवर्ड कम्पैटिबिलिटी के लिए डिफ़ॉल्ट रूप से ऑडियो फ़ाइल्स का उपयोग करता है। एजेंट उत्तरों में voice note bubble को मजबूर करने के लिए, उत्तर में कहीं भी यह टैग शामिल करें:[[audio_as_voice]]— audio को file के बजाय voice note के रूप में भेजें।
media URL के साथ asVoice: true सेट करें
(जब media मौजूद हो, तो message वैकल्पिक है):
Video messages (video vs video note)
Telegram distinguishes video notes (round bubble) from video files (rectangular). OpenClaw defaults to video files. For message tool sends, setasVideoNote: true with a video media URL:
Stickers
OpenClaw बुद्धिमान caching के साथ Telegram stickers प्राप्त करने और भेजने का समर्थन करता है।Stickers प्राप्त करना
जब कोई उपयोगकर्ता sticker भेजता है, तो OpenClaw sticker प्रकार के आधार पर इसे संभालता है:- स्टैटिक स्टिकर्स (WEBP): डाउनलोड किए जाते हैं और विज़न के माध्यम से प्रोसेस किए जाते हैं। स्टिकर संदेश सामग्री में
<media:sticker>प्लेसहोल्डर के रूप में दिखाई देता है। - Animated stickers (TGS): छोड़े जाते हैं (Lottie फ़ॉर्मैट प्रोसेसिंग के लिए समर्थित नहीं)।
- Video stickers (WEBM): छोड़े जाते हैं (video फ़ॉर्मैट प्रोसेसिंग के लिए समर्थित नहीं)।
Sticker— object जिसमें:emoji— sticker से जुड़ा emojisetName— sticker set का नामfileId— Telegram file ID (वही sticker वापस भेजने के लिए)fileUniqueId— cache lookup के लिए stable IDcachedDescription— उपलब्ध होने पर cached vision description
Sticker cache
स्टिकर्स को विवरण उत्पन्न करने के लिए AI की विज़न क्षमताओं के माध्यम से प्रोसेस किया जाता है। चूँकि वही स्टिकर्स अक्सर बार-बार भेजे जाते हैं, OpenClaw अनावश्यक API कॉल्स से बचने के लिए इन विवरणों को कैश करता है। यह कैसे काम करता है:- पहली बार सामना: स्टिकर इमेज को विज़न विश्लेषण के लिए AI को भेजा जाता है। AI एक विवरण उत्पन्न करता है (उदाहरण के लिए, “एक कार्टून बिल्ली उत्साहपूर्वक हाथ हिलाती हुई”).
- Cache storage: विवरण sticker के file ID, emoji और set name के साथ सहेजा जाता है।
- बाद के अवसर: जब वही स्टिकर फिर से देखा जाता है, तो कैश किया हुआ विवरण सीधे उपयोग किया जाता है। इमेज को AI को नहीं भेजा जाता।
~/.openclaw/telegram/sticker-cache.json
Cache entry format:
- समान sticker के लिए दोहराए गए vision calls से बचकर API लागत कम होती है
- cached stickers के लिए तेज़ प्रतिक्रिया समय (कोई vision प्रोसेसिंग देरी नहीं)
- cached विवरणों के आधार पर sticker search कार्यक्षमता सक्षम होती है
Stickers भेजना
एजेंटsticker और sticker-search एक्शन्स का उपयोग करके स्टिकर्स भेज और खोज सकता है। ये डिफ़ॉल्ट रूप से अक्षम होते हैं और config में सक्षम किए जाने चाहिए:
fileId(आवश्यक) — स्टिकर का Telegram फ़ाइल ID। इसे स्टिकर प्राप्त करते समयSticker.fileIdसे, याsticker-searchपरिणाम से प्राप्त करें।replyTo(optional) — reply करने के लिए message ID।threadId(optional) — forum topics के लिए message thread ID।
Streaming (drafts)
Telegram एजेंट के उत्तर जनरेट करते समय ड्राफ्ट बबल्स स्ट्रीम कर सकता है। OpenClaw Bot APIsendMessageDraft (वास्तविक संदेश नहीं) का उपयोग करता है और फिर अंतिम उत्तर को सामान्य संदेश के रूप में भेजता है।
आवश्यकताएँ (Telegram Bot API 9.3+):
- topics सक्षम private chats (बॉट के लिए forum topic mode)।
- इनकमिंग संदेशों में
message_thread_id(private topic thread) शामिल होना चाहिए। - समूह/supergroups/channels के लिए streaming अनदेखा किया जाता है।
channels.telegram.streamMode: "off" | "partial" | "block"(डिफ़ॉल्ट:partial)partial: नवीनतम streaming टेक्स्ट के साथ draft bubble अपडेट करें।block: draft bubble को बड़े blocks (chunked) में अपडेट करें।off: draft streaming अक्षम करें।
- वैकल्पिक (केवल
streamMode: "block"के लिए):channels.telegram.draftChunk: { minChars?, maxChars?, breakPreference? }- defaults:
minChars: 200,maxChars: 800,breakPreference: "paragraph"(channels.telegram.textChunkLimitतक clamp किया गया)।
- defaults:
channels.telegram.blockStreaming: true
if you want early Telegram messages instead of draft updates.
Reasoning stream (केवल Telegram):
/reasoning streamउत्तर जनरेट होते समय reasoning को draft bubble में स्ट्रीम करता है, फिर बिना reasoning के अंतिम उत्तर भेजता है।- If
channels.telegram.streamModeisoff, reasoning stream is disabled. More context: Streaming + chunking.
Retry policy
Outbound Telegram API calls retry on transient network/429 errors with exponential backoff and jitter. Configure viachannels.telegram.retry. See Retry policy.
Agent tool (messages + reactions)
- Tool:
telegramwithsendMessageaction (to,content, optionalmediaUrl,replyToMessageId,messageThreadId)। - Tool:
telegramwithreactaction (chatId,messageId,emoji)। - Tool:
telegramwithdeleteMessageaction (chatId,messageId)। - Reaction removal semantics: /tools/reactions देखें।
- Tool gating:
channels.telegram.actions.reactions,channels.telegram.actions.sendMessage,channels.telegram.actions.deleteMessage(डिफ़ॉल्ट: सक्षम), औरchannels.telegram.actions.sticker(डिफ़ॉल्ट: अक्षम)।
Reaction notifications
How reactions work: Telegram reactions arrive as separatemessage_reaction events, not as properties in message payloads. When a user adds a reaction, OpenClaw:
- Telegram API से
message_reactionupdate प्राप्त करता है - इसे इस फ़ॉर्मैट के साथ system event में बदलता है:
"Telegram reaction added: {emoji} by {user} on msg {id}" - system event को नियमित संदेशों के समान session key का उपयोग करके enqueue करता है
- जब उसी बातचीत में अगला संदेश आता है, तो system events drain होकर एजेंट के context में prepend हो जाते हैं
-
channels.telegram.reactionNotifications: नियंत्रित करता है कि कौन-सी reactions notifications ट्रिगर करें"off"— सभी reactions अनदेखी करें"own"— जब उपयोगकर्ता बॉट संदेशों पर react करें तो notify करें (best-effort; in-memory) (डिफ़ॉल्ट)"all"— सभी reactions के लिए notify करें
-
channels.telegram.reactionLevel: एजेंट की reaction क्षमता नियंत्रित करता है"off"— एजेंट messages पर react नहीं कर सकता"ack"— बॉट acknowledgment reactions भेजता है (प्रोसेसिंग के दौरान 👀) (डिफ़ॉल्ट)"minimal"— एजेंट सीमित रूप से react कर सकता है (मार्गदर्शन: हर 5–10 exchanges में 1)"extensive"— उपयुक्त होने पर एजेंट उदारता से react कर सकता है
message_thread_id and use session keys like agent:main:telegram:group:{chatId}:topic:{threadId}. This ensures reactions and messages in the same topic stay together.
Example config:
- Telegram bots को
allowed_updatesमें स्पष्ट रूप सेmessage_reactionअनुरोध करना होता है (OpenClaw द्वारा स्वचालित रूप से कॉन्फ़िगर) - Webhook मोड के लिए, reactions webhook
allowed_updatesमें शामिल होती हैं - Polling मोड के लिए, reactions
getUpdatesallowed_updatesमें शामिल होती हैं
Delivery targets (CLI/cron)
- लक्ष्य के रूप में chat id (
123456789) या username (@name) का उपयोग करें। - उदाहरण:
openclaw message send --channel telegram --target 123456789 --message "hi"।
Troubleshooting
समूह में non-mention संदेशों पर बॉट प्रतिक्रिया नहीं देता:- यदि आपने
channels.telegram.groups.*.requireMention=falseसेट किया है, तो Telegram Bot API privacy mode अक्षम होना चाहिए।- BotFather:
/setprivacy→ Disable (फिर समूह से बॉट हटाकर पुनः जोड़ें)
- BotFather:
openclaw channels statusचेतावनी दिखाता है जब config unmentioned group messages की अपेक्षा करता है।openclaw channels status --probeस्पष्ट numeric group IDs के लिए सदस्यता की अतिरिक्त जाँच कर सकता है (यह wildcard"*"नियमों का audit नहीं कर सकता)।- Quick test:
/activation always(केवल session; स्थायित्व के लिए config का उपयोग करें)
- यदि
channels.telegram.groupsसेट है, तो समूह सूचीबद्ध होना चाहिए या"*"का उपयोग करना चाहिए - @BotFather में Privacy Settings जाँचें → “Group Privacy” OFF होना चाहिए
- सत्यापित करें कि बॉट वास्तव में सदस्य है (सिर्फ admin नहीं, बिना read access)
- Gateway logs जाँचें:
openclaw logs --follow(“skipping group message” देखें)
/activation always पर नहीं:
/activationcommand session state अपडेट करता है लेकिन config में स्थायी नहीं करता- स्थायी व्यवहार के लिए, समूह को
channels.telegram.groupsमेंrequireMention: falseके साथ जोड़ें
/status जैसे commands काम नहीं करते:
- सुनिश्चित करें कि आपका Telegram user ID अधिकृत है (pairing या
channels.telegram.allowFromके माध्यम से) - commands को authorization की आवश्यकता होती है, भले ही समूह में
groupPolicy: "open"हो
- Node 22+
AbortSignalinstances के बारे में अधिक सख्त है; foreign signals तुरंतfetchcalls abort कर सकते हैं। - abort signals को normalize करने वाले OpenClaw build में अपग्रेड करें, या अपग्रेड तक Gateway को Node 20 पर चलाएँ।
HttpError: Network request ... failed):
- Some hosts resolve
api.telegram.orgto IPv6 first. If your server does not have working IPv6 egress, grammY can get stuck on IPv6-only requests. - समाधान: IPv6 egress सक्षम करें या
api.telegram.orgके लिए IPv4 resolution को मजबूर करें (उदाहरण: IPv4 A record का उपयोग करके/etc/hostsentry जोड़ें, या अपने OS DNS stack में IPv4 को प्राथमिकता दें), फिर Gateway पुनः प्रारंभ करें। - Quick check: DNS क्या लौटाता है यह पुष्टि करने के लिए
dig +short api.telegram.org Aऔरdig +short api.telegram.org AAAA।
Configuration reference (Telegram)
पूर्ण configuration: Configuration Provider विकल्प:channels.telegram.enabled: चैनल स्टार्टअप सक्षम/अक्षम करें।channels.telegram.botToken: बॉट टोकन (BotFather)।channels.telegram.tokenFile: फ़ाइल पथ से टोकन पढ़ें।channels.telegram.dmPolicy:pairing | allowlist | open | disabled(डिफ़ॉल्ट: pairing)।channels.telegram.allowFrom: DM allowlist (ids/usernames).openrequires"*".channels.telegram.groupPolicy:open | allowlist | disabled(डिफ़ॉल्ट: allowlist)।channels.telegram.groupAllowFrom: group sender allowlist (ids/usernames)।channels.telegram.groups: प्रति-समूह defaults + allowlist (global defaults के लिए"*"का उपयोग करें)।channels.telegram.groups.<id>.groupPolicy: groupPolicy (open | allowlist | disabled) के लिए प्रति-समूह ओवरराइड।channels.telegram.groups.<id>.requireMention: मेंशन गेटिंग का डिफ़ॉल्ट।channels.telegram.groups.<id>.skills: स्किल फ़िल्टर (omit = सभी स्किल्स, empty = कोई नहीं)।channels.telegram.groups.<id>.allowFrom: प्रति-समूह प्रेषक allowlist ओवरराइड।channels.telegram.groups.<id>.systemPrompt: समूह के लिए अतिरिक्त सिस्टम प्रॉम्प्ट।channels.telegram.groups.<id>.enabled:falseहोने पर समूह को अक्षम करें।channels.telegram.groups.<id>.topics.<threadId>.*: प्रति-टॉपिक ओवरराइड (समूह जैसे ही फ़ील्ड्स)।channels.telegram.groups.<id>.topics.<threadId>.groupPolicy: groupPolicy (open | allowlist | disabled) के लिए प्रति-टॉपिक ओवरराइड।channels.telegram.groups.<id>.topics.<threadId>.requireMention: per-topic mention gating override.
channels.telegram.capabilities.inlineButtons:off | dm | group | all | allowlist(डिफ़ॉल्ट: allowlist)।channels.telegram.accounts.<account>.capabilities.inlineButtons: per-account override.channels.telegram.replyToMode:off | first | all(डिफ़ॉल्ट:first)।channels.telegram.textChunkLimit: outbound chunk size (chars)।channels.telegram.chunkMode:length(डिफ़ॉल्ट) या लंबाई chunking से पहले blank lines (paragraph boundaries) पर विभाजित करने के लिएnewline।channels.telegram.linkPreview: outbound संदेशों के लिए link previews toggle करें (डिफ़ॉल्ट: true)।channels.telegram.streamMode:off | partial | block(draft streaming)।channels.telegram.mediaMaxMb: inbound/outbound media cap (MB)।channels.telegram.retry: outbound Telegram API calls के लिए retry policy (attempts, minDelayMs, maxDelayMs, jitter)।channels.telegram.network.autoSelectFamily: override Node autoSelectFamily (true=enable, false=disable). Defaults to disabled on Node 22 to avoid Happy Eyeballs timeouts.channels.telegram.proxy: Bot API calls के लिए proxy URL (SOCKS/HTTP)।channels.telegram.webhookUrl: webhook मोड सक्षम करें (इसके लिएchannels.telegram.webhookSecretआवश्यक)।channels.telegram.webhookSecret: webhook secret (जब webhookUrl सेट हो तो आवश्यक)।channels.telegram.webhookPath: local webhook path (डिफ़ॉल्ट/telegram-webhook)।channels.telegram.actions.reactions: Telegram tool reactions gate करें।channels.telegram.actions.sendMessage: Telegram tool message sends gate करें।channels.telegram.actions.deleteMessage: Telegram tool message deletes gate करें।channels.telegram.actions.sticker: Telegram sticker actions — send और search gate करें (डिफ़ॉल्ट: false)।channels.telegram.reactionNotifications:off | own | all— नियंत्रित करें कि कौन-सी reactions system events ट्रिगर करें (डिफ़ॉल्ट: सेट न होने परown)।channels.telegram.reactionLevel:off | ack | minimal | extensive— एजेंट की reaction क्षमता नियंत्रित करें (डिफ़ॉल्ट: सेट न होने परminimal)।
agents.list[].groupChat.mentionPatterns(mention gating patterns)।messages.groupChat.mentionPatterns(global fallback)।commands.native(defaults to"auto"→ on for Telegram/Discord, off for Slack),commands.text,commands.useAccessGroups(command behavior). Override withchannels.telegram.commands.native.messages.responsePrefix,messages.ackReaction,messages.ackReactionScope,messages.removeAckAfterReply।