How-ToTelegramWhatsAppSetup GuideOpenClaw

How to Connect Your AI Agent to WhatsApp and Telegram

العربية
Connect AI Agent to WhatsApp and Telegram

"Unable to connect to WhatsApp or Telegram."

We see this error constantly. Messaging integration is the most common pain point for new OpenClaw users — and the most rewarding once it works.

Here's the complete guide to getting your AI agent connected to the messaging platforms you actually use.

Quick Comparison

PlatformDifficultyStabilityNotes
TelegramEasyExcellentBot token never expires. Recommended starting point.
DiscordEasyExcellentGreat for teams. Bot setup straightforward.
WhatsAppMediumGood*Session drops possible. Needs phone link.
SignalMediumGoodPrivacy-focused option.
iMessageHardVariesRequires Mac, more complex setup.

Telegram Setup (Recommended First)

Telegram is the easiest and most stable option. Start here.

Step 1: Create Your Bot

  1. Open Telegram and search for @BotFather
  2. Send /newbot
  3. Choose a name (e.g., "My AI Assistant")
  4. Choose a username (must end in "bot", e.g., myai_assistant_bot)
  5. BotFather gives you a token like: 123456789:ABCdefGHI...
  6. Save this token — you'll need it next

Step 2: Configure OpenClaw

Add to your openclaw.json:

{
  "channels": {
    "telegram": {
      "token": "YOUR_BOT_TOKEN_HERE"
    }
  }
}

Step 3: Restart and Test

  1. Restart OpenClaw: openclaw gateway restart
  2. Open Telegram and find your bot
  3. Send a message — your AI should respond

That's it. Telegram setup takes about 5 minutes.

WhatsApp Setup

WhatsApp is trickier because it wasn't designed for bots. There are two approaches:

Option A: WhatsApp Web Link (Simpler)

This links your personal WhatsApp account to OpenClaw via WhatsApp Web.

  1. Add to openclaw.json:
{
  "channels": {
    "whatsapp": {}
  }
}
  1. Restart OpenClaw
  2. A QR code appears in your terminal/logs
  3. Scan with WhatsApp on your phone (Settings → Linked Devices)
  4. Connection established

Common Issues:

  • Session drops: WhatsApp may disconnect after days/weeks. Re-scan QR code to reconnect.
  • QR not appearing: Check logs for errors. May need to delete old session files.
  • Phone offline: Your phone must have internet for WhatsApp Web to work.

Option B: WhatsApp Business API (More Stable)

For production use, consider the official WhatsApp Business API via:

  • Twilio — easiest to set up, costs per message
  • Meta Business API — direct, but more complex

This requires a business account and has message costs, but won't randomly disconnect.

📬 Get practical AI insights weekly

One email/week. Real tools, real setups, zero fluff.

No spam. Unsubscribe anytime. + free AI playbook.

Discord Setup

Great for teams or communities.

Step 1: Create Discord Application

  1. Go to Discord Developer Portal
  2. Click "New Application"
  3. Go to "Bot" section
  4. Click "Add Bot"
  5. Copy the token
  6. Enable "Message Content Intent" under Privileged Intents

Step 2: Invite Bot to Server

  1. Go to OAuth2 → URL Generator
  2. Select scopes: bot
  3. Select permissions: Send Messages, Read Message History, etc.
  4. Copy the generated URL and open it
  5. Select your server and authorize

Step 3: Configure OpenClaw

{
  "channels": {
    "discord": {
      "token": "YOUR_DISCORD_BOT_TOKEN"
    }
  }
}

Multi-Channel Setup

Want your AI on multiple platforms? Just add them all:

{
  "channels": {
    "telegram": {
      "token": "TELEGRAM_TOKEN"
    },
    "discord": {
      "token": "DISCORD_TOKEN"
    },
    "whatsapp": {}
  }
}

Your AI will respond on all channels. Messages are separate — a Telegram conversation doesn't know about Discord messages (unless you configure shared memory).

Troubleshooting

"Bot not responding"

  • Check OpenClaw is running: openclaw status
  • Check logs for errors: openclaw gateway logs
  • Verify token is correct (no extra spaces)
  • For Telegram: make sure you're messaging the bot, not BotFather

"WhatsApp keeps disconnecting"

  • Keep your phone online and charged
  • Don't use WhatsApp Web on another device simultaneously
  • Delete session files and re-link if persistent
  • Consider Business API for critical use cases

"Discord bot offline"

  • Verify Message Content Intent is enabled
  • Check bot has permission to read/send in the channel
  • Regenerate token if you suspect it leaked

"Rate limited"

  • You're sending too many messages too fast
  • Add delays between messages
  • Telegram and Discord have generous limits; WhatsApp is stricter

Security Tips

  • Never share your tokens — treat them like passwords
  • Regenerate if exposed — if you accidentally commit a token, regenerate immediately
  • Use environment variables — don't hardcode tokens in config files you share
  • Restrict bot permissions — only grant what's needed

Which Should You Use?

  • Personal use: Telegram (easiest, most stable)
  • Team/work: Discord or Slack
  • Existing WhatsApp users: WhatsApp (accepts the quirks)
  • Privacy-focused: Signal
  • Apple ecosystem: iMessage (if you're technical)

Most people start with Telegram, get comfortable, then add other channels as needed.

Skip the Setup?

Messaging integration is where most people get stuck. Tokens, permissions, session management — there's a lot that can go wrong.

We handle all of this. Your AI agent, connected to your messaging platforms, fully configured and tested before you start using it.

This is just the basics.

We handle the full setup — AI assistant on your hardware, connected to your email, calendar, and tools. No cloud, no subscriptions. Just message us.

Get Your AI Assistant Set Up