Reputation: 21
I am working on a telegram bot using php, I want to resize my ReplyKeyboardMarkup button to fit each of the keyboards.
I want the first button to take the full width of the keyboard and the second and fourth button takes the middle then I want the last button to take the entire width at the bottom.
This is my code.
$replyMarkup = array(
'keyboard' => array(
array("Get all foods", "Menu" "List", "Cancel")
),
'resize_keyboard' => true
);
// checking if this user has already login in before
$useit = json_encode($replyMarkup);
$parameters = array(
"chat_id" => $user_id,
"parseMode" => "html",
"text" => "Select country code",
"reply_markup" => $useit
);
send("sendMessage", $parameters);
How can I resize each of my buttons using 'resize_keyboard' => true
Upvotes: 1
Views: 2409
Reputation: 51
If you send it via "sendMessage
?" then in json
it should look like this:
{"chat_id": "1234567890", "text": "messagetext123", "reply_markup": {"keyboard":[[{"text":"button1"},{"text":"button2"}]], "resize_keyboard":true}
Boolean in resize_keyboard MUSTN't be in braces.
Upvotes: 0
Reputation: 774
you can make your keyboard structure with arrays for example:
$replyMarkup = array(
'keyboard' => array(
array("Get all foods"),
array("Menu", "List"),
array("Cancel")
),
'resize_keyboard' => true
);
Upvotes: 2