Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send a hyperlink in bot.sendMessage()

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..

like image 547
chris Avatar asked Dec 22 '25 01:12

chris


1 Answers

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

like image 147
Siva Kumar Avatar answered Dec 25 '25 23:12

Siva Kumar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!