9

My bot sends out links. so I wanted to include a hyperlink like the one you can do with HTML for example -a href="google.com" Google /a shows up a click able text called "Google" how can I do this in bot.sendMessage()? and also if you have any idea of sending bold font messages too..

Sebastian Lenartowicz
  • 4,695
  • 4
  • 28
  • 39
chris
  • 139
  • 1
  • 1
  • 6
  • Does this answer your question? [how to make links for words in telegram bot?](https://stackoverflow.com/questions/41345254/how-to-make-links-for-words-in-telegram-bot) – Guido Sep 21 '20 at 06:03

2 Answers2

11

You can use formatting option to do this.

Sean Wei
  • 7,433
  • 1
  • 19
  • 39
10

By specifying parse_mode=ParseMode.HTML in send_message() you can use HTML tags.

Example for Hyperlink

bot.send_message(chat_id = update.message.chat_id, text = "<a href='https://www.google.com/'>Google</a>", parse_mode = ParseMode.HTML)

Example for Bold

bot.send_message(chat_id = update.message.chat_id, text = "<b>Bold font</b>", parse_mode = ParseMode.HTML)

For more formatting options refer here

keramat
  • 4,328
  • 6
  • 25
  • 38
Siva Kumar
  • 133
  • 1
  • 8