How to get callbackData when I click on a button in Keyboard in botman?

  botman, bots, laravel, php, telegram
$this->bot->hears('[sS]+',function(BotMan $bot){
            $input = $bot->getMessage()->getText();
            $k = Keyboard::create()->type( Keyboard::TYPE_KEYBOARD )
                ->oneTimeKeyboard(true)
                ->addRow(
                    KeyboardButton::create("Cat")->callbackData('c'),
                    KeyboardButton::create("Dog")->callbackData('d')
                )
                ->toArray();

            if ($bot->getcallbackData() == 'c')//Here I need to check callbackData from clicked button
            {
                $bot->reply('you clicked on Cat');
            }
            else
            {
                $bot->reply('you clicked on Dog');
            }
        });

getcallbackData() function is not exists in botman but i put it to Clarify the idea

Source: Laravel

Leave a Reply