I’m currently trying to set up telegram alerts. From notification channel edit page I can successfully send test message and read it from my telegram client. However, when I trying to test real alert from dashboard, I get log message
lvl=eror msg="Failed to send webhook" logger=alerting.notifier.telegram error="Webhook response status 400 Bad Request" webhook=my-telegram-bot
Checked with 2 different bots in different chats, same result - 400 error. Log level debug doesn’t help, no additional information on error in log files.
Grafana version=4.2.0 commit=349f3eb compiled=2017-03-22T15:06:41+0500, OS Ubuntu 16.04
No, I’ve double checked such cases ) Also, notification field is only part of the message: it automatically filled with metric data and alert details. So, as i see, even if I left notifications blank, message can not be empty.
I have russian locale on server, but anyway - test alerts are ok, and real alerts messages i’ve tested without cyrillic symbols, to avoid encoding errors.
Think i’ll try to catch alert packets with tcpdump, if it can handle https…
Think I’ve found issue. It’s < symbol in my notification: rps < 50. I quess, notification content is not escaped when message html is created. I replaced < with less than and it’s worked like a charm!
I am having the same exact problem <Telegram test message succeeded, but “400 Bad Request” on real alerts> on Grafana v5.0.0-beta1 (commit: 3e2da1f) Ubuntu 16.04.3 LTS. No issue with parallel email notification. Same issue with/without text in notification text box.
Pls help. Thanks
t=2018-02-20T23:31:32+0800 lvl=info msg=“Sending telegram image notification” logger=alerting.notifier.telegram photo=/var/lib/grafana/png/DybUicP2w1NXWglxLZaU.png chat_id=-123456 bot_token=xxxxxxxxxxxxxxx
t=2018-02-20T23:31:34+0800 lvl=eror msg=“Failed to send webhook” logger=alerting.notifier.telegram error=“Webhook response status 400 Bad Request” webhook=TelegramBot
I have text in the alert notification field. No symbols.
I have isolated the problem to ‘Include Image’ checkbox. I am able to receive the alerts and image in email notification no issue. So i guess the problem is with Telegram webhook with image.
@daniellee Thanks! Just realised that only email notification supports embedded image, while all other notifications e.g. Telegram require the image to be uploaded to external image store. That explains my case.
Sorry, I am not sure what is exactly inline image.
Hi, I’ve looked at the telegram notifier and the problem is that the sendPhoto endpoint for the inline message, does not have a “message” field, but a “caption” one instead, and this caption field is limited to 200 chars, but the length of the caption is not being checked at any moment here
A quick test hardcoding the caption sent to a couple words seems to be working right
Also, the test message is working because its using the text message format, but includes an image as an external link not as an embedded one.
Seperately, for text only alert sent to Telegram, when i click on the url link to Granana within Telegram app, it will show ‘unathorised’. No response when i click Sign In.
Perhaps we can have another checkbox in the Notification Channel settings to include or exclude URL link. Most of the time we only need the Predefined Text Message alert. This will reduce clutter in the Telegram chat.