Set up the Telegram bridge
The Telegram bridge forwards messages between a Telegram bot and the OpenClaw agent running inside the NemoClaw sandbox. You send a message to your bot; the bridge runs it through the agent and returns the response. When the agent needs external network access, the OpenShell TUI prompts for approval. The bridge is an auxiliary service managed bynemoclaw start and nemoclaw stop.
Prerequisites
- A running NemoClaw sandbox, either local or remote.
NVIDIA_API_KEYset in your environment.- A Telegram bot token from @BotFather.
Create a Telegram bot
Open BotFather
In Telegram, start a conversation with @BotFather.
Create a new bot
Send the
/newbot command. BotFather will ask for a display name and a username, then issue a bot token that looks like:Configure and start the bridge
Set the environment variables
Export the bot token and your NVIDIA API key:The bridge script requires both variables at startup. It exits immediately if either is missing.
Start auxiliary services
Start the Telegram bridge and the cloudflared tunnel:
nemoclaw start launches the following services:- Telegram bridge — forwards Telegram messages to the agent and returns responses. Only started when
TELEGRAM_BOT_TOKENis set. - cloudflared tunnel — provides external access to the sandbox over a public URL.
Send a message
Open Telegram, find your bot, and send a message. The bridge forwards the text to the OpenClaw agent inside the sandbox and sends the agent’s response back to you. The following built-in commands are handled by the bridge before reaching the agent:| Command | Effect |
|---|---|
/start | Sends a welcome message describing the bot and the sandbox. |
/reset | Clears the active session history for your chat. |
Restrict access to specific chat IDs
By default, the bridge accepts messages from any Telegram chat. To restrict access to specific users or groups, set theALLOWED_CHAT_IDS environment variable to a comma-separated list of Telegram chat IDs:
Monitor bridge activity
While the bridge is running, open the OpenShell TUI in a separate terminal to monitor sandbox network activity and approve egress requests triggered by the agent:Stop the services
Stop the Telegram bridge and all other auxiliary services:How the bridge works
When a message arrives, the bridge:- Checks the chat ID against
ALLOWED_CHAT_IDS(if set). - Sends a typing indicator to Telegram.
- Fetches the sandbox SSH config with
openshell sandbox ssh-config nemoclaw. - SSHs into the sandbox and runs
openclaw agent --agent main --local -m '<message>' --session-id 'tg-<chatId>'. - Strips setup log lines from the output and returns the agent response to Telegram.
- Repeats the typing indicator every 4 seconds while the agent is running.
Each Telegram chat uses its own
--session-id, so conversation history is isolated per chat. Use /reset to clear a session.Related topics
Deploy to a remote GPU
Run NemoClaw on a Brev GPU instance with the Telegram bridge enabled.
Approve network requests
Monitor and approve egress requests from the agent while it responds to Telegram messages.