Skip to main content
HowOpenClawv2026.4.9

Module 2: Connecting Your Apps

Connect your AI assistant to Telegram, WhatsApp, Slack, Discord, or iMessage. Step-by-step channel setup for OpenClaw — no coding required.

0 of 10 modules complete0%
6 min read
What you will learn
  • Create a Telegram bot and connect it to OpenClaw
  • Understand DM policies and when to use each one
  • Pair your account with the agent
  • Troubleshoot common channel connection issues

Why this matters

Right now your agent only works through the CLI. In this module, you connect it to a real messaging app so you can chat with it from your phone — just like texting a friend.

Why Telegram first

Telegram is the fastest channel to set up:

  • No phone number pairing required
  • Official Bot API (free, stable)
  • Works on any device
  • Takes about 2 minutes

You can add WhatsApp, Slack, Discord, and more later. See the Channels guide for all supported platforms.

Step 1: Create your bot

  1. Open Telegram and search for @BotFather
  2. Send /newbot
  3. Choose a display name (e.g., "My OpenClaw")
  4. Choose a username ending in bot (e.g., my_openclaw_bot)
  5. Copy the bot token BotFather gives you

Keep this token private — anyone with it can control your bot.

Step 2: Add the channel config

In your Terminal, open your OpenClaw configuration file:

openclaw config edit

This opens ~/.openclaw/openclaw.json in your default text editor (usually VS Code, nano, or Notepad).

What is a .json file?

JSON is just a structured text format for storing settings. It uses curly braces {}, colons :, and quotes " to organize information. You don't need to understand it deeply — just copy the examples exactly, including all the brackets and commas.

The file already has content from the onboarding wizard. It looks something like this:

{
  "model": "gpt-4o",
  "provider": "openai",
  "apiKey": "sk-..."
}

Add the channels section inside the outer {} brackets, after the last line, separated by a comma:

{
  "model": "gpt-4o",
  "provider": "openai",
  "apiKey": "sk-...",
  "channels": {
    "telegram": {
      "token": "YOUR_BOT_TOKEN_HERE",
      "dmPolicy": "pairing"
    }
  }
}

Replace YOUR_BOT_TOKEN_HERE with the actual token BotFather gave you (it looks like 7391827364:AAHqk...). Then save the file (Cmd+S on macOS, Ctrl+S on Windows) and close the editor.

Common mistake — missing comma

In JSON, each section must be separated by a comma. If you get a "config invalid" error, check that there is a comma after the line before "channels". Run openclaw config validate to check.

If openclaw config edit doesn't open an editor

Run openclaw config path in your Terminal to see the file location (e.g. /Users/yourname/.openclaw/openclaw.json), then open that file in any text editor — TextEdit on Mac, Notepad on Windows, or VS Code if you have it installed.

Step 3: Understand DM policies

The dmPolicy setting controls who can message your agent:

PolicyWho can messageBest for
pairingUsers you approve one by oneGetting started (default)
allowlistOnly specific user IDs you listProduction use
openAnyone who finds your botNever recommended

Start with pairing — it lets you approve yourself easily, then switch to allowlist once you know your Telegram user ID.

To find your Telegram user ID, message @userinfobot — it replies with your numeric ID.

For allowlist mode:

{
  "channels": {
    "telegram": {
      "token": "YOUR_BOT_TOKEN_HERE",
      "dmPolicy": "allowlist",
      "allowedUsers": [123456789]
    }
  }
}

Step 4: Restart and pair

Save your config file, then apply the changes in your Terminal:

openclaw gateway restart

Check that Telegram is showing as connected:

openclaw gateway status

You should see:

Gateway: running
Channels:
  ✓ telegram     connected

Now go to Telegram on your phone or computer and search for your bot by username (the one you set with BotFather, e.g. @my_openclaw_bot). Tap it and send /start.

With pairing mode, OpenClaw holds the request until you approve it. Back in your Terminal, run:

openclaw channels pair

You will see something like:

Pending pairing requests:
  1. Telegram — @yourusername (ID: 123456789)

Approve? [y/n]:

Type y and press Enter. You are now paired and connected.

Step 5: Test it

Send a message to your bot in Telegram:

Hello! What can you do?

You should get a response within a few seconds. The agent reads your SOUL.md and USER.md on each message, sends the request to your AI provider, and streams the response back.

Troubleshooting

ProblemFix
Bot not respondingRun openclaw gateway status — is the gateway running?
"Not paired" errorRun openclaw channels pair and approve your request
Slow responsesCheck your AI model — cloud models need network access
Connection droppedRun openclaw gateway restart

Check logs for more detail:

openclaw logs --filter telegram

Validate your config file syntax:

openclaw config validate

Adding more channels

Once Telegram is working, you can add other channels the same way. Each channel gets its own section in the config with its own DM policy.

Each channel has a dedicated setup guide:

  • Telegram — easiest to set up, official Bot API, recommended first channel
  • WhatsApp — scan a QR code to link, unofficial API, works for personal use
  • Slack — Socket Mode, no public URL needed, best for work contexts
  • Discord — bot application, great for communities
  • iMessage — Mac only, requires BlueBubbles or AirMessage bridge
  • Microsoft Teams — official Teams SDK, enterprise grade
  • Signal — end-to-end encrypted, privacy first
  • Web Chat — embeddable widget for websites

If you hit issues connecting a channel, the troubleshooting guide covers the most common errors.

Finished this module?

Tracks your progress across all 10 modules

Frequently asked questions

Can I connect multiple messaging apps to OpenClaw at the same time?
Yes. You can run Telegram, Discord, Slack, and WhatsApp all at once. Each channel is a separate config block in openclaw.json. The Gateway handles all of them simultaneously — you can message your agent from any connected app and it will respond.
Do I need a phone number to create a Telegram bot?
No. The bot is created through BotFather, which only requires an existing Telegram account. You don't register a new phone number — your bot gets a username instead. The bot is separate from your personal Telegram account entirely.
What is a DM policy and which one should I set?
A DM policy controls who can message your bot. 'allowlist' means only the user IDs you specify can interact with the agent. 'open' means anyone who finds the bot can message it. For personal use, always set allowlist — otherwise strangers can use your API key.
My bot connected but isn't responding — what should I check?
First, check that your user ID is in the allowedUsers list in openclaw.json — if you're not on the allowlist, the bot will silently ignore your messages. Second, run `openclaw logs --tail 30` to see any error messages. Third, confirm the Gateway is running with `openclaw gateway status`.