R
R
Ridalit2020-05-29 23:58:19
Python
Ridalit, 2020-05-29 23:58:19

How to make the VK bot send messages with a button?

5ed177f9acc11999590357.jpeg
This screenshot was taken by me, but the message was sent using a bot application, not using python code.

How can I send a message with a button using a VK bot? Normal buttons are at the bottom (below the message input line), but I have seen that many bots can send a message in which there will be a fully working button. How to implement it?

Python 3.7
Windows 10
Vk_api

Answer the question

In order to leave comments, you need to log in

1 answer(s)
1
1 1, 2020-05-30
@Ridalit

The vk.messages.send() method has a keyboard argument. Its input is json text.
for example

vk.messages.send(message="hello world!", keyboard='{"buttons":}'

In order not to write it manually, kind people came up with this generator.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question