Telegram Channel
The Telegram adapter connects a Telegram bot to a Cortask workspace using long-polling via the grammY library.
Creating a Telegram Bot
- Open Telegram and search for @BotFather.
- Send
/newbotand follow the prompts to choose a name and username. - BotFather will reply with a bot token (a string like
123456:ABC-DEF...). Copy it.
Configuring the Bot Token
In the Cortask UI, go to your workspace's channel settings and add a Telegram channel. Paste the bot token from BotFather.
You can also configure an allowed users list with Telegram user IDs or usernames. If the list is empty, anyone can message the bot. If populated, only those users are authorized -- unauthorized users receive a rejection message.
Starting and Stopping
- Start: The adapter begins long-polling the Telegram Bot API. It processes one message at a time per chat.
- Stop: Polling stops and the bot goes offline. Pending messages are not lost -- Telegram queues them and delivers them when the bot reconnects.
Start and stop the channel from the workspace settings in the UI, or through the CLI and REST API.
Message Flow
- User sends a text message to the bot in Telegram.
- The adapter checks the allowed users list.
- The message text is forwarded to the mapped workspace's agent.
- The agent response is sent back as a Telegram reply with Markdown formatting.
- If Markdown parsing fails, the response falls back to plain text.
Limitations
- Text only: The adapter processes
message:textevents. Photos, voice messages, stickers, and other media types are ignored. - Message length: Telegram enforces a 4,096-character limit per message. Long responses are automatically split at natural break points (newlines, then spaces).
- No inline/callback queries: The adapter does not handle inline queries or callback buttons.
- Single handler: All messages for a channel route to one workspace. There is no per-chat routing.