Back to Autogpt

Telegram Triggers

docs/integrations/block-integrations/telegram/triggers.md

0.6.444.9 KB
Original Source

Telegram Triggers

<!-- MANUAL: file_description -->

These trigger blocks let your agent receive incoming messages and reactions from Telegram in real time via webhooks. When a user sends a message or reacts to one, the trigger fires and outputs structured data (chat ID, user info, message content, file IDs) that downstream blocks can process.

<!-- END MANUAL -->

Telegram Message Reaction Trigger

What it is

Triggers when a reaction to a message is changed. Works in private chats automatically. In groups, the bot must be an administrator.

How it works

<!-- MANUAL: how_it_works -->

This block uses the Telegram Bot API webhook system, subscribing to message_reaction updates. When a user adds, changes, or removes a reaction on a message in a chat with your bot, Telegram sends an update to the registered webhook URL. The block extracts the chat ID, message ID, reacting user's info, and both the old and new reaction lists. In private chats this works automatically; in group chats the bot must be an administrator to receive reaction updates.

<!-- END MANUAL -->

Outputs

OutputDescriptionType
errorError message if the operation failedstr
payloadThe complete webhook payload from TelegramDict[str, Any]
chat_idThe chat ID where the reaction occurredint
message_idThe message ID that was reacted toint
user_idThe user ID who changed the reactionint
usernameUsername of the user (may be empty)str
new_reactionsList of new reactions on the messageList[Any]
old_reactionsList of previous reactions on the messageList[Any]

Possible use case

<!-- MANUAL: use_case -->

Sentiment tracking — Monitor reactions on bot-posted announcements to gauge audience sentiment in real time.

Approval workflows — Use a thumbs-up reaction as a lightweight approval signal to trigger downstream actions like deployments or task assignments.

Engagement analytics — Aggregate reaction data across messages to identify which content resonates most with your audience.

<!-- END MANUAL -->

Telegram Message Trigger

What it is

Triggers when a message is received or edited in your Telegram bot. Supports text, photos, voice messages, audio files, documents, and videos.

How it works

<!-- MANUAL: how_it_works -->

This block registers a webhook with the Telegram Bot API that subscribes to message and edited_message updates. Incoming messages are routed by content type — text, photo, voice, audio, document, or video — based on the event filter you configure. When a matching message arrives, the block extracts common fields (chat ID, sender info, message ID) along with type-specific data such as the text content, file IDs for media, or captions. File IDs can be passed to the Get Telegram File block to download the actual media. If the "edited_message" event is enabled, the block also fires when a user edits a previously sent message, with the is_edited output set to true.

<!-- END MANUAL -->

Inputs

InputDescriptionTypeRequired
eventsTypes of messages to receiveMessage TypesYes

Outputs

OutputDescriptionType
errorError message if the operation failedstr
payloadThe complete webhook payload from TelegramDict[str, Any]
chat_idThe chat ID where the message was received. Use this to send replies.int
message_idThe unique message IDint
user_idThe user ID who sent the messageint
usernameUsername of the sender (may be empty)str
first_nameFirst name of the senderstr
eventThe message type (text, photo, voice, audio, etc.)str
textText content of the message (for text messages)str
photo_file_idFile ID of the photo (for photo messages). Use GetTelegramFileBlock to download.str
voice_file_idFile ID of the voice message (for voice messages). Use GetTelegramFileBlock to download.str
audio_file_idFile ID of the audio file (for audio messages). Use GetTelegramFileBlock to download.str
file_idFile ID for document/video messages. Use GetTelegramFileBlock to download.str
file_nameOriginal filename (for document/audio messages)str
captionCaption for media messagesstr
is_editedWhether this is an edit of a previously sent messagebool

Possible use case

<!-- MANUAL: use_case -->

Conversational AI bot — Receive text messages from users and feed them into an AI agent that generates and sends replies.

Photo processing pipeline — Trigger on incoming photos, download them with Get Telegram File, run image analysis or OCR, and reply with the results.

Voice message transcription — Capture voice messages, download the audio file, pass it to a speech-to-text service, and send the transcript back to the user.

<!-- END MANUAL -->