Skip to content

telegram

diapason.channels.telegram

TelegramChannel — native Telegram Bot API adapter.

TelegramChannel

Bases: BaseChannel

Native Telegram channel adapter using the Bot API.

Parameters

bot_token: Telegram Bot API token. Falls back to TELEGRAM_BOT_TOKEN env var. allowed_chat_ids: Comma-separated list of chat IDs allowed to interact. parse_mode: Message parse mode (Markdown, HTML, etc.). bus: Optional event bus for publishing channel events.

connect()

Start listening for incoming messages via long polling.

disconnect()

Stop the listener thread.

list_channels()

Return available channel identifiers.

on_message(handler)

Register a callback for incoming messages.

send(channel, content, *, conversation_id='', metadata=None)

Send a message to a Telegram chat via the Bot API.

status()

Return the current connection status.