OpenClaw uses Telegram in two ways:
- OpenClaw channel — chat with your AI agent via a Telegram bot (required)
- Host alerter — VPS health alerts sent to Telegram (optional)
Both can use the same bot, or you can create separate bots.
- Open Telegram and message @BotFather
- Send
/newbot - Choose a display name (e.g., "OpenClaw")
- Choose a username ending in
bot(e.g.,openclaw_bot) - BotFather replies with your bot token — a string like
123456789:ABCdefGHIjklMNOpqrsTUVwxyz
Send any message to @userinfobot — it replies with your numeric user ID.
Add both values to stack.yml under your claw config, and the bot token to .env:
# stack.yml — under claws.<name>
telegram_bot_token: "123456789:ABCdefGHIjklMNOpqrsTUVwxyz"
your_telegram_id: "123456789"YOUR_TELEGRAM_IDgates elevated mode — only this Telegram user can activate/elevatedcommandsOPENCLAW_TELEGRAM_BOT_TOKENconnects the gateway to Telegram as a messaging channel
After deployment, the gateway connects to Telegram automatically. Message your bot to start chatting — the gateway may prompt you to approve the device via openclaw devices approve (same flow as browser pairing).
The host alerter sends disk/memory/CPU alerts via Telegram. You can reuse the same bot or create a separate one.
-
Send any message to your bot
-
Open this URL in a browser (replace
<TOKEN>with your bot token):https://api.telegram.org/bot<TOKEN>/getUpdates -
Find
"chat":{"id":123456789}in the JSON — that number is your chat ID
-
Add your bot to a group
-
Send a slash command in the group (e.g.,
/start)— bots have privacy mode enabled by default and only see slash commands in groups
-
Check
getUpdatesas above — the group chat ID will be a negative number (e.g.,-1001234567890)
Tip: If slash commands don't appear in
getUpdates, disable privacy mode: message@BotFather, send/setprivacy, select your bot, chooseDisable, then remove and re-add the bot to the group.
# .env
HOSTALERT_TELEGRAM_BOT_TOKEN=123456789:ABCdefGHIjklMNOpqrsTUVwxyz
HOSTALERT_TELEGRAM_CHAT_ID=123456789Can be the same token as
OPENCLAW_TELEGRAM_BOT_TOKEN. The chat ID is often your personal ID or a group ID (negative number).
./scripts/telegram-test.shOr with a custom message:
./scripts/telegram-test.sh "Hello from OpenClaw"The host alerter (/home/openclaw/scripts/host-alert.sh) runs via cron every 15 minutes and checks:
- Disk usage (threshold: 85%)
- Memory usage (threshold: 90%)
- Docker daemon health
- Container crash/restart detection
Alerts are only sent on state changes — you won't get repeated messages for the same ongoing issue. A recovery message is sent when all checks pass again.
See deploy/host/host-alert.sh for threshold configs.
Ask claude to redeploy host alert after you've made any changes to host-alert.sh
or the Telegram settings in .env.