Contents

Telegram Message

telegram_message_trigger · Nodes · Trigger · Trigger

Starts a workflow from Telegram messages.

Telegram Message Trigger#

Triggers workflows when Telegram messages are received by a configured bot. Supports message filtering, long polling, and webhook modes. Emits message data including text, sender info, and attachments.

When to Use#

  • Building Telegram bots that respond to user messages
  • Creating workflows triggered by Telegram commands
  • Processing incoming messages with attachments (photos, voice, documents)
  • Setting up automation based on Telegram activity
  • Building notification systems that react to Telegram messages

How It Works#

The Telegram Message Trigger connects to a configured Telegram bot and listens for incoming messages. Each message starts one run that receives the full message: text, sender, chat, and attachments. Runs start in the order Telegram sent the messages, including messages that arrive while earlier runs are still going.

The node supports two modes:

  • Long Polling (default): Actively polls Telegram servers for new messages
  • Webhook: Telegram pushes messages to your server (requires webhook URL configuration)

Several Workflows On One Bot#

Messages are fanned out, not consumed. One poller runs per bot connection and hands each update to every listening workflow, so any number of workflows can use the same Telegram connection and each one receives every message. Adding a second workflow does not take messages away from the first.

Filtering is each workflow's own job. A listener that should only react to some messages checks the message itself, using command_name, the chat id, or an If node on the message content. Two workflows listening to the same bot with no filtering both run on every message.

Configuration#

connection - Telegram bot connection to use

  • Select from workspace Settings → Connections
  • Must be a "telegram_bot" connection type
  • Required

mode - How to receive messages from Telegram

  • long_polling (default): Polls Telegram servers periodically
  • webhook: Telegram sends updates to your configured webhook URL
  • Long polling is simpler to set up; webhook is more efficient for high volume

Inputs#

This node has no inputs - it's a trigger node that starts workflows based on external Telegram events.

Outputs#

input - Telegram message data

On success, the output remains the existing Telegram message data shape:

{
  "update_id": 123456789,
  "message_id": 42,
  "chat_id": -1001234567890,
  "chat_type": "group",
  "date": 1704067200,
  "text": "Hello bot!",
  "caption": "Photo caption",
  "from": {
    "id": 987654321,
    "username": "johndoe",
    "first_name": "John",
    "last_name": "Doe"
  },
  "attachments": [
    {
      "file_id": "ABC123",
      "file_unique_id": "unique123",
      "file_name": "document.pdf",
      "mime_type": "application/pdf",
      "file_size": 12345,
      "width": null,
      "height": null,
      "duration": null,
      "attachment_type": "document"
    }
  ]
}

Fields:

  • update_id - Telegram update ID (for deduplication)
  • message_id - Message ID (use with reply_to_message_id in Telegram Send)
  • chat_id - Chat where message was sent (use to reply)
  • chat_type - Type: private, group, supergroup, or channel
  • date - Unix timestamp when message was sent
  • text - Message text content (null if only attachment)
  • caption - Caption for media messages
  • from - Sender information (id, username, first_name, last_name)
  • attachments - Array of attached files with metadata

Attachment object fields:

  • file_id - Telegram file ID (use with Telegram Download)
  • file_unique_id - Unique file ID across all bots
  • file_name - Original filename
  • mime_type - MIME type (e.g., "image/jpeg", "audio/ogg")
  • file_size - File size in bytes
  • width - Image/video width (if applicable)
  • height - Image/video height (if applicable)
  • duration - Audio/video duration in seconds (if applicable)
  • attachment_type - Type: photo, audio, voice, video, document

Examples#

Basic Message Echo Bot#

[Telegram Message Trigger]
    Connection: my-bot
    Mode: long_polling
    ↓ (input)
[Telegram Send]
    Connection: my-bot
    Chat ID: {{ input.chat_id }}
    Text: You said: {{ input.text }}
    Reply To: {{ input.message_id }}

Echoes every message back to the user with proper threading.

Command Handler#

[Telegram Message Trigger]
    Connection: my-bot
    ↓
[Branch]
    Condition: {{ input.text }} starts with "/start"
    ↓ true                    ↓ false
[Template: Welcome!]    [Template: Help text]
    ↓                           ↓
[Telegram Send]         [Telegram Send]

Handles /start and /help commands with different responses.

Photo Processor#

[Telegram Message Trigger]
    Connection: my-bot
    ↓ (input with photo attachment)
[Telegram Download]
    Connection: my-bot
    File ID: {{ input.attachments[0].file_id }}
    ↓ (downloaded image)
[AI Agent: Analyze image]
    ↓
[Telegram Send]
    Chat ID: {{ input.chat_id }}
    Text: Analysis: {{ ai.response }}

Receives photos, downloads them, analyzes with AI, and responds.

Voice Message Transcription#

[Telegram Message Trigger]
    Connection: my-bot
    ↓ (voice attachment)
[Telegram Download]
    ↓ (voice file)
[Transcribe Audio]
    ↓
[Telegram Send]
    Text: You said: {{ transcribe.text }}

Transcribes voice messages and sends the text back.

Runtime Errors#

Error Cause Remediation
"Telegram bot connection is not selected" Connection field is empty Configure a Telegram bot connection in Settings
"Failed to acquire Telegram bot" Bot token invalid or connection misconfigured Verify bot token in connection settings
"Failed to start polling" Network issues or bot already polling elsewhere Check network; ensure no other instance is polling the same bot

Long-polling, listener, and authorization errors start a workflow execution that fails at the trigger node through the normal workflow error pipeline.

Common Mistakes#

  • Webhook without URL: Selecting webhook mode without configuring webhook URL

    • Error: Messages won't be received
    • Fix: Configure webhook URL in bot settings or use long_polling
  • Expecting immediate response: Trigger workflows are async

    • Issue: User doesn't see immediate feedback
    • Fix: Use Telegram Send node early in workflow to acknowledge receipt
  • Not handling all message types: Assuming text field always exists

    • Error: Null pointer when processing media-only messages
    • Fix: Check if text exists before using it; handle attachments separately

Tips#

  • Reply quickly with Telegram Send to acknowledge message receipt before heavy processing
  • Store chat_id and message_id for later replies (e.g., after async processing)
  • Check attachments array length before accessing - not all messages have attachments
  • Use from.id to identify users consistently (username can change)
  • The bot must have privacy mode disabled in BotFather to see all group messages
  • For production, webhook mode is more efficient than long polling
  • Combine with Telegram Download to process attachments (photos, voice, documents)
  • Messages can be edited - check if you need to handle edit events separately
  • Use deduplication logic if you need exactly-once processing (check update_id)

Inputs

None.

Outputs

  • input

Configuration

FieldTypeRequiredDescription
connectionconnection(telegram_bot)Yes
modeenum(long_polling, webhook)No
base_configrecordNoShared node configuration. failure_mode decides what a failure of this node does to the workflow; leave it at the default stop unless the workflow handles the failure itself on the node's error output (route_to_error) or the node is a rare emergency kill switch (stop_workflow).