Building a coding agent that responds to your commands over Telegram sounds complex, but with the right tools and a focused approach, it can be done in under 45 minutes. This guide focuses on the minimal viable setup: a single Telegram topic where you type a request and receive an automated response that drives a tmux pane on your local machine. Advanced features like memory management, tool servers, and multi-agent supervision will come later.
The process is divided into two paths: a fast-track approach using pre-built scripts for automated setup, and a manual path for those who prefer to understand each step. Regardless of the path you choose, the core prerequisites remain the same. Skipping these checks is the most common reason for failure in solo setups.
Essential Prerequisites for a Smooth Setup
Before diving into the code, verify that your environment meets the technical requirements. These are not optional suggestions; they are hard constraints that determine whether the system will function reliably.
- A controlled environment: You need a dedicated machine or virtual environment with
tmuxinstalled. This environment must retain shell access even after you disconnect, as the gateway will run continuously in the background.
- A functional coding agent: Your chosen agent (e.g., OpenClaw, Codex, or Claude Code) must already be installed, authenticated, and operational in a tmux pane. This agent should respond to manual commands before you automate it. OpenClaw acts as a supervisor, not a replacement, for your core agent.
- A stable target pane: Identify and record the exact tmux pane identifier where your agent runs (e.g.,
mybox:1.1). This identifier will be hardcoded into the agent’s instructions and must remain consistent.
- The agent launch command: Prepare the exact command that starts your coding agent in the tmux pane, including any session resumption logic. OpenClaw requires this command verbatim to initialize the agent correctly.
- OpenClaw runtime: Install OpenClaw and pin its runtime to the specified versions. The gateway is particularly sensitive to the Node.js version, and using an unsupported version is a frequent cause of silent failures.
- Telegram account and mobile app: Ensure you have a Telegram account with the mobile app installed, as some setup steps require real-time verification.
Version Compatibility Matrix
Do not assume compatibility—pin these versions explicitly in your environment.
- Node.js: Version
24.11.1is mandatory. The gateway is built against this specific version, and newer major releases may break native module builds. - Package manager: Use
pnpm 11.2.2, which OpenClaw specifies in its configuration file. Corepack can automate the installation of this version. - OpenClaw: Clone the repository using a pinned commit or tag (e.g.,
2026.5.27) to ensure reproducibility. Avoid tracking themainbranch, as it may introduce untested changes. - Coding agent: Install and authenticate the agent version your team standardizes on (e.g., OpenClaw-compatible agents like Codex or Claude Code).
- Node version manager: Use
nvmfor Node.js management. If you use alternatives likeasdfor system Node, adapt the installation commands accordingly.
Fast-Track Deployment with Pre-Built Scripts
If you want to skip manual steps and validate the setup quickly, leverage the provided bootstrap scripts. These scripts automate the runtime pinning, OpenClaw installation, and gateway launch, reducing the setup time to a matter of minutes.
Download the scripts from the provided gist and make them executable:
curl -fsSL " -o setup-openclaw.sh
curl -fsSL " -o ready-check.sh
chmod +x setup-openclaw.sh ready-check.shRun the setup script, passing your Telegram bot token to generate a basic configuration file automatically:
OPENCLAW_BOT_TOKEN="<BOT_TOKEN>" OPENCLAW_BOT_ACCOUNT="my-bot" ./setup-openclaw.shThis script performs the following actions:
- Installs Node.js
24.11.1vianvm. - Enables and prepares
pnpm 11.2.2using Corepack. - Clones and builds the OpenClaw repository.
- Launches the gateway in a tmux session for persistence.
After completing the Telegram setup (detailed in the next section), validate the system using the readiness script:
AGENT_ID=my-agent PANE=mybox:1.1 ./ready-check.shIf the readiness check passes, your coding agent is now operational over Telegram. For those who prefer to understand the underlying mechanics, the manual path provides full transparency.
Manual Setup: Step-by-Step Control
The manual approach breaks the process into three logical stages: configuring Telegram, preparing your local environment, and connecting the two systems.
Stage 1: Telegram Configuration
To proceed, you must be the group’s creator in Telegram, as some administrative actions require elevated permissions.
- Create a bot: Open Telegram, search for
@BotFather, and use the/newbotcommand. Assign a name and save the bot token securely—treat it like a password. - Create a group: Generate a new group, name it appropriately, and add your newly created bot to it.
- Promote the bot to admin: Navigate to Group → Edit → Administrators and promote your bot. Without admin privileges, Telegram’s privacy mode will block the bot from receiving group messages, rendering it useless.
- Enable Topics: Convert the group into a forum-style supergroup by enabling Topics (Group → Edit → Topics). This allows you to organize conversations into distinct threads.
- Create a topic: Add a topic named after your project (e.g.,
project-a) and send a test message in it. This action ensures the group and topic IDs become visible in the gateway logs for later retrieval.
You also need your Telegram user ID for the allowlist. Send a message to @userinfobot, and it will reply with your numeric ID. Alternatively, this ID will appear in the gateway logs once messages start flowing.
Stage 2: Local Environment Configuration
The gateway requires a minimal configuration file before it can interact with Telegram. Create the file at ~/.openclaw/openclaw.json using strict JSON syntax (no comments, no trailing commas):
{
"channels": {
"telegram": {
"enabled": true,
"accounts": {
"<your-bot-account>": {
"botToken": "<BOT_TOKEN>"
}
}
}
}
}Secure the file and validate its syntax:
chmod 600 ~/.openclaw/openclaw.json
python3 -c "import json; json.load(open('$HOME/.openclaw/openclaw.json')); print('JSON OK')"Next, install and build OpenClaw manually. Start by setting up the correct Node.js runtime and package manager:
nvm install 24.11.1 && nvm use 24.11.1
corepack enable && corepack prepare pnpm@11.2.2 --activateClone the OpenClaw repository and build it:
git clone ~/repos/openclaw
cd ~/repos/openclaw
# Optional: pin a specific commit for reproducibility
# git checkout <commit-or-tag>
pnpm install
pnpm buildFinally, launch the gateway in a dedicated tmux session to ensure it remains active after you log out:
pnpm gateway:watchCheck the log path specified in your configuration to monitor the gateway’s status and verify that it has successfully connected to Telegram.
Next Steps: Beyond the Basics
Once your coding agent responds to Telegram commands, the foundation is laid. Future enhancements could include adding memory persistence, integrating monitoring tools, or expanding the agent’s capabilities with additional servers. For now, focus on refining your local setup and testing its reliability before introducing complexity.
The goal was never to build a fully autonomous system on day one, but to establish a working channel between your coding environment and Telegram. With this setup operational, you’re ready to iterate and scale according to your needs.
AI summary
Learn how to build and deploy a self-hosted coding assistant on Telegram that interacts with your local tmux environment. Follow this step-by-step guide for a fast, reliable setup.