I’ve been working on a PHP-based Telegram bot and encountered a problem with implementing an inline keyboard. When I issue a specific command, the bot is supposed to display a custom keyboard with a button, but nothing happens. I suspect there might be an error in how I’m handling the keyboard structure or sending the markup to the API. I’d appreciate any guidance to pinpoint and fix the issue. Below is an altered version of my code with different variable and function names:
if ($command === "initiate") {
$buttonGroup = array(
"inline_keyboard" => array(
array(
array(
"text" => "Click Here",
"callback_data" => "action_trigger"
)
)
)
);
$markupData = array(
"reply_markup" => $buttonGroup
);
processKeyboard($chatIdentity, "Hello, user!", $markupData);
}
function processKeyboard($chatIdentity, $messageText, $markup) {
$encodedMarkup = json_encode($markup);
sendRequest("sendMessage?chat_id={$chatIdentity}&text={$messageText}&parse_mode=HTML&reply_markup={$encodedMarkup}");
}