Independent Field Manual — Not affiliated with, endorsed by, or operated by OpenClaw
Navigation

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 English
Difficulty
beginner
Duration
15 minutes
Tested On
OpenClaw Gateway v0.8+
Access Mode
SSH / Dashboard
Pre-flight status
Pre-Flight Approved
Risk medium
Gateway Private
On this page
Proceed with caution Bot tokens highly sensitive hote hain. Inko kabhi share mat karein. Ek allowlist ka use karein taaki random Telegram users aapke agent ko command na de sakein.

Short answer

Telegram ko OpenClaw se connect karne ke liye:

  1. Ek bot banane aur API token lene ke liye Telegram par @BotFather se baat karein.
  2. Token ko apni OpenClaw .env file mein add karein (TELEGRAM_TOKEN=123...).
  3. Dashboard ya .env mein TELEGRAM_ALLOWLIST configure karein taaki sirf aap bot se baat kar sakein.
  4. 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.

  1. Telegram open karein aur @BotFather search karein (verified blue tick dekhein).
  2. /newbot message send karein.
  3. Apne bot ko ek name dein (jaise, “My OpenClaw Agent”). Yahi users ko dikhta hai.
  4. Apne bot ko ek username dein (jaise, my_claw_agent_bot). Yeh “bot” par end hona chahiye aur globally unique hona chahiye.
  5. BotFather characters ki ek long string ke saath reply karega. Yeh aapka HTTP API Token hai.

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:

bash
cd ~/openclaw-workspace

nano jaise text editor mein .env file ko open karein:

bash
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.

  1. Apna personal Telegram User ID find karein. Aap kisi @userinfobot jaise bot ko message bhej kar yeh kar sakte hain. Yeh ek numeric ID (jaise, 987654321) ke saath reply karega.
  2. Apni .env file ko dobara open karein.
  3. 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:

bash
npx openclaw start

Agar aap PM2 ka use kar rahe hain:

bash
pm2 restart openclaw

Verification:

  1. Telegram open karein aur apne bot ka username search karein.
  2. Start par click karein ya “Hello” jaisa koi message bhejein.
  3. 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)

  • .env file mein spaces: TELEGRAM_TOKEN = 123... (spaces ke saath) likhne se configuration break ho jayega.
  • Allowlist ke liye @username ka use: Allowlist ke liye numeric User ID ki zaroorat hoti hai, aapke text @handle ki nahi.
  • Restart karna bhool jana: .env mein 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 /setprivacy ka 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.

  1. Telegram mein @BotFather par jayein.
  2. /revoke send karein.
  3. Apna bot select karein.
  4. BotFather ek naya token issue karega aur purane wale ko invalidate kar dega.
  5. Naye token ke saath apni .env file update karein.
  6. OpenClaw Gateway restart karein.

Kya NAHI karna hai

  • Kisi bhi custom scripts mein token hardcode mat karein. Hamesha environment variables se read karein.
  • .env ko Git par commit mat karein. Agar aap Git se apne workspace ko track kar rahe hain, toh ensure karein ki .env aapki .gitignore file 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.