Telegram Bot custom keyboard in PHP

后端 未结 2 1595
梦如初夏
梦如初夏 2020-12-30 02:19

I\'m trying to make a Telegram Bot in PHP with a custom keyboard. The message is delivered, but the custom keyboard won\'t work. $keyb = array(\'keyboard\' => array(array

2条回答
  •  有刺的猬
    2020-12-30 03:04

    The docs seem to indicate you need to provide the reply_markup parameter as a JSON serialised object... kinda stupid for a form POST endpoint:

    $replyMarkup = array(
        'keyboard' => array(
            array("A", "B")
        )
    );
    $encodedMarkup = json_encode($replyMarkup);
    $content = array(
        'chat_id' => ,
        'reply_markup' => $encodedMarkup,
        'text' => "Test"
    );
    

    Does this one work?

提交回复
热议问题