📑 I have found these related issues/pull requests
Probably related to
🛡️ Security Policy
📝 Description
Trying to use a custom message template with MarkdownV2 (via Telegram) is almost impossible because messages aren’t escaped properly. Since there’s not much documentation on what each variable contains, I tried copy-pasting all the variables from the example into the template box.
That immediately resulted in “Bad gateway” errors just from pasting the full block. If I remove {{ monitorJSON }}, the error goes away, but then I start getting fun ones like: “Character '.' is reserved and must be escaped with the preceding '\\'”.
Note that I’m not using any . in the template. The template I was trying to use is simply this:
msg {{ msg }}
name {{ name }}
status {{ status }}
hostnameOrURL {{ hostnameOrURL }}
heartbeatJSON {{ heartbeatJSON }}
So one (or more) of these variables clearly contains a . and it’s not being properly escaped.
This would be a great moment to always escape the message before sending it. That way users won’t have to manually escape characters, and it also won’t fail due to reserved characters coming from variables.
👟 Reproduction steps
- Create a new notifier using telegram
- Select MarkdownV2 as the message format
- Use custom message template
- Copy paste the "Message template" block directly in the textarea
- Use the "test" button
👀 Expected behavior
When the selected format is MarkdownV2, the resulting text message (after applying the template engine) should be escaped considering Telegram's MarkdownV2 restrictions.
😓 Actual Behavior
It fails, telling you to escape things that you have not placed in there.
🐻 Uptime-Kuma Version
2.0.1
💻 Operating System and Arch
HAOS on a Raspberry PI 5 using Docker
🌐 Browser
Firefox 146.0.1 & Brave v1.85.118
🖥️ Deployment Environment
This uses the kuma HAOS component up-to-date, which can be found here: https://github.com/hassio-addons/addon-uptime-kuma
Anyway, we all know it doesn't matter for what I'm reporting....
📝 Relevant log output
📑 I have found these related issues/pull requests
Probably related to
🛡️ Security Policy
📝 Description
Trying to use a custom message template with MarkdownV2 (via Telegram) is almost impossible because messages aren’t escaped properly. Since there’s not much documentation on what each variable contains, I tried copy-pasting all the variables from the example into the template box.
That immediately resulted in “Bad gateway” errors just from pasting the full block. If I remove
{{ monitorJSON }}, the error goes away, but then I start getting fun ones like: “Character '.' is reserved and must be escaped with the preceding '\\'”.Note that I’m not using any
.in the template. The template I was trying to use is simply this:So one (or more) of these variables clearly contains a
.and it’s not being properly escaped.This would be a great moment to always escape the message before sending it. That way users won’t have to manually escape characters, and it also won’t fail due to reserved characters coming from variables.
👟 Reproduction steps
👀 Expected behavior
When the selected format is MarkdownV2, the resulting text message (after applying the template engine) should be escaped considering Telegram's MarkdownV2 restrictions.
😓 Actual Behavior
It fails, telling you to escape things that you have not placed in there.
🐻 Uptime-Kuma Version
2.0.1
💻 Operating System and Arch
HAOS on a Raspberry PI 5 using Docker
🌐 Browser
Firefox 146.0.1 & Brave v1.85.118
🖥️ Deployment Environment
This uses the kuma HAOS component up-to-date, which can be found here: https://github.com/hassio-addons/addon-uptime-kuma
Anyway, we all know it doesn't matter for what I'm reporting....
📝 Relevant log output