Telegram Transport Adaptor¶
Motivation¶
Use the latest Telegram Bot integration in Home Assistant for richer telegram notifications, adapting core Supernotify data like title and image, and exposing telegram specific tuning.
Testing¶
Tested on Home Assistant 2026.3.4 with telegram_bot platform: polling
Example configuration¶
Basic Configuration
telegram_home:
transport: telegram
selection: default
data:
telegram_chat_id: 123456789
security channel with camera snapshot
telegram_security:
transport: telegram
selection: default
data:
telegram_chat_id: 123456789
telegram_attach_image: true
telegram_parse_mode: "HTML"
Alarm channel with inline buttons
telegram_alarms:
transport: telegram
selection: scenario
data:
telegram_chat_id: 123456789
telegram_attach_image: true
telegram_inline_keyboard:
- - text: "✅ Acknowledge"
callback_data: "ack_alarm"
- text: "🔇 Snooze"
callback_data: "snooze_alarm"
Example call¶
action: notify.supernotify
data:
message: "Motion detected at front door"
title: "📷 Front Camera"
data:
media:
camera_entity_id: camera.ezviz_ingresso
Expected behavior¶
- Telegram receives photo with bold title as caption
- Low-priority notifications arrive silently <* Critical notifications bypass Do Not Disturb
How to get the chat_id¶
- Start a chat with your bot on Telegram (send /start)
- Visit: https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates
- Find "chat" → "id" in the response
Or use the telegram_bot.send_message service from HA Developer Tools to test with your chat_id before committing it to delivery.yaml
Notes¶
TargetRequired.ALWAYS:chat_idis always required — either fromdelivery.target(configured indelivery.yaml) or from thetelegram_chat_iddata key.- Direct
hass_api.call_service()is used instead ofcall_action()because the service name switches dynamically betweensend_message,send_photo, andsend_documentdepending on whether a snapshot is attached. grab_image()(notsnap_notification_image()) handles reprocessing: resize, JPEG/PNG optimisation, metadata removal, and per-filename caching for multiple deliveries with the same settings.TransportFeature.SNAPSHOT_IMAGEis declared so the SuperNotify scheduler waits for PTZ cameras to complete their rotation before dispatching (v1.14.0+).- HTML special characters in title and message are escaped via
html.escape()whenparse_mode=HTML, preventing accidental tag injection.