Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Telegram inline keyboard button not working

My bot sends inline keyboard to a group on telegram . The keyboard is sent with no issues but when the user clicks, There is no responnse from telegram. I have checked my heroku logs using heroku logs -t. There is no ping from telegram. How might this be happening ? Could this be a telegram side issue ?
Additional info : All other functionalities are working fine.

TELEGRAM_WEBSITE = "https://api.telegram.org/" + <BOT_TOKEN>
response_body=requests.post(TELEGRAM_WEBSITE + "/sendmessage",
                              data={"text": "{}".format(TEXT), "parse_mode": "HTML",
                                    "chat_id": "{}".format(CHAT_ID),
                                    "reply_markup": json.dumps(
                                        {"inline_keyboard": [[{"text": "{}".format(BET_POSITION),
                                        "callback_data": "{};{};{};{};{};{}".format(BET_SUM,CHALLENGE_TYPE,RIVAL_TELE_ID,TELE_ID,BET_POSITION,USERNAME)}]]})})
response_body=response_body.json()
requests.post(TELEGRAM_WEBSITE + "/sendmessage?chat_id={}&text={}".format(<my telegram id>, response_body))

^Here is the key board that I have sent .

{'ok': True, 'result': {'message_id': 769, 'from': {'id': <>, 'is_bot': True, 'first_name': '<bot name>', 'username': '<bot username>'}, 'chat': {'id': <group chai id >, 'title': '<group title>', 'username': '<group username>', 'type': 'supergroup'}, 'date': 1594645500, 'text': 'CHALLENGE-\nChallenged by:<my username>\nBet:500', 'entities': [{'offset': 27, 'length': 8, 'type': 'text_mention', 'user': {'id': <id>, 'is_bot': False, 'first_name': '<my first name>', 'username': '<my username>', 'language_code': 'en'}}], 'reply_markup': {'inline_keyboard': [[{'text': 'call', 'callback_data': '10;open;;<my telegram id>;9 bets;<my username>'}]]}}}

^Here is the confirmation of response_body being sent. The second confirmation is obviously that I can see the keyboard on my mobile.

like image 884
pundit Avatar asked Feb 16 '26 23:02

pundit


1 Answers

The issue was from Telegram's side. I changed the bot token and the keyboard worked.

like image 191
pundit Avatar answered Feb 19 '26 13:02

pundit



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!