telegram
OpenClaw Telegram Channel Setup
BotFather ka use karke apne OpenClaw Gateway se Telegram bot kaise connect karein. Isme token handling, safe access ke liye allowlists, aur connection verify karna cover kiya gaya hai.
Read in EnglishOn this page
Short answer
Telegram ko OpenClaw se connect karne ke liye:
- Ek bot banane aur API token lene ke liye Telegram par
@BotFatherse baat karein. - Token ko apni OpenClaw
.envfile mein add karein (TELEGRAM_TOKEN=123...). - Dashboard ya
.envmeinTELEGRAM_ALLOWLISTconfigure karein taaki sirf aap bot se baat kar sakein. - Gateway ko restart karein.
Telegram sahi channel kab hai?
Telegram OpenClaw users ke liye, khaskar India mein, recommended pehla channel hai kyunki:
- Yeh free aur instant hai: Koi API approval processes nahi chahiye (WhatsApp Business ki tarah).
- Isme built-in security hai: Aap Telegram User IDs ka use karke easily access restrict kar sakte hain.
- Yeh rich media handle karta hai: Images, files, aur code blocks bhejna easily kaam karta hai.
- Koi phone number exposure nahi: Telegram bot chalane ke liye aapko kisi dedicated SIM card ki zaroorat nahi hoti.
Agar aap ek internal tool, ek personal assistant bana rahe hain, ya kisi concept ko test kar rahe hain, toh Telegram se shuru karein.
Step 1: BotFather ke zariye Bot banayein
BotFather ek official Telegram bot hai jo dusre bots banata hai.
- Telegram open karein aur
@BotFathersearch karein (verified blue tick dekhein). /newbotmessage send karein.- Apne bot ko ek name dein (jaise, “My OpenClaw Agent”). Yahi users ko dikhta hai.
- Apne bot ko ek username dein (jaise,
my_claw_agent_bot). Yeh “bot” par end hona chahiye aur globally unique hona chahiye. - BotFather characters ki ek long string ke saath reply karega. Yeh aapka HTTP API Token hai.
Aapka token kuch aisa dikhta hai: 1234567890:ABCdefGhIJKlmNoPQRstuVwXyz.
Jiske paas bhi yeh token hoga, woh aapke bot ko bheje gaye messages read kar sakta hai aur isko impersonate kar sakta hai. Is token ko kabhi bhi kisi public forum, GitHub issue, ya support chat mein paste mat karein.
Step 2: Token ko apne OpenClaw workspace mein add karein
Aapko Gateway ke environment mein token inject karna hoga. Aisa karne ka sabse safe tarika .env file ke zariye hai.
Apne VPS mein SSH karein aur apna OpenClaw workspace open karein:
cd ~/openclaw-workspace nano jaise text editor mein .env file ko open karein:
nano .env Telegram token line add ya update karein. Ensure karein ki equals sign ke aas-paas koi spaces na hon:
TELEGRAM_TOKEN=1234567890:ABCdefGhIJKlmNoPQRstuVwXyz
Save karein aur exit karein (Ctrl+O, Enter, Ctrl+X).
Step 3: Allowlist Configure Karein (Critical)
By default, koi bhi Telegram user jise aapke bot ka username mil jata hai, woh isko messages bhej sakta hai. Agar aapke agent mein tools enabled hain (jaise web search ya shell execution), toh ek random user aapke API credits use kar sakta hai ya aapke server par commands execute kar sakta hai.
Aapko ek allowlist configure karna hi hoga.
- Apna personal Telegram User ID find karein. Aap kisi
@userinfobotjaise bot ko message bhej kar yeh kar sakte hain. Yeh ek numeric ID (jaise,987654321) ke saath reply karega. - Apni
.envfile ko dobara open karein. - Apna User ID use karte hue, allowlist variable add karein:
TELEGRAM_ALLOWLIST=987654321
Agar aap multiple users allow karna chahte hain, toh unke IDs ko commas se separate karein (koi spaces nahi):
TELEGRAM_ALLOWLIST=987654321,112233445
Step 4: Gateway Restart karein aur Verify karein
.env changes apply hone ke liye, aapko OpenClaw Gateway restart karna hoga.
Agar aap manually run kar rahe hain:
npx openclaw start Agar aap PM2 ka use kar rahe hain:
pm2 restart openclaw Verification:
- Telegram open karein aur apne bot ka username search karein.
- Start par click karein ya “Hello” jaisa koi message bhejein.
- Agar sab kuch theek se configured hai, toh OpenClaw ko message receive hona chahiye, isko AI model ko bhejna chahiye, aur Telegram mein aapko reply karna chahiye.
Common Mistakes (Galtiyan)
.envfile mein spaces:TELEGRAM_TOKEN = 123...(spaces ke saath) likhne se configuration break ho jayega.- Allowlist ke liye
@usernameka use: Allowlist ke liye numeric User ID ki zaroorat hoti hai, aapke text@handleki nahi. - Restart karna bhool jana:
.envmein kiye gaye changes tab tak apply nahi hote jab tak Gateway process restart na ho. - Bot Privacy Mode: By default, Telegram bots group chats mein messages nahi padh sakte jab tak ki unhe mention na kiya jaye. Agar aap apne bot ko kisi group mein add karte hain, toh aapko privacy mode disable karne ke liye BotFather mein
/setprivacyka use karna hoga.
Token Rotation
Agar aap galti se apna token share kar dete hain, ya agar aapko shak hai ki aapka server compromise ho gaya tha, toh aapko turant token rotate karna hoga.
- Telegram mein
@BotFatherpar jayein. /revokesend karein.- Apna bot select karein.
- BotFather ek naya token issue karega aur purane wale ko invalidate kar dega.
- Naye token ke saath apni
.envfile update karein. - OpenClaw Gateway restart karein.
Kya NAHI karna hai
- Kisi bhi custom scripts mein token hardcode mat karein. Hamesha environment variables se read karein.
.envko Git par commit mat karein. Agar aap Git se apne workspace ko track kar rahe hain, toh ensure karein ki.envaapki.gitignorefile mein hai.- Agar aapke agent mein file access ya shell execution tools enabled hain toh allowlist disable mat karein.
Bot reply nahi kar raha?
Agar aap message bhejte hain aur bot aapko ignore karta hai, toh webhook vs polling issues, API key failures, aur log inspection diagnose karne ke liye Telegram Bot Not Replying troubleshooting guide check karein.
Redaction Warning: Agar aap community mein ya Setup Help ke zariye madad maangte hain, toh apna raw Telegram token ya unredacted .env file share mat karein. Sensitive data ko XXX se replace karein.
ClawReady.in is an independent educational resource and setup service. It is not affiliated with, endorsed by, or operated by OpenClaw.