Phase 6 / Ep 28: Telegram Deep Integration —— From BotFather to Production-Grade Bot

⏱ Est. reading time: 4 min Updated on 4/13/2026

🎯 Learning Objective: Fully configure the Telegram channel to achieve production quality.

1. Creating a Bot with BotFather (Detailed Steps)

  1. Search for @BotFather in Telegram and send /start
  2. /newbot → Enter the Bot name (e.g., "My OpenClaw Agent")
  3. Enter the Bot username (must end with bot, e.g., my_openclaw_bot)
  4. Obtain the Token: 7123456789:AAHxxxxxxxxx

Additional Configuration (Recommended)

/setdescription - Set Bot description
/setabouttext - Set "About" info
/setuserpic - Upload Bot profile picture
/setcommands - Set command menu

Recommended command menu:

status - Check Agent status
clear - Clear current session
help - Get help
logs - View recent logs
skills - Manage skills

2. Connecting to OpenClaw

# Add Telegram channel
openclaw channels add telegram --token "7123456789:AAHxxx"

# Verify connection
openclaw channels status

3. Pairing

sequenceDiagram
    participant User as 🧑 You
    participant TG as 📱 Telegram Bot
    participant GW as 🦀 Gateway

    User->>TG: Send any message
    TG->>GW: Receive message from unpaired user
    GW->>TG: Return Pairing Code: "ABC123"
    TG->>User: "Please enter this pairing code in the CLI"
    User->>GW: openclaw channels pair ABC123
    GW->>GW: ✅ Pairing successful
    User->>TG: "Hello!"
    TG->>GW: Message routing (Authenticated)
    GW->>User: "Hello! I am your Agent..."

4. Private Chat vs. Group

Mode Configuration Agent Behavior
Private Chat Default Responds to all messages
Group Requires @mention Responds only when @bot is mentioned
Group Admin Whitelist Only admins can execute commands

5. Telegram-Specific Commands

Command CLI Equivalent Description
/status openclaw status Check status
/clear openclaw sessions clear Clear session
/help openclaw --help Help
/logs openclaw logs View logs
/skills list openclaw skills list List skills
/restart openclaw gateway restart Restart (Admin required)

Coming Up Next: Ep 29, Deep Discord Integration — Creating an Application, configuring OAuth2, and deploying the Bot to a server.