0

I'd like to use the methode editMessageReplyMarkup to get rid of my inline_keyboard buttons. I can get rid of them by passing the 'reply_markup' a json encoded keyboard like that:

        $k = ['inline_keyboard' => 
               [
                 [   ]
               ]
             ];

but as a result I get that error

Request has failed with error 400: Bad Request: object expected as reply markup

I tried a couple variants include not sending a 'reply_markup' at all as attribute to the methode, but I get the error "Bad Request: object expected as reply markup" or "Bad Request: can't parse inline keyboard button: InlineKeyboardButton must be an Object".

That is how I call the methode:

$bot->apiRequestJson("editMessageReplyMarkup", array(
            'chat_id'=>$cb_chat_id,
            'message_id'=>$cb_msg_id,
            'reply_markup' => json_encode($k)
            )); 
    

The function is taken from here: function taken from hellobot example https://core.telegram.org/bots/samples/hellobot

And to prove my function is working, that results in a new inline keyboard without any error

$k = ['inline_keyboard' => [
    [
        ['text' => 'caption', 'callback_data' => 'test']
        ]
    ]];

Thanks for your help!

Markus

marommel
  • 11
  • 3
  • I tried to replicate your issue by copy pasting your code as it is. But I don't see any problem with it. Sending an empty inline_keyboard will delete any previous keyboard just fine. No error message. – newsha Feb 16 '21 at 08:52
  • what's the code for the "empty" keyboard you are using? – marommel Feb 16 '21 at 08:57
  • Exactly same as yours (copy). Problem must be somewhere else. – newsha Feb 16 '21 at 09:09
  • @newsha Thanks for your support! You are totaly right. The issue been further down in my code, the error message wasn't connected to the "editMessageReplyMarkup" methode. – marommel Feb 16 '21 at 10:47
  • have you tried that with `$k = ['inline_keyboard' => []];`? my guess is, empty rows are not tolerated – YakovL Oct 18 '21 at 13:00

0 Answers0