Send Telegram Document
Action ID: telegram_send_document
Description
Send a document to a Telegram chat. This node allows you to send any file as a document to individual users or group chats. Supports sending files by Telegram file ID, HTTP URL, or direct upload, with optional captions and metadata.
Provider
Telegram
Connection
Telegram Bot Connection
The Telegram bot connection to use for sending the document.
✓
telegram
Input Parameters
chat_id
string
✓
-
Unique identifier for the target chat or username of the target channel (in the format @channelusername)
document
string
✓
-
File to send. Pass a file_id as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data.
business_connection_id
string
-
-
Unique identifier of the business connection on behalf of which the message will be sent
message_thread_id
integer
-
-
Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
thumbnail
string
-
-
Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320.
caption
string
-
-
Document caption (may also be used when resending documents by file_id), 0-1024 characters after entities parsing
parse_mode
string
-
-
Mode for parsing entities in the document caption. Can be 'Markdown', 'MarkdownV2', or 'HTML'
caption_entities
array
-
-
A JSON-serialized list of special entities that appear in the caption
disable_content_type_detection
boolean
-
-
Disables automatic server-side content type detection for files uploaded using multipart/form-data
disable_notification
boolean
-
-
Sends the message silently. Users will receive a notification with no sound
protect_content
boolean
-
-
Protects the contents of the sent message from forwarding and saving
allow_paid_broadcast
boolean
-
-
Pass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee
message_effect_id
string
-
-
Unique identifier of the message effect to be added to the message; for private chats only
reply_parameters
object
-
-
Description of the message to reply to
reply_markup
object
-
-
Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, etc.
Output Parameters
sent_message
object
The message that was sent (if successful).
success
boolean
Whether the document was sent successfully.
error
string
The error that occurred if the document was not sent successfully.
How It Works
This node sends a document file to a specified Telegram chat. You can provide the document in three ways: using a Telegram file_id (fastest), providing an HTTP URL that Telegram can fetch, or uploading the file directly. The document can include a caption with optional text formatting (HTML/Markdown). Optional thumbnails and reply options can enhance the document message. The node returns success status and either the sent message details or error information.
Usage Examples
Example 1: Send PDF Document by File ID
Input:
chat_id: "123456789"
document: "BQACAgIAAxkBAAIBZ2Z-..."
caption: "Here's the project proposal document"
parse_mode: "HTML"Output:
success: true
sent_message: {
"message_id": 123,
"chat": {
"id": 123456789,
"type": "private"
},
"document": {
"file_id": "BQACAgIAAxkBAAIBZ2Z-...",
"file_name": "proposal.pdf",
"mime_type": "application/pdf",
"file_size": 245632
},
"caption": "Here's the project proposal document"
}Example 2: Send Document by URL to Group
Input:
chat_id: "-1001234567890"
document: "https://example.com/report.docx"
caption: "Monthly report - <b>November 2024</b>"
parse_mode: "HTML"
disable_notification: falseOutput:
success: true
sent_message: {
"message_id": 456,
"chat": {
"id": -1001234567890,
"type": "supergroup"
},
"document": {
"file_id": "BQACAgIAAxkBAAIBZ2Z-...",
"file_name": "report.docx",
"mime_type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"file_size": 523648
}
}Example 3: Send Spreadsheet to Channel with Protection
Input:
chat_id: "@mydocumentchannel"
document: "https://drive.example.com/data.xlsx"
caption: "Quarterly sales data"
protect_content: true
disable_notification: trueOutput:
success: true
sent_message: {
"message_id": 789,
"chat": {
"username": "mydocumentchannel",
"type": "channel"
},
"document": {
"file_id": "BQACAgIAAxkBAAIBZ2Z-...",
"file_name": "data.xlsx"
}
}Common Use Cases
Document Sharing: Share reports, presentations, or documents with users
File Distribution: Distribute files to groups or channels
Invoice Delivery: Send invoices or receipts to users
Contract Management: Share contracts or legal documents
Educational Materials: Distribute study materials or coursework
Backup Archives: Send backup files or archives
Team Collaboration: Share files with team members in groups
Error Handling
Invalid Chat ID
Chat ID doesn't exist or bot doesn't have access
Verify chat ID and ensure bot is member of chat/channel
Invalid Document
Document file is invalid or URL inaccessible
Check file format and ensure URL is publicly accessible
File Too Large
Document exceeds Telegram's size limit (2 GB)
Reduce file size or compress document
Invalid File ID
File ID is expired or invalid
Use a valid file_id or provide URL/file
Authentication Error
Bot token is invalid or expired
Verify Telegram connection configuration
Permission Denied
Bot lacks permission to send messages
Check bot permissions in chat/channel
Message Too Long
Caption exceeds 1024 characters
Reduce caption length
Invalid Parse Mode
Parse mode is not supported
Use 'Markdown', 'MarkdownV2', or 'HTML'
Timeout Error
Request took too long to complete
Try again or check connection
Notes
File ID Optimization: Using file_id is fastest and doesn't require re-uploading. Telegram stores file IDs indefinitely.
File Size Limit: Maximum file size is 2 GB. For very large files, consider splitting or compression.
Content Type Detection: Telegram automatically detects file type. Use disable_content_type_detection if you need to override this.
Captions: Use formatting (HTML or Markdown) for rich text captions with bold, italic, and links.
Silent Messages: Setting disable_notification=true prevents sound notifications for users.
Protected Content: Setting protect_content=true prevents forwarding and saving by users.
Message Effects: Message effects work only in private chats, not groups or channels.
Channel Access: To send to channels, use @channelname format and ensure bot is admin.
Last updated
Was this helpful?