Reputation: 11
I am new to Telegram Bot API (python telegram.ext), here is my question: I am trying to send formatted message in reply to received message. For simplicity I removed everything from the code below
mtxt = "<ul><li>line 1</li></ul>"
res = bot.send_message(chat_id=update.message.chat_id, text=mtxt, parse_mode='HTML')
print(res)
Nothing is returned to telegram (no answer from bot) and print() never happens. If I remove 'parse_mode...' clause from the call it works.
I must be fundamentally wrong somewhere... This is very basic staff, what is missing?
Upvotes: 1
Views: 5635
Reputation: 3827
You need to specify parse_mode
parameter.
Either use ParseMode.HTML or just simple "HTML" should do the trick.
Example code that worked for me:
send_message(chat_id=chat_id, text=answer, parse_mode="HTML")
Upvotes: 1
Reputation: 11
The usable tags are listed here: https://core.telegram.org/bots/api#formatting-options
If You use other tags the telegram API fails.
Upvotes: 0
Reputation: 7985
There only have limited tags :(
You can use emoji to format, or make a suggestion to Telegram.
Upvotes: 2