Answer the question
In order to leave comments, you need to log in
Telegram bot in PHP: why doesn't inline_keyboard send anything?
I am writing a bot in PHP without libraries. Reached the inline buttons in the message:
$arInfo["inline_keyboard"][0][0]["callback_data"]=1;
$arInfo["inline_keyboard"][0][0]["text"]="Кнопка 1";
$arInfo["inline_keyboard"][1][0]["callback_data"]=2;
$arInfo["inline_keyboard"][1][0]["text"]="Кнопка 2";
send($data['message']['chat']['id'],"Примеры кнопок",$arInfo);
$data = file_get_contents('php://input');
$data = json_decode($data, true);
$data_kb = json_decode($data->callback_query->data, true);
Answer the question
In order to leave comments, you need to log in
Inline_keyboard and inline_mode are different things.
You get a clock and nothing happens because you do not process the callback query in any way and do not return a response.
Try instead
$data_kb = json_decode($data->callback_query->data, true);
$data_kb = $data['callback_query'];
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question