mirror of
https://github.com/louislam/uptime-kuma.git
synced 2026-03-02 22:57:00 -05:00
Telegram MarkdownV2 messages should be escaped before sending #4562
Labels
No labels
A:accessibility
A:api
A:cert-expiry
A:core
A:dashboard
A:deployment
A:documentation
A:domain expiry
A:incidents
A:maintenance
A:metrics
A:monitor
A:notifications
A:reports
A:settings
A:status-page
A:ui/ux
A:user-management
Stale
ai-slop
blocked
blocked-upstream
bug
cannot-reproduce
dependencies
discussion
duplicate
feature-request
feature-request
good first issue
hacktoberfest
help
help wanted
house keeping
invalid
invalid-format
invalid-format
question
releaseblocker 🚨
security
spam
type:enhance-existing
type:new
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/uptime-kuma#4562
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @elboletaire on GitHub (Dec 30, 2025).
📑 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
@CommanderStorm commented on GitHub (Dec 30, 2025):
That sounds reasonable.
Would you be interested in contributing a fix for this? It should be fairly straightforward to implement;
the more time-consuming part will be the manual tests that this works as expected.
I don’t personally use Telegram, so I’m unlikely to work on this myself.
I may not have the capacity to address every issue on my own, but with help from the community we can still move things forward 🙂
@CommanderStorm commented on GitHub (Dec 30, 2025):
Shure ^^
@elboletaire commented on GitHub (Dec 30, 2025):
Yo, that was fast. I’m glad Anurag jumped in so quickly — I can barely catch my breath lately...
@CommanderStorm commented on GitHub (Jan 1, 2026):
@elboletaire apologies for the noise from "Anurag". We don’t engage with such automated or LLM-generating accounts; we only work with human contributors due to past issues with very low-quality content.
@elboletaire commented on GitHub (Jan 1, 2026):
OMFG how are we these days... well answering your first post, if I find some moment I'll try to do it, but if any other (human) wants to take it, feel free to do so.