Telegram MarkdownV2 syntax requires a backslash before every special character in plain text. Paste your text here and copy it back escaped, ready for parse_mode=MarkdownV2. It fixes the “can’t parse entities” error and runs in your browser.
Type or paste the text your bot should send. Escaped in your browser.
All 18 special characters and the backslash get a backslash in front.
Source: Bot API, MarkdownV2 style.
In MarkdownV2 these characters have a meaning: _ * [ ] ( ) ~ ` > # + - = | { } . !. Anywhere they should appear as themselves, they need a backslash in front. That includes the full stop and the exclamation mark, which is why a plain sentence like “Done.” is refused.
Inside code and pre blocks only the backtick and the backslash need escaping. Inside the address part of a link, only the closing parenthesis and the backslash.
You want to send: Price: 1.5 (approx). Unescaped, Telegram stops at the full stop. Escaped, the text reads Price: 1\.5 \(approx\). If you want “Price” in bold, write the asterisks yourself around the escaped text: *Price:* 1\.5 \(approx\).
The usual pattern is a template with your own formatting and some values from users or data. Escape each value on its own, then put it into the template. Escaping the whole finished message turns your own asterisks and underscores into literal characters.
parse_mode=Markdown (the old version) rules with MarkdownV2. The two escape differently.In ordinary text: _ * [ ] ( ) ~ ` > # + - = | { } . ! — each with a preceding backslash. Inside code and pre blocks only the backtick and the backslash; inside the (…) part of a link only the closing parenthesis and the backslash.
Your text contains one of the special characters without a backslash in front of it. Escape all user-supplied text before you put it into a MarkdownV2 message.
No — only the parts that are plain text. If you escape the whole message, your own *bold* and _italic_ markers are escaped too and show up literally. Escape each variable, then put it into your template.
Often, yes: with parse_mode=HTML only <, > and & need escaping (as < > &).
Put a real line break (\n) in the text. It needs no escaping.
[text](https://example.com). Escape special characters in the text part as usual; in the address only ) and \ need a backslash.