How to use Telegram notifiers?

The YAML vampires are eating the Telegram bot and I got a warning that it will be removed. So I tried to use the new one instead. Apparently, my configured notifier was migrated, and I tested using developer tools, this works.

action: notify.send_message
data:
  message: hello
target:
  entity_id: notify.telegram_bot_xxxx_yyyy

However, when I try to use it in my alarm like this:

notifiers:
  - telegram_bot_xxxx_yyyy

It doesn’t work. I get the following error in the log:

Failed to call notify.telegram_bot_xxxx_yyyy, retrying at next notification interval

How to configure the notifier properly?

You missed the domain. Should be:

- notify.telegram_bot_xxxx_yyyy

No. You can see in the error message that it tries to call notify.telegram_bot_xxxx_yyyy. If I add another notify., it just gets even worse. Then this is the error message:

Failed to call notify.notify.telegram_bot_xxxx_yyyy, retrying at next notification interval

2 Likes

That’s a bug. Let’s create an issue on telegram bot, post the link here.

Now even the direct message sending through an action is broken. When I go to my Telegram integration, it says there is a timeout. Is it possible that the Telegram service is down?

Once I can get back to the action working, I’ll file a bug for the alert notifier.

OK, I’m trying another approach now. I try to use the apprise integration. From the CLI, this works:

apprise tgram://whatever -b hello

I set the following config in my YAML:

notify:
  - name: telegram_alert
    platform: apprise
    url: tgram://whatever

Now I’m trying the following action:

action: notify.telegram_alert
data:
  message: hello

It says success, but I don’t get the message. I found this log message:

A connection error occurred sending Telegram:xxxxx notification.

OK, seriously, Home Assistant does something very wrong. I entered Hass’s container and tried out the instance of apprise installed by Hass, and it works. But for some reason it doesn’t work from Hass itself.

I don’t know what I did, but now it works. After trying Apprise on the container, it started working. Now it works even after I recreate the container.

I’ve verified this is an issue in the debugger and created this issue to track.

and here’s the PR that fixes the issue partially

the extended data (like popup keyboard, responses, etc.) will not be passed and we can address that in a follow on PR once this is processed.

The initial feedback from the PR indicates that having alerts be broken for all telegram users is the recommended path forward - and then we can each replace alerts with custom automations.

I’m trying to appeal that decision.

@PeteRage thanks for sharing what is happening. Noticed recently that all my alerts: were able to send email but no longer worked with telegram. Fortunately I found this during the a file alarm test and not in a real emergency.

Have you found a blueprint or script that gives the basic alert: functionality and works with multiple telegram targets? The one here,

apparently only works with the single notification target. If you want to notify your entire family, you are out of luck. Such a pity that the simple but useful alert: integration was left to bit-rot with no replacement.

Use the Apprise integration for sending notifications. It still works with alerts.

I’m going to migrate to the Alert2 custom integration.

Thanks @PeteRage, @petersohn for the hints. Both look interesting. For what is worth, yesterday I migrated to the blueprint, for 16 alerts, I went from some 100-150 lines of yaml to 500, not cool, and you loose some flexibility (single retry timer instead of a list of of times), need to use a script hook to notify multiple people etc.

The deprecation is being pushed back until 2026.8.0 giving us all a little more time.

FWIW I ended up following @PeteRage idea and migrated again to Alert2. Smaller userbase but really well done. The yaml syntax ended up being more compact and easier to read than the original alert integration and very flexible. Comes with a nice UI card that can be used to snooze / ack alerts.

1 Like