Telegram bot quickstart

Five steps from BotFather token to a paired OpenClaw assistant on Telegram

This is the fast path. For groups, media, grammY details, and advanced options, use the full Telegram channel guide. Config keys drift—confirm exact JSON fields in official docs.

Time: about 10–15 minutes if OpenClaw is already installed.

Before you start

  • OpenClaw installed (installation) and at least one LLM provider configured.
  • A Telegram account on phone or desktop.
  • Gateway will run where it can reach Telegram APIs (most home networks and VPS hosts work).

Step 1 — Create a bot with BotFather

  1. Open Telegram and search for @BotFather (verified).
  2. Send /newbot, choose a display name and a username ending in bot.
  3. Copy the HTTP API token BotFather returns. Store it like a password—anyone with it controls your bot.

Optional: /setprivacy if you plan to add the bot to groups later (see full Telegram guide).

Step 2 — Install or update OpenClaw

New machine:

Terminal
npm install -g openclaw@latest
openclaw onboard

Existing install: upgrading guide (latest stable listed on releases).

Step 3 — Add the Telegram token

During onboarding, enable the Telegram channel and paste the token when prompted. Or edit ~/.openclaw/openclaw.json following the configuration and Telegram pages.

Keep dmPolicy on pairing (default)—do not open DMs to the world until you understand security basics.

Step 4 — Start the Gateway

Terminal
openclaw gateway start
openclaw doctor

doctor should show Telegram connected. If not, see troubleshooting below or main troubleshooting.

Step 5 — Pair your account

  1. In Telegram, open a DM with your new bot and send any message (e.g. hello).
  2. The bot replies with a pairing code (when pairing policy is active).
  3. On the machine running OpenClaw:
Terminal
openclaw pairing list telegram
openclaw pairing approve telegram <code>

Full pairing flow: pairing guide. After approval, send another message—the agent should respond using your configured model.

Troubleshooting

Symptom Likely cause Fix
Bot never repliesGateway stopped or wrong tokenRestart Gateway; re-copy token from BotFather
Pairing code only, no chatNot approved yetpairing approve with exact code
401 / unauthorizedRevoked or typo in tokenRegenerate token in BotFather, update config, restart
Slow repliesModel latency or cold startTry faster model; check provider status

What to do next