According to the docs you can set the parse_mode
field to:
Markdown still works but it's now considered a legacy mode.
You can pass the parse_mode
parameter like this:
https://api.telegram.org/bot[yourBotKey]/sendMessage?chat_id=[yourChatId]&parse_mode=MarkdownV2&text=[yourMessage]
For bold and italic using MarkdownV2:
*bold text*
_italic text_
And for HTML:
<b>bold</b> or <strong>bold</strong>
<i>italic</I> or <em>italic</em>
Make sure to encode your query-string parameters regardless the format you pick. For example:
val message = "*bold text*";
val encodedMsg = URLEncoder.encode(message, "UTF-8");
var message = "*bold text*"
var encodedMsg = encodeURIComponent(message)
$message = "*bold text*";
$encodedMsg = urlencode($message);