S
S
Sardor Saidov2020-05-31 10:01:03
PHP
Sardor Saidov, 2020-05-31 10:01:03

How to create inline button Show more in Telegram bot?

How to create an analogue of the "Show more products" button in a telegram bot using PHP? The task is to give 10 products the first time you click on the category button, and when you click on the inline button Show more, he was given from 11 products to 20 products, etc.

Example: https://t.me/Sushinaka2Bot

OOgnM.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
nokimaro, 2020-05-31
@SardorJS

Inline buttons have a callback_data field that can contain arbitrary data.
When sending the button to the user (response from the bot), depending on the application logic, you put the necessary string there, which will then be returned to the server when the user clicks the button.
For example, it can be callback_data = "list_sushi_page_2" which will mean for you "the user clicked the transition to the 2nd page of the list" or alternatively "/list_sushi? from=11&to=22" and so on.
https://core.telegram.org/bots/api#inlinekeyboardmarkup

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question