1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-04-11 11:41:56 +02:00
OpenIntegrations/docs/en/md/VKTeams/Message-sending/Answer-button-event.mdx
Vitaly the Alpaca (bot) 1f0bf233de Main build (Jenkins)
2024-11-07 12:52:52 +03:00

71 lines
1.7 KiB
Plaintext

---
sidebar_position: 11
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# 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`
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| Token | --token | String | ✔ | Bot token |
| EventID | --queryid | String | ✔ | Identifier of the callback query received by the bot |
| Text | --text | String | ✖ | Answer text |
| URL | --url | String | ✖ | URL to be opened by the client application |
| AsAlert | --showalert | Boolean | ✖ | Display the answer as an alert) |
Returns: Map Of KeyAndValue - serialized JSON response from VK Teams
<br/>
:::tip
This method call should be used in response to receiving a callbackQuery event
Method at API documentation: [GET /messages/answerCallbackQuery](https://teams.vk.com/botapi/#/messages/get_messages_answerCallbackQuery)
:::
<br/>
```bsl title="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;
```