how to remove and edit button of telegram bot?

how to remove or edit buttons of keyboards?

first i create keboard:

<?


$keyboard = [
            'keyboard' => [[['text' => 'a',]],[['text'=>'b' ]]],

 ];

$reply = json_encode($keyboard);

$url1 = "https://api.telegram.org/bot".$token."/sendmessage?parse_mode=HTML&chat_id=".$chat_id."&text=".urlencode($text)."&reply_markup=".$reply;
$result1=file_get_contents($url1);



?>

created keyboard truely.

but when i try to use api bot to remove not working:

<?

$url1 = "https://api.telegram.org/bot".$token."/sendmessage?parse_mode=HTML&chat_id=".$chat_id."&reply_markup=KeyboardRemove";
$result1=file_get_contents($url1);


?>

where is my wrong?

thanks

1 answer

  • answered 2018-02-13 01:01 Sean

    You have to send JSON format, not text, just like this payload.

    {
        "remove_keyboard": true
    }