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

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