Skip to main content

Answer button event

Returns a response to the user when a keyboard button is pressed

Function AnswerButtonEvent(Val Token, Val EventID, Val Text = "", Val URL = "", Val AsAlert = False) Export

ParameterCLI optionTypeRequiredDescription
Token--tokenStringBot token
EventID--queryidStringIdentifier of the callback query received by the bot
Text--textStringAnswer text
URL--urlStringURL to be opened by the client application
AsAlert--showalertBooleanDisplay the answer as an alert)

Returns: Map Of KeyAndValue - serialized JSON response from VK Teams


tip

This method call should be used in response to receiving a callbackQuery event

Method at API documentation: GET /messages/answerCallbackQuery


1C:Enterprise/OneScript code example
    Token  = "001.3501506236.091...";
LastID = 0;

For N = 1 To 5 Do

Result = OPI_VKTeams.GetEvents(Token, LastID, 3);
Events = Result["events"];

If Not Events.Count() = 0 Then

For Each Event In Events Do

callbackData = Event["payload"];

If callbackData["callbackData"] = "ButtonEvent1" Then

EventID = callbackData["queryId"];
Result = OPI_VKTeams.AnswerButtonEvent(Token, EventID, "Get it!");

EndIf;

EndDo;

LastID = Events[Events.UBound()]["eventId"];

EndIf;

EndDo;