Using HTML in Telegram bot
Use the following syntax in your message:
*bold text*
_italic text_
[inline URL](http://www.example.com/)
[inline mention of a user](tg://user?id=123456789)
pre-formatted fixed-width code block
Note: Only the tags mentioned above are currently supported.
Tags must not be nested.
All <, > and & symbols that are not a part of a tag or an HTML entity must be replaced with the corresponding HTML entities (< with <, > with > and & with &).
All numerical HTML entities are supported.
The API currently supports only the following named HTML entities: <, >, & and ".
HTML mode
Pass HTML
in the parse_mode
field when using sendMessage
.
If you need to format using html you need to set "parse_mode" as "html";
https://api.telegram.org/bot1328912345:BBCCDDExVAKD2GOEA1mXWfXfhQ_z8Y6rRh8/sendmessage?chat_id=12345678&text=Sample message&parse_mode=html)
As of now only following tags are supported by Bot:
<b>bold</b>, <strong>bold</strong>
<i>italic</i>, <em>italic</em>
<u>underline</u>, <ins>underline</ins>
<s>strikethrough</s>, <strike>strikethrough</strike>, <del>strikethrough</del>
<b>bold <i>italic bold <s>italic bold strikethrough</s> <u>underline italic bold</u></i> bold</b>
<a href="http://www.example.com/">inline URL</a>
<a href="tg://user?id=123456789">inline mention of a user</a>
<code>inline fixed-width code</code>
<pre>pre-formatted fixed-width code block</pre>
<pre><code class="language-python">pre-formatted fixed-width code block written in the Python programming language</code></pre>
Source: https://core.telegram.org/bots/api#formatting-options