The translation was generated automatically and may contain mistakes
Types of buttons
The bot keyboard may contain buttons of different types. Type of button specified in the field type determines its name.
text
Send a text message from the field label .
Field | Type | Description |
|---|---|---|
type Mandatory | string | Type of button. Meaning: text . |
label Mandatory | string | The text that will be sent in the message and displayed on the button.The maximum length is 40 characters. |
payload Unnecessary | string | Additional data in JSON string format. Send to the bot server in a message message_new in the field payload . The maximum length is 255 characters.
The line should start and end with curly braces. |
The button can be specified color .
location
Opens a dialog box with location information. The user can select the location and send it to the chat.
- •Community administrators will receive an image of the map in chat.
- •The coordinates of the point will come to the bot server in the event
message_newin the fieldmessage.geo.coordinates.
The row where the button is located location It may contain no more than two buttons. Otherwise, on a call messages.send The error will be returned.
Field | Type | Description |
|---|---|---|
type Mandatory | string | Type of button. Meaning: location . |
payload Unnecessary | string | Additional data in JSON string format. Send to the bot server in a message message_new in the field payload . The maximum length is 255 characters.
The line should start and end with curly braces. |
vkpay
Opens the payment window VK Pay with predefined parameters. The button displays the text “Pay via VK Pay” and the logo of VK Pay.
Button vkpay It should be the only one in the line. Otherwise, on a call messages.send The error will be returned.
Field | Type | Description |
|---|---|---|
type Mandatory | string | Type of button. Meaning: vkpay . |
hash Mandatory | string | Line c features of VK Pay and the application ID in the parameter aid separated by a symbol & . Example: action=transfer-to-group&group_id=1&aid=10 . |
payload Unnecessary | string | Additional data in JSON string format. Send to the bot server in a message message_new in the field payload . The maximum length is 255 characters.
The line should start and end with curly braces. |
open_link
Opens the reference specified in the field link .
Field | Type | Description |
|---|---|---|
type Mandatory | string | Type of button. Meaning: open_link . |
link Mandatory | string | A URL that will be opened when you press the button. |
label Mandatory | string | Text of the button. |
payload Unnecessary | string | Additional data in JSON string format. Send to the bot server in a message message_new in the field payload . The maximum length is 255 characters.
The line should start and end with curly braces. |
open_app
Opens a mini-app or game using the identifier specified in the parameter app_id .
A mini-app added to the community can pass data to the bot via the Callback or LongPoll API. More details in section Interaction with the application .
Field | Type | Description |
|---|---|---|
type Mandatory | string | Type of button. Meaning: open_app . |
app_id Mandatory | integer | A mini-app or game ID. Where can I find the application ID? |
label Mandatory | string | Текст кнопки, например Играть . |
owner_id Unnecessary | integer | Идентификатор сообщества, в котором установлено приложение, если его требуется открыть в контексте сообщества. Where can I find the Community ID? |
hash Unnecessary | string | A hash to navigate in the application, it will be passed in the run parameter bar after the character # . |
payload Unnecessary | string | Additional data in JSON string format. Send to the bot server in a message message_new in the field payload . The maximum length is 255 characters.
The line should start and end with curly braces. |
callback
Callback buttons allow you to process clicks without sending a user message to the chat.An event is sent to the bot server message_event which contains information about pressing the button. Use payload to identify the button and execute server logic. More details in section Working with callback buttons .
Field | Type | Description |
|---|---|---|
type Mandatory | string | Type of button. Meaning: callback . |
label Mandatory | string | Текст кнопки. Максимальная длина — 40 символов.
После нажатия на кнопку текст на ней сменяется курсором, означающим ожидание. |
payload Unnecessary | string | Additional data in JSON string format. Send to the bot server in a message message_new in the field payload . Максимальная длина — 255 символов.
Строка должна начинаться и заканчиваться фигурными скобками.
Если на клавиатуре несколько callback -кнопок, используйте это значение, чтобы идентифицировать кнопку, которую нажа?1?» пользователь. |
The button can be specified color .
Materials on the topic
- •
- •
- •