Iharob Al Asimi
Iharob Al Asimi

Reputation: 53006

How to receive a CallbackQuery in a Telegram BOT

I want to use InlineKeyboardButton in a telegram bot.

My request is a GET request to the following url1

https://api.telegram.org/bot{TOKEN}/sendMessage?chat_id={ID}&text=Hello&reply_markup={"inline_keyboard":[[{"text":"Click","callback_data":"1"}]]}

I receive the message with one inline button and it works as expected however, after clicking the button there are no updates received.

I've read the documentation many times and I would excpect an update with callback_query field but none is received.

I created another bot, and it works exactly as expected. So now the question is


1Of course, with the correct bot token and chat id.

Upvotes: 0

Views: 2505

Answers (1)

Ivan Vinogradov
Ivan Vinogradov

Reputation: 4473

Unfortunately, I cannot reproduce this issue with my bot.

However, the following issues may cause problem described in your question:

  • bot API keys of sendMessage and getUpdates methods are different
  • offset parameter of getUpdates method might be invalid, causing needed updates to be confirmed and never returned to you by telegram servers
  • there might be a different app running getUpdates preventing you from receiving needed updates

Upvotes: 1

Related Questions