Answer the question
In order to leave comments, you need to log in
How to use inline buttons in Telegram?
I want to send a message to the user after clicking on an inline button. As I understand it, callback_data must transfer its value somewhere, but nothing comes to me through webhook after clicking. Perhaps you need to somehow use CallbackQuery, but I still have not figured out how this can be configured. Are there any examples? How can it be implemented?
$keyboard = array('inline_keyboard' => array(
array(
array(
'text' => 'Кнопка1', 'callback_data' => '/button1'),
array(
'text' => 'Кнопка2', 'callback_data' => '/button2'),
),
),
);
Answer the question
In order to leave comments, you need to log in
How do you process requests?
See in what form the request is received when a regular button is pressed (or just when text is sent) and in what form when a callback request is received.
It is explicitly stated there: message or callback_query
Check the message type and parse the request. Data will contain the value that is written in callback_data
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question