dschep / ntfy

🖥️📱🔔 A utility for sending notifications, on demand and when commands finish.
http://ntfy.rtfd.io
GNU General Public License v3.0
4.83k stars 214 forks source link

Send Telegram messages with markdown / HTML #230

Open TowardMyth opened 3 years ago

TowardMyth commented 3 years ago

Hi there. Thanks so much for developing this module.

For Telegram messages, is there any way to send messages with rich formatting in them, i.e. I can bold, italicize, etc?

Per here, the TG API supports this. https://stackoverflow.com/questions/38119481/send-bold-italic-text-on-telegram-bot-with-html.

Thanks!

JoshKing56 commented 3 years ago

Since the ntfy telegram backend uses the telegram_send library, this should be possible, as telegram_send supports the different styles of message, including HTML mode and Markdown mode. https://github.com/rahiel/telegram-send#usage

Calling the send() function with the option parse_mode=Markdown can accomplish this. The possible options (taken from the source code of telegram_send), is ["text", "markdown", "html"].