-1

I'm developing a telegram bot with python-telegram-bot.

I send a message and a link (message body + inline keyboard button):

my question is how can I know if user clicked () on the link? I want to do something if he clicked on link

btn = 'clicked'
link = InlineKeyboardButton(btn, url='www.google.ir', callback_data=btn)
keyboard = [[link]]
reply_markup = InlineKeyboardMarkup(keyboard)
bot.send_message(chat_id=uid, text='you should see this link to go next 
mahyar madani
  • 21
  • 1
  • 5

1 Answers1

1

You can generate a custom link which will do something that you want when the user opens it. After that user will be redirected to needed link.

For example:

Real link: https://example.com/category/article/1231
Your link: https://yourdomain.com/qwe213

You send your custom link and when the user opens this link, your script will do whatever you want then the user will be redirected to the real link.

Abduvokhid
  • 46
  • 1
  • 4