Hello everybody,
I am a big fan of all the work around proxmox and have been using it for quite some while no in my personal home lab. The "new" option to use webhooks as a notification target had me interested and I started messing around with it. After the initial setup I was able to send a test notification via my telegram bot with the following HTTP/POST:
Received message is: Message:This is a test of the notification target 'TelegramAlerts'.
But I was not able to receive a notification when my backup jobs failed. Looking through the different places I configured my notification matchers to match everything and my backup job to use the notification system. (By the way it is a bit confusing that when the backup job is set to use the notification system and you view the Job Details of a backup job "Notification" is shown as "Always (No target configured)" even though it is matched by a notification matcher). Finally looking at the system log with
I was able to confirm that the webhook is called but I get the following error.
testing with a simpler webhook template without the message content
I finally got a notification for my failed backup job. It seems like the message produced by the backup job is not properly encoded by the url-encode macro or I might be using it wrong. Any pointers to fix this would be very appreciated.
Testing the webhook without the url-encode part as just
already gives the same error of an invalid uri character during the test notification.
I am a big fan of all the work around proxmox and have been using it for quite some while no in my personal home lab. The "new" option to use webhooks as a notification target had me interested and I started messing around with it. After the initial setup I was able to send a test notification via my telegram bot with the following HTTP/POST:
Code:
https://api.telegram.org/bot{{ secrets.BOT_TOKEN }}/sendMessage?chat_id={{ secrets.CHAT_ID }}&text=Message:{{ url-encode message }}
But I was not able to receive a notification when my backup jobs failed. Looking through the different places I configured my notification matchers to match everything and my backup job to use the notification system. (By the way it is a bit confusing that when the backup job is set to use the notification system and you view the Job Details of a backup job "Notification" is shown as "Always (No target configured)" even though it is matched by a notification matcher). Finally looking at the system log with
Code:
journalctl -f
Code:
could not notify via target `TelegramAlerts`: failed to build http request: invalid uri character
Code:
https://api.telegram.org/bot{{ secrets.BOT_TOKEN }}/sendMessage?chat_id={{ secrets.CHAT_ID }}&text=Failed
Testing the webhook without the url-encode part as just
Code:
https://api.telegram.org/bot{{ secrets.BOT_TOKEN }}/sendMessage?chat_id={{ secrets.CHAT_ID }}&text=Message:{{ message }}
Last edited: