You need:
- OCcode installed and open
- OpenClaw installed (via the Home panel Install button)
- A Telegram account on your phone
You must create a bot via Telegram's official BotFather before anything else.
- Open Telegram on your phone or desktop
- Search for @BotFather and open the chat
- Send the command:
/newbot - BotFather will ask for a name — this is the display name (e.g.
My OpenClaw Bot) - BotFather will then ask for a username — must end in
bot(e.g.myopenclawbot) - BotFather will reply with your Bot Token — it looks like:
Copy this — you will need it in the next step.
8328341297:AAESucIDOoHTt3Wers28iqKERjjyRmAt6_k
- Open OCcode (the editor)
- The OpenClaw Home panel opens automatically on the right
- Make sure the status shows Gateway: Running
- If not, click Start Gateway
- Wait for the green status indicator
- Click the Configure OpenClaw button
- The Gateway Control UI opens inside the editor
The first time you open the Gateway UI you will be asked to authenticate.
- When prompted, enter the gateway token from your config:
- Run this in Terminal to find it:
cat ~/.openclaw/openclaw.json | grep token
- It looks like:
70048f4f333c4ef75e7408144f6cdc1f1da5d60dd149ed35
- Run this in Terminal to find it:
- Paste the token into the Gateway UI login screen
- Click Connect
Tip: The token is saved in your browser's local storage so you only need to do this once per machine.
Once logged in to the Gateway UI:
- Click Channels in the left navigation
- You will see cards for all supported messaging platforms:
- Telegram, WhatsApp, Discord, Slack, Signal, iMessage, and more
- Find the Telegram card
In the Telegram card:
- You will see a config form with a Bot Token field
- Paste the bot token you copied from BotFather in Step 1
- Click Save
The Telegram card will update to show:
- Configured: Yes
- Running: Yes
- Mode: polling or webhook
After saving:
- Click the Probe button in the Telegram card
- The card will show a probe result:
- ✅
Probe ok— your bot token is valid and Telegram is reachable - ❌
Probe failed— check the bot token and try again
- ✅
- If probe is ok, your bot's @username will appear in the card header
Now connect an AI agent to your Telegram bot:
- Click Agents in the left navigation
- Click New Agent (or use an existing one)
- Give your agent a name and select a model (e.g. OCC Legacy Model for free, or your API key model)
- Save the agent
- Click Bindings in the left navigation (under the Agents or Channels section)
- Click Add Binding
- Select:
- Agent: the agent you created in Step 7
- Channel: Telegram
- Set your DM Policy — how the bot responds to direct messages:
pairing— only responds to paired users (recommended for workshops)allowlist— only responds to users on a specific listopen— responds to anyone
- Save the binding
- Open Telegram on your phone
- Search for your bot by the username you gave it (e.g.
@myopenclawbot) - Send
/startor any message - Your OpenClaw agent should respond
| Problem | Fix |
|---|---|
| Gateway not running | Click "Start Gateway" on the OCcode home panel |
| Probe failed | Double-check the bot token — no extra spaces |
| Bot not responding | Check Bindings — agent must be bound to Telegram |
| Token expired | BotFather → /mybots → select bot → API Token → Revoke and re-issue |
| Gateway UI won't load | Restart gateway from home panel, wait 5s, click Configure again |
| Can't log in to Gateway | Run cat ~/.openclaw/openclaw.json and copy the token value |
| What | Where |
|---|---|
| Create bot | @BotFather on Telegram → /newbot |
| Enter bot token | Gateway UI → Channels → Telegram card → Bot Token field |
| Test connection | Gateway UI → Channels → Telegram → Probe button |
| Connect AI | Gateway UI → Bindings → Add Binding |
| Find gateway token | cat ~/.openclaw/openclaw.json | grep token |
| Restart gateway | OCcode Home panel → Restart Gateway button |