Requirements
- A bot token from @BotFather (create a bot with
/newbot, copy the token). - The
python-telegram-botlibrary (installed with Flowly's Telegram extra).
Configuration
Set under channels.telegram in ~/.flowly/config.json:
{
"channels": {
"telegram": {
"enabled": true,
"token": "123456:ABC-...",
"allowFrom": [],
"dmPolicy": "pairing"
}
}
}| Key | Type | Default | Description |
|---|---|---|---|
enabled | bool | false | Start the Telegram adapter at gateway boot. |
token | string | "" | Bot token from @BotFather. |
allowFrom | string[] | [] | Allowed user IDs or usernames. Empty = allow all (subject to dmPolicy). |
dmPolicy | "open" | "pairing" | "allowlist" | "pairing" | DM access policy (see below). |
DM access policy
openβ anyone who messages the bot is allowed.pairingβ unknown senders receive an 8-character pairing code and instructions; you approve it from the CLI.allowlistβ unknown senders are silently blocked; onlyallowFrom+ approved pairing entries are allowed.
The Telegram adapter unions allowFrom with the approved pairing allow-store and matches a sender by ID, username, @username, or telegram:{id}.
Connect method
Long polling via python-telegram-bot. The adapter registers native bot commands and handlers for text, photo, voice, audio, and documents, plus inline-button exec-approval callbacks. On startup it calls Telegram with drop_pending_updates=true, so messages received while the bot was offline are discarded.
Pairing / allowlist
When a sender hits the bot in pairing mode, they get a code. Approve it:
flowly pairing list telegram
flowly pairing approve telegram <CODE> --notify
flowly pairing allowed telegram
flowly pairing revoke telegram <user_id>--notify sends an "approved" DM to the user (Telegram only). Codes expire after 1 hour; up to 3 pending requests are kept per channel.
Setup steps
- Create a bot in @BotFather and copy the token.
- Set
channels.telegram.enabledtotrueand paste thetoken. - Choose a
dmPolicy(pairingis the default). - Start the gateway:
flowly gateway. - Message your bot. In
pairingmode, runflowly pairing approve telegram <code>with the code it gives you.
Exec-approval prompts are delivered as inline buttons in your Telegram chat β see Sandbox & approvals.