Enhance Telegram service with multi-format support and chunking
All checks were successful
Validate / Hassfest (push) Successful in 2s

Renamed send_telegram_media_group to send_telegram_notification with expanded capabilities:
- Text messages (when urls is empty)
- Single photo/video (uses sendPhoto/sendVideo APIs)
- Media groups (uses sendMediaGroup API)
- Automatic chunking for unlimited media URLs
- Smart optimization: single-item chunks use appropriate single-item APIs

New parameters:
- max_group_size (2-10, default 10): control items per media group
- chunk_delay (0-60000ms, default 0): delay between chunks for rate limiting
- disable_web_page_preview: disable link previews in text messages

The service now intelligently selects the most efficient Telegram API endpoint based on content type and chunk size, with comprehensive error handling and logging.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-31 14:33:18 +03:00
parent 1cc5d7cc7d
commit 2ae706d700
6 changed files with 476 additions and 96 deletions

View File

@@ -123,7 +123,7 @@
},
"data_description": {
"scan_interval": "How often to check for album changes (10-3600 seconds)",
"telegram_bot_token": "Bot token for sending media groups to Telegram"
"telegram_bot_token": "Bot token for sending notifications to Telegram"
}
}
}
@@ -143,9 +143,9 @@
}
}
},
"send_telegram_media_group": {
"name": "Send Telegram Media Group",
"description": "Send media URLs to Telegram as a media group.",
"send_telegram_notification": {
"name": "Send Telegram Notification",
"description": "Send a notification to Telegram (text, photo, video, or media group).",
"fields": {
"bot_token": {
"name": "Bot Token",
@@ -157,15 +157,27 @@
},
"urls": {
"name": "URLs",
"description": "List of media URLs with type (photo/video)."
"description": "List of media URLs with type (photo/video). If empty, sends a text message. Large lists are automatically split into multiple media groups."
},
"caption": {
"name": "Caption",
"description": "Optional caption for the first media item."
"description": "Caption text. For media, applied to first item. For empty URLs, this is the message text."
},
"reply_to_message_id": {
"name": "Reply To",
"description": "Optional message ID to reply to."
},
"disable_web_page_preview": {
"name": "Disable Web Page Preview",
"description": "Disable link previews in text messages."
},
"max_group_size": {
"name": "Max Group Size",
"description": "Maximum number of media items per media group (2-10). Large lists will be split into multiple groups."
},
"chunk_delay": {
"name": "Chunk Delay",
"description": "Delay in milliseconds between sending multiple media groups (0-60000). Useful for rate limiting."
}
}
}