Telegram alerts: test message succeeded, but "400 Bad Request" on real alerts

This seems to still be a problem, When I include something like {{ $values.A }} in summary or description field of an alert (which results in “<no data>” even though I thought it shouldn’t in that particular case), this produces telegram api error and prevents the alert to reach telegram client. Server log says:

notify retry canceled due to unrecoverable error after 1 attempts: failed to send telegram message: webhook response status 400 Bad Request

Grafana v9.5.2 (cfcea75916)

[SOLVED] Update. I found my real problem and described it in the next reply.
Briefly: My alerts exceeded Telegram text message limit of 4096 symbols. A link for details.
Below is just a description of my case and a possible solution for a particular case.

Faced with a very similar issue: I can send a test message, but I am not receiving any alerts in the Telegram channel and there is 400 Bad Request error in the interface:

This topic gave me an idea how to find the solution in my case:
I actively use templates in my alerts to make them more readable and relevant for users. The very first solution in this topic by @evagrafana about the symbol “<” made me think that the problem is with the content I am sending to Telegram.
When I tried to remove the current template from my contact point and I saved the settings, what a surprise, I received all the stuck alerts to my Telegram channel.

I’ve tried to link my alert with another contact point which uses a different template (but very similar to the ‘problematic’ one) - everything worked good.
I use HTML tags in my templates, for example, < b > < /b > etc. I’ve noticed that in recent versions a new setting appeared called Parse Mode, so tried to put Parse Mode from None to HTML and that solved my issue.

I still don’t understand why “None” option didn’t work, while this option is “HTML” by default. But the final problem was with a Parse Mode, not with my template, because I’ve tested the template on another contact point.

Also, I am still not sure what was the exact problem in my case, but check your template if you see Bad Request error and if you use HTML tags, put HTML Parse Mode instead of None.

1 Like

Thank you @lexpec I didn’t see this new “parse mode” parameter, that fixed my alerts not sending.
These breaking changes are annoying, alerting system is critical and shouldn’t be changed without retro compatibility.

1 Like

Hi, @bLd759
Already answered you on another topic where you mentioned me, but will duplicate the link to my response here, as it is important update on my issue:

1 Like