3

please help me. I added a custom keyboard via reply_markup like this:

        $reply_markup = array(
            'keyboard' => array(
                array(
                    array( 
                        'text' => 'Click here to upload contact & validate it',
                        'request_contact' => true
                    )
                )
            ),
            'one_time_keyboard' => true,
            'resize_keyboard' => true
        );

        $reply_markup = json_encode($reply_markup);

        API_URL."sendmessage?chat_id=".$chatID."&text=".urlencode($reply)."&reply_markup=".urlencode($reply_markup);

it is working fine. but now I need to remove the custom keyboard. I tried like this:

        $reply_markup = array(
            'remove_keyboard' => true
        );

        API_URL."sendmessage?chat_id=".$chatID."&text=".urlencode($reply)."&reply_markup=".urlencode($reply_markup);

it is not working. the custom keyboard only hidden, not removed. By the way, I am using PHP 7.

Please help. Thank you in advance

Dika
  • 2,213
  • 4
  • 33
  • 49
  • 1
    I tried to reproduce your problem. But I don't see anything wrong. Used your code and everything works as expected. Custom keyboard is removed and not hidden. Tried with telegram's desktop application on (win10) also on android. – newsha Nov 26 '18 at 16:38
  • thank you @newsha for checking. I edited the code, and realised a line is missing in the code block which having error. your checking pointed me to a right direction – Dika Nov 27 '18 at 03:20

1 Answers1

4

so today I found out, my actual code missing one line of code. it can be seen below, the bold part.

        $reply_markup = array(
            'remove_keyboard' => true
        );

$reply_markup = json_encode($reply_markup);

        API_URL."sendmessage?chat_id=".$chatID."&text=".urlencode($reply)."&reply_markup=".urlencode($reply_markup);
Dika
  • 2,213
  • 4
  • 33
  • 49