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.
- 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
- Open Telegram and search for @BotFather
- Send
/newbot - Choose a display name (e.g., "My OpenClaw")
- Choose a username ending in
bot(e.g.,my_openclaw_bot) - 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 editThis 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:
| Policy | Who can message | Best for |
|---|---|---|
pairing | Users you approve one by one | Getting started (default) |
allowlist | Only specific user IDs you list | Production use |
open | Anyone who finds your bot | Never 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 restartCheck that Telegram is showing as connected:
openclaw gateway statusYou should see:
Gateway: running
Channels:
✓ telegram connectedNow 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 pairYou 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
| Problem | Fix |
|---|---|
| Bot not responding | Run openclaw gateway status — is the gateway running? |
| "Not paired" error | Run openclaw channels pair and approve your request |
| Slow responses | Check your AI model — cloud models need network access |
| Connection dropped | Run openclaw gateway restart |
Check logs for more detail:
openclaw logs --filter telegramValidate your config file syntax:
openclaw config validateAdding 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`.