Answer the question
In order to leave comments, you need to log in
How to set up inline buttons in Telegram via JSON?
There is such JSON code with which you can implement inline buttons
here:
{
"chat_id":"чат айди",
"text":"Текст",
"reply_markup": {
"inline_keyboard": [
[{
"text": "",
"callback_data":"art"
}]
]
}
}
Answer the question
In order to leave comments, you need to log in
When sending this json, the user will receive a message and a button. In this json you are passing a parameter "callback_data"
with value "art"
. When the user clicks on the button, you will receive an update response from Telegram on the server (see documentation https://core.telegram.org/bots/api#update ). There is a parameter callback_query
, and in it data
. This parameter will contain your value "art"
that you passed. That is, you are just waiting for a response from the telegram that will come to your address (attached by setWebhook). And if data = "art"
, then you do what the button was for - form a message from the bot, for example
{
"chat_id":"чат айди",
"text":"Текст-ответ на кнопку",
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question