← Back to Plugins
Channels

Channel Telegram Userbot

overpod By overpod 👁 2 views ▲ 0 votes

OpenClaw channel plugin for Telegram userbot (MTProto via GramJS). Use your personal Telegram account as an AI assistant.

GitHub

Install

openclaw plugins install ./openclaw-channel-telegram-userbot

README

# openclaw-channel-telegram-userbot

OpenClaw channel plugin that connects your **personal Telegram account** (not a bot) to OpenClaw via MTProto.

Your AI assistant responds as **you** — from your real Telegram account.

## Features

- MTProto via [GramJS](https://github.com/gram-js/gramjs) (no Bot API)
- Works with your personal Telegram account
- DM and group chat support
- Configurable reply delay (appear more human)
- Chat allowlist / denylist
- Group mention requirements

## Requirements

- OpenClaw >= 2026.3.0
- Telegram API credentials from [my.telegram.org](https://my.telegram.org)
- Node.js >= 22 or Bun >= 1.0

## Installation

```bash
openclaw plugins install ./openclaw-channel-telegram-userbot
```

Or from npm (when published):

```bash
openclaw plugins install openclaw-channel-telegram-userbot
```

## Setup

### 1. Get Telegram API credentials

Go to [my.telegram.org](https://my.telegram.org), create an app, and note the `api_id` and `api_hash`.

### 2. Generate session string

```bash
cd openclaw-channel-telegram-userbot
bun run src/auth.ts
```

Follow the prompts to log in. You'll receive a session string.

### 3. Configure OpenClaw

```bash
openclaw config set channels.telegram-userbot.apiId 12345678
openclaw config set channels.telegram-userbot.apiHash "your_api_hash"
openclaw config set channels.telegram-userbot.sessionString "your_session_string"
```

Or add to `~/.openclaw/openclaw.json`:

```json5
{
  channels: {
    "telegram-userbot": {
      apiId: 12345678,
      apiHash: "abc123...",
      sessionString: "1BQA...",
      allowFrom: ["*"],
      replyDelaySec: 2,
      groups: {
        "*": { requireMention: true }
      }
    }
  }
}
```

### 4. Enable the plugin and restart

```bash
openclaw plugins enable telegram-userbot
# restart gateway
```

## Configuration

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| `apiId` | number | required | Telegram API ID |
| `apiHash` | string | required | Telegram API Hash |
| `sessionString` | string | required | GramJS session (from auth helper) |
| `allowFrom` | string[] | `["*"]` | Allowed chat IDs (`*` = all) |
| `replyDelaySec` | number | `2` | Delay before reply (seconds) |
| `groups` | object | `{}` | Per-group settings |
| `groups.*.requireMention` | boolean | `false` | Only respond when mentioned |
| `groups.*.enabled` | boolean | `true` | Enable/disable group |

## Security Warning

- Your session string grants **full access** to your Telegram account
- Keep it secret, never commit it to git
- Telegram may restrict accounts that automate excessively
- Use `replyDelaySec` and `allowFrom` to stay safe

## Development

```bash
bun install
bun run check        # lint + format check
bun run check:fix    # auto-fix
bun run typecheck    # TypeScript check
bun test             # run tests
```

## License

MIT
channels

Comments

Sign in to leave a comment

Loading comments...