skip to Main Content

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.

2

Answers


  1. Chosen as BEST ANSWER

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


  2. To answer this question:

    buttons = [[InlineKeyboardButton("Button", callback_data="btn1")]]
    bot.send_message(chat_id=update.effective_chat.id, reply_markup=InlineKeyboardMarkup(buttons))
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search