Telegram Download
telegram_download · Nodes · Providers
Downloads a Telegram file as inline binary data, or saves it into a Library item.
Telegram Download#
Downloads a Telegram file as inline binary data for downstream processing, or saves it straight into a Library item.
When to Use#
- Processing photos sent to your Telegram bot
- Transcribing voice messages with Transcribe Audio
- Saving documents received via Telegram
- Forwarding media between chats with modifications
- Analyzing images or videos from Telegram messages
- Archiving attachments from Telegram conversations
How It Works#
The Telegram Download node takes a file_id (from Telegram Message Trigger output) and:
- Fetches file info: Gets download URL from Telegram API
- Downloads content: Retrieves file bytes from Telegram servers
- Returns the file: with destination Output, outputs
NodeData::Binaryfor direct downstream use; with destination Library, streams the file into a Library item and outputs its descriptor
With destination Output, the node accepts files up to 50 MB and the bytes flow directly to downstream nodes like Transcribe Audio or Telegram Send without a storage step. With destination Library, the file is written to storage as it arrives and never passes through the workflow; on any failure nothing is left behind. Either way the node extracts metadata (dimensions for images/videos, duration for audio).
Telegram's Bot API lets a bot download files up to 20 MB. With destination Library, a larger file is refused before anything is downloaded, with "Telegram lets a bot download files up to 20 MB; this file is ".
Configuration#
connection - Telegram bot connection to use
- Select from workspace Settings → Connections
- Must be a "telegram_bot" connection type
- Required
destination - Where the file goes. Default: {"to": "output"}
{"to": "output"}- the node's output, as inline binary data{"to": "library", "name": "...", "place": "folder", "folder": "..."}- a Library item; the node outputs its descriptor undermedianame- the item's name; empty takes the attachment'sfile_name, else the name Telegram gives the fileplace- defaults to Folder (folder). Choose Other (other) to file the item outside every folder.folder- folder slugs or ids from the Library root, separated by/. Every folder must already exist. Use the Library node's Create Folder first if you need a new folder.nameandfolderaccept{{ }}references
retry - Whether a request is sent again after a failure that passes: a rate limit, a busy server, a dropped connection. Off by default; see Retries for how attempts and waits work. Fetching file info is a POST, treated as a write: sent again only when Telegram refused it before acting, meaning the connection never opened or Telegram answered 425 or 429. Downloading the file content is a read, sent again freely.
Inputs#
attachment - Attachment info from Telegram Message Trigger
- File info MUST come via this input socket
{
"file_id": "ABC123",
"file_unique_id": "unique123",
"file_name": "document.pdf",
"mime_type": "application/pdf",
"file_size": 12345
}
If provided, extracts file_id from this object. Useful when processing multiple attachments in a loop.
Outputs#
output - The downloaded file with metadata. With destination Output, the file is inline NodeData::Binary:
{
"binary": { "__binary__": true, "mime_type": "audio/ogg", "size_bytes": 54321 },
"filename": "voice_message.oga",
"content_type": "audio/ogg",
"size_bytes": 54321,
"metadata": {
"type": "audio",
"width": null,
"height": null,
"duration": 15
}
}
Fields:
binary- Inline binary data (bytes, mime_type, filename). Flows directly to downstream nodes that acceptNodeData::Binaryinputs.filename- Original filenamecontent_type- MIME typesize_bytes- File sizemetadata- Additional metadata (type, width, height, duration)
Binary data flows inline through the runtime graph.
With destination Library, media (the saved item's object descriptor) takes the place of binary, and size_bytes is the stored size:
{
"media": { "object_id": "01J...", "kind": "video", "content_type": "video/mp4", "filename": "clip.mp4", "size_bytes": 8123456 },
"filename": "clip.mp4",
"content_type": "video/mp4",
"size_bytes": 8123456,
"metadata": { "type": "video", "width": 1280, "height": 720, "duration": 42 }
}
A later step names the item by media.object_id.
Examples#
Download and Transcribe Voice (inline binary)#
[Telegram Message Trigger]
↓ (voice message attachment)
[Telegram Download]
Connection: my-bot
File ID: {{ output.attachments[0].file_id }}
↓ (binary inline — no storage needed)
[Transcribe Audio]
↓
[Telegram Send]
Text: You said: {{ transcribe.text }}
Receives a voice message, downloads it, transcribes to text, and sends the transcription back. Binary flows inline from Download to Transcribe Audio — no Upload Media required.
For video messages, use Extract Audio before transcription:
Telegram Download -> Extract Audio -> Transcribe Audio
Download and Transcribe Voice (with durable storage)#
For cases where the download should be persisted, insert Upload Media:
[Telegram Message Trigger]
↓ (voice message attachment)
[Telegram Download]
↓ (binary)
[Upload Media]
↓ ({object_id, ...})
[Transcribe Audio]
↓
[Telegram Send]
Process All Attachments in Loop#
[Telegram Message Trigger]
↓ (message with multiple photos)
[Loop]
Array: {{ output.attachments }}
↓ (each attachment)
[Telegram Download]
Connection: my-bot
Attachment: {{ item }} (wired from loop)
↓ (binary inline)
[AI Agent: Analyze image]
↓
[Telegram Send]
Text: Image analysis: {{ ai.response }}
Downloads and analyzes each photo in a multi-photo message. Binary flows inline from Download to AI Agent images socket.
Save Document to Knowledge#
[Telegram Message Trigger]
Filter: PDF documents only
↓ (document attachment)
[Telegram Download]
Connection: my-bot
↓
[Extract Text from PDF]
↓
[Knowledge Create]
Content: {{ extracted_text }}
Title: {{ output.filename }}
Downloads PDFs sent to the bot and adds them to the knowledge base.
Forward with Caption#
[Telegram Message Trigger]
Chat A
↓ (photo with caption)
[Telegram Download]
↓
[Template]
"Forwarded from Chat A: {{ trigger.output.caption }}"
↓
[Telegram Send]
Chat B
Text: {{ template.output }}
Attachment: {{ download.output }}
Forwards photos from one chat to another with modified captions. Telegram Send detects the {binary} payload and sends the bytes directly.
Runtime Errors#
| Error | Cause | Remediation |
|---|---|---|
| "Telegram bot connection is not selected" | Connection field is empty | Configure a Telegram bot connection in Settings |
| "No file_id provided" | Both config file_id and input attachment are empty | Provide file_id in config or wire attachment input |
| "Failed to acquire Telegram bot" | Bot token invalid | Verify bot token in connection settings |
| "Failed to get file info" | File ID invalid or file expired | File IDs can expire; download promptly after receiving |
| "File path not available" | File too large or temporarily unavailable | Telegram files > 20MB may have access issues |
| "Telegram lets a bot download files up to 20 MB; this file is …" | Destination Library, and the file is over Telegram's bot download limit, or Telegram did not hand out its path | Filter by file_size before downloading; Telegram serves a bot nothing larger |
| "File too large" | File exceeds 50MB limit | Telegram bots can't download files larger than 20MB via API |
| "Failed to download file" | Network error or Telegram server issue | Retry the workflow; check Telegram status |
Common Mistakes#
Using file_unique_id instead of file_id: These are different
- Error: "File not found" or download fails
- Fix: Use
attachments[].file_idnotattachments[].file_unique_id
Waiting too long to download: File IDs expire
- Error: "File path not available" or download fails
- Fix: Download files immediately after receiving them
Trying to download large files: Telegram bot API has limits
- Error: "File too large" (files > 20MB)
- Fix: Use userbot (MTProto) for large files, or filter by file_size
Not checking if attachment exists: Some messages have no attachments
- Error: "No file_id provided" or null reference
- Fix: Check
attachmentsarray length before accessing
Tips#
- Download files immediately - Telegram file IDs can expire after some time
- Check
file_sizebefore downloading if you want to skip large files - For voice messages, the file is typically OGG format - transcription providers handle this natively
- Binary data flows inline through the runtime graph. Connect Upload Media if you need durable persistence
- Connect directly to AI Agent images/files sockets or Transcribe Audio without Upload Media
- Combine with AI nodes to analyze images, transcribe audio, or parse documents
- For batch processing, put this node inside a Loop iterating over attachments
- The node preserves metadata (dimensions, duration) for downstream processing
- Consider adding a Size Check node before downloading to skip files > 10MB
Inputs
attachmentOptional
Outputs
output
Configuration
| Field | Type | Required | Description |
|---|---|---|---|
connection | connection(telegram_bot) | Yes | |
retry | tagged_union | No | Sends a request again after a failure that passes: a rate limit, a busy server, a dropped connection. Off sends once. |
destination | tagged_union | No | Where the download goes: the node's output, or a Library item whose descriptor the node outputs. |
base_config | record | No | Shared 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). |