As I understood in version 2.2 of this library, you can only use regular text buttons without callback_data - for the transfer of which you need to use inline buttons.
1) You need to upgrade to the dev-version, if through the composer, then like this:
composer require irazasyed/telegram-bot-sdk:dev-master
2) Further, the code changes somewhat:
<?php use Telegram\Bot\Commands\Command; use Telegram\Bot\Keyboard\Keyboard; $telegram = new Telegram\Bot\Api('MY_KEY'); $update = $telegram->getWebhookUpdates(); // Π΄Π°Π½Π½ΡΠ΅ ΡΠΎΠΎΠ±ΡΠ΅Π½ΠΈΡ Π² Π·Π°Π²ΠΈΡΠΈΠΌΠΎΡΡΠΈ ΠΎΡ callback_query if ( isset($this->update['callback_query'])) { $message = $update['callback_query']; } else { $message = $update; } $chatId = $message['message']['chat']['id']; // ΠΏΡΠ°Π²ΠΈΠ»ΡΠ½ΠΎ ΡΠΎΡΠΌΠΈΡΡΠ΅ΠΌ ΠΊΠ»Π°Π²ΠΈΠ°ΡΡΡΡ: $keyboard = [ [ Keyboard::inlineButton(['callback_data'=>'/butt1','text'=>'ΠΠ½ΠΎΠΏΠΊΠ° 1']), Keyboard::inlineButton(['callback_data'=>'/buut2','text'=>'ΠΠ½ΠΎΠΏΠΊΠ° 2']) ] ]; $reply_markup = $telegram->replyKeyboardMarkup([ // 'keyboard' => $keyboard, // Π²ΠΌΠ΅ΡΡΠΎ ΡΡΠΎΠ³ΠΎ ΠΈΡΠΏΠΎΠ»ΡΠ·ΡΠ΅ΠΌ: 'inline_keyboard' => $keyboard, 'resize_keyboard' => true, 'one_time_keyboard' => false ]); // Π΅ΡΠ»ΠΈ Π½Π°ΠΆΠ°Π»ΠΈ ΠΊΠ½ΠΎΠΏΠΊΡ: if ( isset($this->update['callback_query'])) { $telegram->sendMessage(array( 'chat_id' => $chatId, 'text' => "ΠΡ Π½Π°ΠΆΠ°Π»ΠΈ Π½Π° ΠΊΠ½ΠΎΠΏΠΊΡ Ρ ΠΊΠΎΠ΄ΠΎΠΌ: " . $message['data'], // ΠΈΠΌΠ΅Π½Π½ΠΎ Π² $message['data'] - Π±ΡΠ΄Π΅Ρ ΡΠΎ ΡΡΠΎ ΠΏΡΠΎΠΏΠΈΡΠ°Π½ΠΎ Ρ Π½Π°ΠΆΠ°ΡΠΎΠΉ ΠΊΠ½ΠΎΠΏΠΊΠΈ Π² ΠΊΠ°ΡΠ΅ΡΡΠ²Π΅ callback_data 'reply_markup' => $reply_markup, )); } else { $telegram->sendMessage(array( 'chat_id' => $chatId, 'text' => 'ΠΠ°ΠΆΠΌΠΈΡΠ΅ Π½Π° ΠΎΠ΄Π½Ρ ΠΈΠ· ΠΊΠ½ΠΎΠΏΠΎΠΊ:', 'reply_markup' => $reply_markup, )); }
Maybe someone else will come in handy)