What This Guide Covers: Connecting OpenClaw to Telegram, Discord, and WhatsApp so your AI agent is always reachable from your phone. We'll configure bot tokens, set up webhooks, enable heartbeat notifications, and implement proper 24/7 deployment so your agent never goes offline. Includes VPN setup for uninterrupted connectivity.
Why Messaging Platforms Matter for OpenClaw
The breakthrough with OpenClaw isn't just what it can do โ it's how you interact with it. Instead of opening a web interface and typing a prompt, you message your agent exactly like texting a colleague. From your phone, while commuting, at dinner, at 3 AM โ your agent is always there, always listening, always ready to take action.
Telegram
Best overall: reliable, feature-rich API, free bots, excellent OpenClaw community support. Start here.
Discord
Best for teams: channel-based access control, rich embeds, slash commands. Ideal for multi-user deployments.
Best for non-technical users: everyone already uses it. Requires Meta Business account but feels most natural.
Setting Up Telegram Integration
Step 1: Create Your Telegram Bot (5 minutes)
Open Telegram and search for @BotFather
BotFather is Telegram's official bot for creating and managing bots
Send /newbot command
BotFather: What's the name? โ "My Jarvis"
BotFather: Choose a username โ "myjarvis_bot"
Copy your bot token
Keep this token secret โ it's your bot's password
Step 2: Configure OpenClaw for Telegram
# In your .env file
TELEGRAM_BOT_TOKEN=5432109876:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw
TELEGRAM_ALLOWED_USERS=123456789 # Your Telegram user ID
TELEGRAM_WEBHOOK_URL=https://your-server.com/telegram # Optional
# Enable Telegram connector
CONNECTORS=telegram
Find your Telegram User ID: Message @userinfobot on Telegram. It instantly replies with your numeric user ID. Add this to TELEGRAM_ALLOWED_USERS to restrict who can control your agent.
Step 3: Webhook vs Polling โ Which to Use?
โ Polling (Recommended for Beginners)
OpenClaw asks Telegram "any new messages?" every few seconds. Works behind NAT, no public IP needed, easier setup.
โก Webhooks (Recommended for Production)
Telegram pushes messages to your server instantly. Faster response, lower server load. Requires public HTTPS endpoint.
Step 4: Enable Heartbeat Notifications
Heartbeats are the killer feature โ your agent proactively messages you instead of waiting to be asked.
// config/heartbeats.json
[
{
"name": "morning-briefing",
"schedule": "0 8 * * *",
"message": "Send me today's calendar events, unread emails, and top 3 priorities"
},
{
"name": "evening-summary",
"schedule": "0 18 * * *",
"message": "Summarize what was accomplished today and any pending items"
}
]
Pro tip: Start with just 1 heartbeat (morning briefing). Too many heartbeat notifications become annoying. Quality over quantity.
Setting Up Discord Integration
Discord Bot Creation (10 minutes)
Go to discord.com/developers/applications
Click "New Application" and name your agent
Go to "Bot" section โ Create Bot โ Reset Token
Enable these intents: Message Content, Server Members, Presence
OAuth2 โ URL Generator โ Invite to your server
Required permissions: Send Messages, Read Message History, Use Slash Commands
# Add to .env
DISCORD_BOT_TOKEN=MTA5Nzg2NzM5NTExNzc3NTQ1Ng.xxxx
DISCORD_CHANNEL_ID=1234567890123456789
CONNECTORS=telegram,discord # Run both simultaneously
Discord vs Telegram: Feature Comparison
| Feature | Telegram | Discord |
|---|---|---|
| Setup Difficulty | โญ Easy | โญโญ Medium |
| Mobile Experience | โ Excellent | โ Good |
| Multi-User Support | โ ๏ธ Limited | โ Excellent |
| File Sharing | โ Up to 2GB | โ Up to 25MB |
| Bot API Quality | โ Excellent | โ Excellent |
| Cost | โ Free | โ Free |
| Channel Organization | โ ๏ธ Basic | โ Advanced |
Achieving True 24/7 Operation
The 24/7 Problem
Running npm start in a terminal only keeps OpenClaw running while that terminal is open. The moment you close it, your agent dies. True 24/7 requires a proper process manager.
Method 1: Docker (Recommended)
# docker-compose.yml
version: '3.8'
services:
openclaw:
image: openclaw/openclaw:latest
restart: unless-stopped # Auto-restart on crash
volumes:
- ./data:/app/data # Persist memory
- ./config:/app/config # Persist config
env_file: .env
network_mode: "host" # Use VPN if active
# Start with Docker
docker-compose up -d
# View logs
docker-compose logs -f openclaw
Why Docker? Automatic restart on crash, easy updates, clean isolation from system packages, works on any Linux server, Raspberry Pi, or cloud VPS.
Method 2: PM2 (Simpler Alternative)
# Install PM2 globally
npm install -g pm2
# Start OpenClaw with PM2
pm2 start npm --name "openclaw" -- start
# Auto-start on system boot
pm2 startup && pm2 save
# Monitor status
pm2 status
pm2 logs openclaw
VPN07 โ The Missing Piece for 24/7 OpenClaw
Your agent can run 24/7 perfectly โ but network issues will still break it. ISP throttling, geographic restrictions, and intermittent connectivity drops are the top causes of agent downtime that PM2/Docker can't fix. That's where VPN07 comes in.
Stops ISP throttling of Telegram/Discord API connections
70+ server locations โ connect through the fastest node to Telegram's servers
1000Mbps bandwidth โ handles concurrent messaging + AI API calls without slowdown
10 years uptime history โ the only VPN proven stable enough for production AI agents
Troubleshooting Messaging Setup Issues
Problem: "Forbidden 403" when starting Telegram bot
โ Solution
Your bot token is wrong or the bot was revoked. Go back to @BotFather โ /mybots โ Select bot โ API Token โ Generate a new one.
Problem: Bot is online but doesn't respond to messages
โ Solution
Your user ID isn't in TELEGRAM_ALLOWED_USERS. Add your ID and restart. Find your ID by messaging @userinfobot.
Problem: Agent responds to commands but with huge delays (30+ seconds)
โ Solution
Network latency between your server and Telegram/AI APIs. Enable VPN07 on your server โ its optimized routing cuts API roundtrip time significantly. Users report 70% faster response times after switching to VPN07.
Problem: Discord bot joins server but has no permissions to send messages
โ Solution
Re-invite the bot using a proper OAuth2 URL with "Send Messages" permission. In Discord Developer Portal โ OAuth2 โ URL Generator โ check Bot + Send Messages + Read Message History.
Problem: Agent goes offline randomly (works for a few hours then stops)
โ Solution
Two possible causes: (1) Process crash โ use Docker/PM2 for auto-restart. (2) Network drops โ use VPN07 to maintain stable connectivity. Often both solutions are needed for truly reliable 24/7 operation.
Security Best Practices
โ Never Do This
- โข Share your bot token publicly
- โข Leave TELEGRAM_ALLOWED_USERS empty (all users can control your agent)
- โข Post config files containing API keys to GitHub
- โข Allow your bot in public Discord servers without access controls
โ Always Do This
- โข Add .env to .gitignore before committing
- โข Use ALLOWED_USERS to whitelist only yourself/team
- โข Rotate tokens if you suspect compromise
- โข Use VPN07 to encrypt all traffic from your agent
Related Articles
Keep Your Agent Online 24/7 with VPN07
Docker and PM2 handle crashes. VPN07 handles network reliability. Together, they're the foundation for an OpenClaw agent that genuinely never goes offline. 1000Mbps bandwidth, 70+ countries, 10 years of proven stability โ all for $1.5/month.