Guide
March 14, 20267 min read

Connect Telegram Bot to OpenClaw Agent: Complete Configuration Guide

Configure Telegram as a messaging channel for your OpenClaw AI agent. Get your bot token, update openclaw.yaml, and deploy without managing infrastructure.

TL;DR

  • Telegram Bot API is OpenClaw’s primary production-ready messaging channel
  • Obtain token via @BotFather; never hardcode secrets into configuration files
  • Update `channels.telegram` section in `~/.openclaw/openclaw.yaml`
  • Restart the agent daemon to apply channel configuration changes
  • Test with `/start` command in Telegram; monitor gateway logs for delivery confirmation
Telegram bot connected to OpenClaw AI agent container via cloud infrastructure

Messaging Channel Landscape

OpenClaw supports multiple messaging channels. Choose based on your audience, API stability, and operational requirements.

ChannelAuth MethodStatusMessage Rate LimitBest For
TelegramBot API Token✅ Live30/secProduction bots, public deployment
DiscordBot Token + Gateway⏳ Coming Q2 2026120/minCommunity servers, async tasks
SlackSocket Mode / Events API⏳ Coming Q2 20261/sec per methodInternal tooling, enterprise
WhatsAppQR Link (Web)❌ Not supportedN/AUse Telegram instead

Prerequisites

You need a running OpenClaw instance and a Telegram account. No local port forwarding required when using a managed gateway.

Step 1: Provision a Telegram Bot Token

Message @BotFather on Telegram. Send /newbot, choose a name, and copy the token. Export it as an environment variable.

# Example token from @BotFather
export TELEGRAM_BOT_TOKEN="123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11"

# Verify the token is set
echo $TELEGRAM_BOT_TOKEN

Step 2: Update OpenClaw Configuration

Edit ~/.openclaw/openclaw.yaml. Set channels.telegram.enabled to true and reference the token via environment variable.

# ~/.openclaw/openclaw.yaml
gateway:
  token: "${OPENCLAW_GATEWAY_TOKEN}"
  host: "0.0.0.0"
  port: 18789

channels:
  telegram:
    enabled: true
    bot_token: "${TELEGRAM_BOT_TOKEN}"
    webhook_path: "/webhook/telegram"
    # When deploying via easyclawd.com, the public URL is auto-generated
    # webhook_url: "https://your-id.easyclawd.com/webhook/telegram"
    allowed_chat_ids: []  # Empty allows all; restrict for private bots
    parse_mode: "MarkdownV2"

daemon:
  auto_reconnect: true
  health_check_interval: 30

logging:
  level: "info"
  channels: true
Message flow diagram from Telegram through OpenClaw gateway to LLM provider and back

⚠️ Security Warning: Bot tokens grant full control of your Telegram bot. Never commit them to Git. Use environment variables or a secrets manager. Exposed tokens can be exploited to spam users or extract conversation logs.

Step 3: Restart Agent and Test

Restart OpenClaw to load the new configuration. Send /start to your bot on Telegram. Check the dashboard logs to confirm message receipt.

openclaw restart

Common Issues

  • `401 Unauthorized`: Token is invalid or missing. Re-export `TELEGRAM_BOT_TOKEN`.
  • `Webhook timeout`: Ensure the gateway is publicly reachable. Managed services handle this automatically.
  • `403 Forbidden`: Chat ID is not in `allowed_chat_ids`. Check the log for the actual chat ID.
  • No response after `/start`: Confirm `channels.telegram.enabled: true` and restart the daemon.

See Also

  • OpenClaw Channel Configuration Reference — https://docs.openclaw.dev/channels/telegram
  • Telegram Bot API Documentation — https://core.telegram.org/bots/api
  • Deploying OpenClaw on EasyClawd — https://easyclawd.com/docs/deployment

Ready to deploy your OpenClaw AI assistant?

Skip the complexity. Get your AI agent running in minutes with EasyClawd.

Deploy Your AI Agent