How to create clickable bot commands in Telegram messages?

I’m working on a Telegram bot that searches for images. When it finds multiple results, I want to show a list of clickable options. Each option should trigger a specific bot command when clicked. For example:

/search mickey mouse
[Image 1]
Found more results. Please choose:
• Option 2
• Option 3

When a user taps an option, it should automatically send the command with the chosen image name. Is this possible in Telegram? I tried using regular hyperlinks, but they open in the browser instead.

Has anyone figured out how to make interactive bot commands within messages? Any tips or workarounds would be great. Thanks!

Telegram supports interactive commands through the use of inline keyboards. Instead of embedding traditional hyperlinks that redirect to a browser, you can design your messages with an InlineKeyboardMarkup. This markup creates buttons that, when clicked, send callback data to your bot for further processing. You can craft your bot to detect this callback and respond by sending the corresponding image or executing the appropriate command. Although setting this up may require careful handling of asynchronous events, it offers a fluid and integrated experience for users.

hey i found a neat trick: inline keyboards! instead of links, you add buttons that auto send commands. just build an inlineKeyboardMarkup w/ callback data and handle it in your bot. works great in telegram.

I worked on a similar project recently and found that inline keyboards offer a practical solution. Instead of using regular hyperlinks, which tend to open a browser, inline keyboards let you create buttons that trigger specific commands. I sent my search results along with an inline keyboard markup, defined custom callback data for each button, and then handled those callbacks in my bot code. This method keeps everything within Telegram and creates a smooth user experience. It required some trial and error, but the end result was worth the effort.