Skip to main content
The Telegram channel gateway turns your Telegram bot into a full conversational interface for Polpo. Send messages, run commands, approve tasks, and manage your project — all from Telegram.
This page covers interactive messaging (talking to Polpo via Telegram). For one-way notification delivery (Polpo sending you alerts), see Telegram Notifications.

Setup

  1. Create a Telegram bot via @BotFather and save the bot token.
  2. Get your chat ID — message the bot, then call:
    https://api.telegram.org/bot{TOKEN}/getUpdates
    
    Look for chat.id in the response.
  3. Configure the gateway in polpo.json:
    {
      "settings": {
        "notifications": {
          "channels": {
            "telegram": {
              "type": "telegram",
              "botToken": "${TELEGRAM_BOT_TOKEN}",
              "chatId": "-1001234567890",
              "gateway": {
                "enableInbound": true,
                "dmPolicy": "allowlist",
                "allowFrom": ["YOUR_TELEGRAM_USER_ID"]
              }
            }
          }
        }
      }
    }
    
  4. Start Polpo — the gateway activates automatically:
    polpo serve
    

Gateway Configuration

The gateway object on a notification channel enables inbound messaging:
FieldTypeDefaultDescription
enableInboundbooleanfalseEnable the conversational gateway
dmPolicystring"allowlist"Who can message the bot: open, allowlist, pairing, disabled
allowFromstring[][]Telegram user IDs or peer IDs allowed to message. Use ["*"] for everyone
sessionIdleMinutesnumber60Auto-reset session after idle period

DM Policies

Control who can interact with your bot:
PolicyBehavior
openAnyone can message the bot
allowlistOnly users in allowFrom or the dynamic allowlist can message
pairingUnknown users get a pairing code. An admin approves the code to grant access
disabledInbound messages are silently ignored

Pairing Flow

With "dmPolicy": "pairing", new users are onboarded securely:
  1. Unknown user messages the bot
  2. Bot replies with a 6-character pairing code (e.g., ABC123)
  3. An admin approves the code via:
    • Telegram: /pair ABC123
    • REST API: POST /api/v1/projects/:id/peers/pair with {"code": "ABC123"}
    • TUI or Web UI
  4. The user is added to the allowlist and can now chat freely
Pairing codes expire after 1 hour. Max 3 pending codes per channel.

Slash Commands

Send these commands as Telegram messages:
CommandDescription
/helpShow all available commands
/statusProject status — task counts, active agents, connected peers
/tasksList tasks with status
/missionsList missions
/agentsList agents with active/idle status
/approve [ID]List pending approvals, or approve a specific one
/reject ID [reason]Reject an approval with feedback
/newReset your conversation session
/pair CODEApprove a pairing request (admin only)

Free-Text Chat

Any message that isn’t a slash command is routed to Polpo’s agentic completions loop. You can:
  • Ask questions about your project
  • Create tasks and missions
  • Get status updates
  • Request code changes
You: Create a task to fix the login validation bug in src/auth/login.ts

Polpo: Created task "Fix login validation bug" and assigned it to backend-dev.
The agent will look at src/auth/login.ts and fix the validation logic.
Each peer gets their own conversation session, with history preserved across messages. Sessions auto-reset after the configured idle period (default: 60 minutes), or manually with /new.

Interactive Approvals

When an approval gate is triggered, the bot sends a message with Approve and Reject inline buttons:
  • Approve — immediately approves the pending request
  • Reject — prompts for feedback. Your next message is captured as rejection feedback and the task retries with your notes
This works alongside the slash commands (/approve, /reject) — use whichever is more convenient.

Multi-User Support

The gateway supports multiple users on the same bot:
  • Peer identity — each user is identified by their Telegram user ID (telegram:{userId})
  • Session isolation — each user gets their own conversation thread
  • Presence tracking — Polpo tracks who’s currently active
  • Identity linking — link a Telegram identity to a WhatsApp identity (or any other channel) to share sessions across channels

Peer Management API

Manage peers via the REST API:
MethodPathDescription
GET/peersList known peers
GET/peers/presenceOnline peers and activity
GET/peers/allowlistCurrent allowlist
POST/peers/allowlistAdd peer to allowlist
DELETE/peers/allowlist/:idRemove from allowlist
POST/peers/pairApprove a pairing code
POST/peers/linkLink two peer identities

Example Configurations

Personal Use (open)

{
  "gateway": {
    "enableInbound": true,
    "dmPolicy": "open"
  }
}

Team Use (allowlist)

{
  "gateway": {
    "enableInbound": true,
    "dmPolicy": "allowlist",
    "allowFrom": ["123456789", "987654321"]
  }
}

Secure Team (pairing)

{
  "gateway": {
    "enableInbound": true,
    "dmPolicy": "pairing",
    "allowFrom": ["123456789"],
    "sessionIdleMinutes": 30
  }
}
The admin (123456789) is pre-authorized and can approve pairing codes for new team members.
With "dmPolicy": "open", anyone who discovers your bot can interact with it and control your agents. Use allowlist or pairing for any non-personal deployment.