Telegram MTProto
Interact with Telegram via the MTProto protocol — send messages, fetch chat history, list dialogs
Telegram MTProto is the native protocol powering the Telegram platform, offering lower-level access compared to the Bot API. It allows reading message history from regular accounts, listing all accessible dialogs, and sending messages programmatically.
With the Telegram MTProto integration in AACFlow, you can:
- Send messages: Dispatch text messages to any chat, group, or channel accessible to the account
- Get history: Retrieve the message history of a conversation
- List dialogs: Enumerate all dialogs (chats, groups, channels) available to the authenticated account
This integration is ideal for automation scenarios that require access beyond the Bot API scope, such as reading existing conversations or working with personal Telegram accounts.
Usage Instructions
Integrate Telegram MTProto into the workflow. Requires API ID and API Hash from my.telegram.org, and a session string for user account access (or a Bot Token for Bot API fallback).
Tools
telegram_mtproto_send_message
Send a message to a Telegram chat
Input
| Parameter | Type | Required | Description |
|---|---|---|---|
apiId | string | Yes | API ID from my.telegram.org, or Bot Token for Bot API |
apiHash | string | Yes | API Hash from my.telegram.org |
sessionString | string | No | Serialized session string for user account auth |
chatId | string | Yes | Target chat ID or username |
message | string | Yes | Text message to send |
Output
| Parameter | Type | Description |
|---|---|---|
messageId | number | ID of the sent message |
success | boolean | Whether the message was sent |
telegram_mtproto_get_history
Retrieve message history from a chat
Input
| Parameter | Type | Required | Description |
|---|---|---|---|
apiId | string | Yes | API ID or Bot Token |
apiHash | string | Yes | API Hash |
sessionString | string | No | Session string |
chatId | string | Yes | Chat ID or username |
limit | number | No | Number of messages to retrieve |
Output
| Parameter | Type | Description |
|---|---|---|
messages | array | Array of message objects |
count | number | Total messages returned |
telegram_mtproto_get_dialogs
List all accessible dialogs
Input
| Parameter | Type | Required | Description |
|---|---|---|---|
apiId | string | Yes | API ID or Bot Token |
apiHash | string | Yes | API Hash |
sessionString | string | No | Session string |
limit | number | No | Maximum dialogs to return |
Output
| Parameter | Type | Description |
|---|---|---|
dialogs | array | Array of dialog objects (chats, groups, channels) |
Links
- Official API: https://core.telegram.org/api
- AACFlow block source: apps/aacflow/blocks/blocks/telegram_mtproto.ts

