Here is my buttons:
$keyboard = Keyboard::make()
->inline()
->row(
Keyboard::inlineButton([
'text' => '馃嚭馃嚘 褍泻褉邪褩薪褋褜泻邪',
'callback_data' => json_encode(['a' => 'firstLang', 'lang' => 'ua']),
]),
Keyboard::inlineButton([
'text' => '馃嚪馃嚭 褉褍褋褋泻懈泄',
'callback_data' => json_encode(['a' => 'firstLang', 'lang' => 'ru']),
]),
Keyboard::inlineButton([
'text' => '馃嚭馃嚫 english',
'callback_data' => json_encode(['a' => 'firstLang', 'lang' => 'en']),
])
);
I handle them this way:
$update = Telegram::getWebhookUpdates(); // todo check why is it deprecated
$isCallback = $update->detectType() === 'callback_query';
if ($isCallback) {
$chatId = $update['callback_query']['message']['chat']['id'];
But how can I answer callback query?
馃憢 Thanks for opening your first issue here! If you're reporting a 馃悶 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.
To help make it easier for us to investigate your issue, please follow the contributing guidelines.
What version of the SDK are you currently using? Are you using it in Laravel?
Based on your code , you just need simply call answerCallbackQuery() inside your if
If you're using develop version of the SDK:
Telegram::answerCallbackQuery([
'callback_query_id' => $update->getId(),
'cache_time' => 1
]);
If using v2:
Telegram::answerCallbackQuery([
'callback_query_id' => $update['callback_query']['id'],
'cache_time' => 1
]);
Most helpful comment
What version of the SDK are you currently using? Are you using it in Laravel?
Based on your code , you just need simply call
answerCallbackQuery()inside yourifIf you're using develop version of the SDK:
If using v2: