Z
Z
zalarudo2020-03-05 00:16:42
PHP
zalarudo, 2020-03-05 00:16:42

How to solve the problem that it is not possible to embed a link button into the keyboard of a VK chat bot written in PHP?

Gentlemen, good evening. The question is next. Has anyone encountered the development of VK bots with a PHP keyboard using the callback API? The fact is that there is a need to insert a button - a link, however, when it is inserted (here is the button code that is added to the rest of the buttons (ordinary) in an array, which is then sent along with the bot's response

[
'action' => [
'type' = > "open_link",
'link' => 'example.com',
"payload" => json_encode('8', JSON_UNESCAPED_UNICODE),
'label' => 'Text',
],
'color' => 'default'
] ;
moreover, I tried to insert the link format, both with and without http) However, with this addition of a button to the array with the rest of the buttons (normal), the bot hangs and does not display the entire keyboard. At the same time, without this button, everything is displayed correctly. The log of failed requests to the server is also silent. Perhaps you need to somehow additionally encode the link (tried to encode with the urlencode () function) or otherwise build the button logic? I did not find such a case in the documentation, can you tell me?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
E
EduardGuschin, 2020-03-05
@EduardGuschin

Check if the link in your button is being blocked by the service as malicious. Try to insert a link to vk in your button. I myself figured out for a long time why the button with a link to the application with heroku does not work, until I realized what was wrong.

A
AUser0, 2020-03-05
@AUser0

Keyboard not showing up in browser?
Well, look at JavaScript errors in the browser in the WebDeveloper console.
If the keyboard should, but is not shown, then there will be errors due to which it is not shown.
PS And to a question in the style of "I have the line 'mom washed the frame', but it is with an error! tell me where?" absolutely no one will give you an answer .

W
Wwwoper, 2020-03-06
@Wwwoper

Try removing 'color' => 'default'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question