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

@@ -25,9 +25,9 @@ get_recent_assets:
max: 100
mode: slider
send_telegram_media_group:
name: Send Telegram Media Group
description: Send specified media URLs to a Telegram chat as a media group.
send_telegram_notification:
name: Send Telegram Notification
description: Send a notification to Telegram (text, photo, video, or media group).
target:
entity:
integration: immich_album_watcher
@@ -47,13 +47,13 @@ send_telegram_media_group:
text:
urls:
name: URLs
description: List of media URLs to send (max 10). Each item should have 'url' and 'type' (photo/video).
required: true
description: List of media URLs to send. Each item should have 'url' and 'type' (photo/video). If empty, sends a text message. Large lists are automatically split into multiple media groups.
required: false
selector:
object:
caption:
name: Caption
description: Optional caption for the media group (applied to first item).
description: Caption text. For media, applied to first item. For empty URLs, this is the message text.
required: false
selector:
text:
@@ -65,3 +65,31 @@ send_telegram_media_group:
selector:
number:
mode: box
disable_web_page_preview:
name: Disable Web Page Preview
description: Disable link previews in text messages.
required: false
selector:
boolean:
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.
required: false
default: 10
selector:
number:
min: 2
max: 10
mode: slider
chunk_delay:
name: Chunk Delay
description: Delay in milliseconds between sending multiple media groups (0-60000). Useful for rate limiting.
required: false
default: 0
selector:
number:
min: 0
max: 60000
step: 100
unit_of_measurement: "ms"
mode: slider