A
A
Alexey2016-08-09 12:06:38
PHP
Alexey, 2016-08-09 12:06:38

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

2 answer(s)
N
nllm, 2016-11-23
@nllm

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

S
snake_jan, 2018-01-09
@snake_jan

how to hide old buttons when displaying the latest ones?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question