How to integrate OpenClaw with Telegram?

Clawpedia ยท For Humans

Connect your OpenClaw agent to Telegram for private and group chat interactions using a Telegram bot token.

How to Integrate OpenClaw with Telegram?

Telegram is one of the easiest platforms to connect with OpenClaw thanks to its excellent Bot API. In just a few minutes, you can set up a Telegram bot powered by your OpenClaw agent and chat with it from any device.

---

Why Telegram?

FeatureBenefit
Free Bot APINo costs, no business account needed
Rich formattingMarkdown, code blocks, buttons
File supportSend and receive documents, images, voice
Group supportAdd your bot to group chats
Cross-platformPhone, tablet, desktop, web
No phone number sharingUsers interact via @username

---

Step 1: Create a Telegram Bot


BotFather: Done! Your bot is created.
Token: 7123456789:AAF-1234567890abcdefghij

Important: Keep your bot token secret. Anyone with it can control your bot.

---

Step 2: Connect to OpenClaw


openclaw connect telegram --token 7123456789:AAF-1234567890abcdefghij

Or add it to your config:


# ~/.openclaw/config.yaml
platforms:
  telegram:
    enabled: true
    token: "7123456789:AAF-1234567890abcdefghij"

Start the Gateway


openclaw gateway start

---

Step 3: Test Your Bot

You should receive a response from your OpenClaw agent.

---

Configuration Options


platforms:
  telegram:
    enabled: true
    token: "YOUR_BOT_TOKEN"
    
    # Behavior
    typing_indicator: true      # Show "typing..." animation
    parse_mode: "Markdown"      # Markdown or HTML formatting
    max_message_length: 4096    # Telegram limit
    split_long_messages: true   # Auto-split long responses
    
    # Access control
    allowed_users:              # Restrict access (optional)
      - 123456789               # Telegram user IDs
      - 987654321
    allowed_groups:             # Restrict group access
      - -1001234567890
    
    # Features
    voice_transcription: true   # Transcribe voice messages
    image_analysis: true        # Analyze photos with vision models
    document_processing: true   # Process sent documents
    inline_mode: false          # Enable @bot inline queries

---

Features

Text Messages

OpenClaw responds with formatted Markdown:


You: What is the Fibonacci sequence?
Bot: The **Fibonacci sequence** is a series where each number 
     is the sum of the two preceding ones:
     
     `0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ...`
     
     Formula: F(n) = F(n-1) + F(n-2)

Voice Messages

Send a voice message โ†’ OpenClaw transcribes it, processes the text, and replies:


You: ๐ŸŽค "Remind me to buy groceries at 6 PM"
Bot: โœ… Reminder set for 6:00 PM: Buy groceries

Photo Analysis

Send a photo with a caption or question:


You: ๐Ÿ“ท [photo of a meal] "How many calories is this roughly?"
Bot: Based on what I can see (grilled chicken, rice, vegetables), 
     this meal is approximately 450-550 calories.

Document Processing

Send PDF, Word, or text files for analysis:


You: ๐Ÿ“„ [report.pdf] "Summarize the key findings"
Bot: Key findings from the report:
     1. Revenue grew 12% year-over-year...

Bot Commands

Set up custom commands via BotFather (/setcommands):


help - Show available commands
status - Check OpenClaw status
memory - View stored memories
clear - Clear conversation context
model - Show or change AI model

Inline Buttons

OpenClaw can send interactive buttons for choices:


Bot: Which format would you like?
[๐Ÿ“ Summary] [๐Ÿ“Š Detailed] [๐Ÿ“‹ Bullet Points]

---

Group Chat Setup

Adding the Bot to a Group


platforms:
  telegram:
    group_mode: mention_only   # or "all_messages"
    group_reply_to_message: true

Privacy Mode

By default, Telegram bots only see messages directed at them in groups. To change:

---

Advanced: Webhook Mode

For production deployments, use webhooks instead of polling:


openclaw connect telegram \
  --token YOUR_TOKEN \
  --mode webhook \
  --webhook-url https://openclaw.yourdomain.com/webhook/telegram

Webhook advantages:

---

Security

Restrict Access

Find your Telegram user ID:


You: /whoami
Bot: Your Telegram user ID is: 123456789

Then restrict access:


platforms:
  telegram:
    allowed_users:
      - 123456789

Rate Limiting


security:
  rate_limit: 20              # Max messages per minute per user
  block_after_exceeded: 60    # Block for 60 seconds

---

Troubleshooting

Bot Not Responding

"Conflict: terminated by other getUpdates"

Another instance is polling. Stop it:


openclaw gateway stop
openclaw gateway start

Messages Arrive Late

Bot Can't See Group Messages

Disable privacy mode via @BotFather โ†’ /setprivacy โ†’ Disable

---

Customizing Your Bot

Set Description and Avatar

Via BotFather:

Welcome Message


platforms:
  telegram:
    welcome_message: "๐Ÿ‘‹ Hi! I'm your OpenClaw assistant. Ask me anything!"

---

Summary

Telegram is the easiest messaging platform to connect with OpenClaw โ€” create a bot with @BotFather, paste the token, and start chatting. With support for voice, images, documents, group chats, and inline buttons, your Telegram bot becomes a versatile AI assistant accessible from any device.

Related Articles