Telegram

PocketPaw supports Telegram via the python-telegram-bot library. It works as a standard Telegram bot with support for topics, inline keyboards, and streaming.

Setup

Create a bot

  1. Open Telegram and search for @BotFather
  2. Send /newbot and follow the prompts
  3. Copy the bot token

Configure

Terminal window
export POCKETCLAW_TELEGRAM_TOKEN="your-bot-token"

Start

Terminal window
# Telegram-only mode
pocketpaw --telegram
# Or via web dashboard (configure in Channels modal)
pocketpaw

Configuration

SettingEnv VariableDescription
Bot tokenPOCKETCLAW_TELEGRAM_TOKENBot token from BotFather
Allowed user IDsPOCKETCLAW_ALLOWED_TELEGRAM_IDSComma-separated user IDs

Features

Streaming

Telegram supports edit-in-place streaming. The bot sends an initial message and then edits it as more tokens arrive, giving a real-time typing effect.

Topic Support

PocketPaw supports Telegram’s topic feature (available in groups with topics enabled). Each topic gets its own session:

  • Session key format: {chat_id}:topic:{topic_id}
  • Messages in different topics maintain separate conversation histories

Access Control

Restrict access by specifying allowed Telegram user IDs:

Terminal window
export POCKETCLAW_ALLOWED_TELEGRAM_IDS="123456,789012"

Only users with these IDs can interact with the bot. If not set, anyone can use the bot.

Commands

The bot responds to direct messages and can be configured with custom commands via BotFather’s /setcommands.

Installation

Terminal window
curl -fsSL https://pocketpaw.xyz/install.sh | sh
# Or add the Telegram extra manually
pip install pocketpaw[telegram]

This installs python-telegram-bot as a dependency.