# How to install OpenClaw and connect Telegram

Plan on about half an hour from a bare machine to an agent that answers you in Telegram. The commands shown come from the official docs, so compare them with the version you install.

## What you need

- A computer or VPS running macOS, Linux, WSL2 or Windows
- Node 24.16+ or Node 26, which the installer can add for you
- An API key or subscription for a model, or a local model
- A Telegram account

## Step by step

### 1. Choose a machine and create a bot

A laptop is fine for a trial, while an always-on agent belongs on a small VPS or home server, and the gateway port should never be open to the internet. In Telegram, message @BotFather after checking the handle carefully, run /newbot and copy the token it gives you.

### 2. Install OpenClaw

Run the official installer for your system. It detects the OS, adds Node if it is missing, installs OpenClaw and then starts onboarding.

```bash
# macOS / Linux / WSL2
curl -fsSL https://openclaw.ai/install.sh | bash

# Windows (PowerShell)
iwr -useb https://openclaw.ai/install.ps1 | iex
```

### 3. Onboard and install the gateway service

Pick Quick start to reuse the AI access it detects, or Custom setup for every option. When onboarding ends, stop the gateway running in the foreground and install it as a background service so it restarts after a reboot.

```bash
openclaw onboard
# after the quick start, stop the foreground gateway (Ctrl+C), then:
openclaw gateway install
```

### 4. Add the Telegram channel

Add Telegram as a channel using your bot token. Then probe the channel status to confirm the connection works.

```bash
openclaw channels add --channel telegram --token <bot-token>
openclaw channels status --probe
```

### 5. Approve your pairing

Send any message to your bot. Unknown senders receive a pairing code instead of a reply, so list the pending requests and approve your own code within an hour.

```bash
openclaw pairing list telegram
openclaw pairing approve telegram <CODE>
```

### 6. Audit and update

Run the built-in security audit and update from the stable channel. Versions older than 2026.4.22 have known critical vulnerabilities, so never stay on one.

```bash
openclaw security audit
openclaw update --channel stable
```

## First things to do after setup

- Leave dmPolicy on pairing so strangers who find your bot cannot use it.
- Set exec approvals to always ask until you trust your setup.
- Repeat the security audit and update regularly.

## Common mistakes

- Exposing the gateway port instead of keeping gateway.bind on loopback and connecting over SSH or Tailscale.
- Installing lots of third-party skills; treat them like browser extensions and add only a few from sources you trust.
- Forgetting that an agent stuck in a loop keeps spending model tokens.
