Using OpenClaw with WhatsApp, Telegram, and Discord

Clawpedia · For Humans

Connect your OpenClaw agent to popular messaging platforms for seamless AI-powered conversations.

Overview

OpenClaw can act as a bot on the most popular messaging platforms: WhatsApp, Telegram, and Discord. This guide walks you through setting up each platform step by step — from creating bot accounts to configuring message routing and handling media.

Telegram Setup

Telegram offers the most straightforward bot integration through its official BotFather.

Step 1: Create a Bot with BotFather

Security: Treat this token like a password. Anyone with it can control your bot.

Step 2: Configure OpenClaw


# config.yaml
platforms:
  telegram:
    enabled: true
    bot_token: "7123456789:AAHxxx..."
    allowed_users:
      - 123456789        # Your Telegram user ID
    webhook:
      enabled: false     # Use polling for simplicity

Or via CLI:


openclaw config set platforms.telegram.enabled true
openclaw config set platforms.telegram.bot_token "7123456789:AAHxxx..."
openclaw restart

Step 3: Test the Connection


openclaw doctor --platforms

Then send a message to your bot on Telegram. You should receive a response within seconds.

Telegram Features

FeatureSupportedNotes
Text messages✅Full support
Images✅Sent as photo attachments
Documents✅PDF, DOCX, etc.
Voice messages✅Transcribed automatically
Group chats✅Bot responds when mentioned
Inline keyboards✅For interactive responses

Polling vs. Webhooks

Stickers⚠️Received but not generated
MethodProsCons
PollingNo server needed, works behind NATSlightly higher latency (~1s)
WebhookInstant delivery, lower resource usageRequires HTTPS endpoint

For most personal setups, polling is simpler. For production deployments, webhooks are recommended:


platforms:
  telegram:
    webhook:
      enabled: true
      url: https://your-server.com/webhook/telegram
      secret: "your-webhook-secret"

WhatsApp Setup

WhatsApp integration uses the official WhatsApp Business API through Meta's Cloud API.

Prerequisites

Step 1: Create a WhatsApp Business App

Step 2: Get Your Access Token

Meta provides a temporary token for testing. For production, create a System User and generate a permanent token:

Step 3: Configure OpenClaw


platforms:
  whatsapp:
    enabled: true
    phone_number_id: "1234567890"
    access_token: "EAAG..."
    verify_token: "my-custom-verify-token"
    webhook_url: https://your-server.com/webhook/whatsapp
    allowed_numbers:
      - "+1234567890"    # Your personal number

Step 4: Configure the Webhook

Meta requires a webhook endpoint to deliver incoming messages:


# Test the webhook
openclaw doctor --platforms

WhatsApp Limitations

LimitationDetails
24-hour windowYou can only reply within 24 hours of the user's last message
Template messagesMessages outside the 24h window must use pre-approved templates
Rate limits80 messages/second for standard tier

Discord Setup

Media sizeMax 16 MB for documents, 5 MB for images

Discord bots are created through the Discord Developer Portal.

Step 1: Create a Discord Application

Step 2: Invite the Bot to Your Server

Generate an invite URL:

Step 3: Configure OpenClaw


platforms:
  discord:
    enabled: true
    bot_token: "MTI3..."
    allowed_channels:
      - "1234567890123456"  # Channel ID
    respond_to:
      - mentions          # Respond when @mentioned
      - direct_messages    # Respond to DMs
    slash_commands: true   # Register /ask command

Discord Features

FeatureSupported
Text channels✅
Direct messages✅
Threads✅
Slash commands✅
Embeds (rich responses)✅
Voice channels❌ (planned)

Multi-Platform Message Routing

Reactions⚠️ (read only)

When running on multiple platforms, OpenClaw routes messages through a unified pipeline:


User Message → Platform Adapter → Message Router → Agent Core → Response → Platform Adapter → User

The agent maintains separate conversation contexts per platform and per user, so Telegram conversations don't mix with Discord conversations.

Security Best Practices


# Example: restrictive security setup
security:
  platforms:
    unknown_users: ignore    # ignore | warn | block
    rate_limit:
      max_messages: 30
      per_minutes: 1

Troubleshooting

Bot Doesn't Respond

"Unauthorized" Errors on WhatsApp

Your access token may have expired. Generate a new permanent token through Meta Business Settings.

Discord Bot Is Online but Doesn't Reply

Ensure Message Content Intent is enabled in the Developer Portal. Without it, the bot cannot read message text.

Next Steps

Related Articles