1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-06-06 23:46:28 +02:00
OpenIntegrations/docs/en/md/Viber/Message-sending/Create-keyboard-from-array-button.mdx

69 lines
1.3 KiB
Plaintext
Raw Normal View History

2024-10-15 10:50:56 +03:00
---
2024-10-15 10:16:04 +03:00
sidebar_position: 7
---
2024-10-15 10:50:56 +03:00
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
2024-10-15 10:16:04 +03:00
# Create a keyboard from an array of buttons
Returns a keyboard structure for messages
`Function CreateKeyboardFromArrayButton(Val ButtonArray, Val ButtonColor = "#2db9b9") Export`
2024-10-15 15:15:47 +03:00
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| ButtonArray | --buttons | Array of String | ✔ | Array of buttons |
| ButtonColor | --color | String | ✖ | HEX color of buttons with # at the beginning |
2024-10-15 10:16:04 +03:00
Returns: Structure - Create a keyboard from an array of buttons:
<br/>
2024-10-15 21:15:56 +03:00
```bsl title="1C:Enterprise/OneScript code example"
2024-10-15 10:16:04 +03:00
ButtonArray = New Array;
ButtonArray.Add("Button 1");
ButtonArray.Add("Button 2");
ButtonArray.Add("Button 3");
Result = OPI_Viber.CreateKeyboardFromArrayButton(ButtonArray);
```
```json title="Result"
{
"Buttons": [
{
"ActionType": "reply",
"ActionBody": "Button 1",
"Text": "Button 1",
"BgColor": "#2db9b9",
"Coloumns": 3
},
{
"ActionType": "reply",
"ActionBody": "Button 2",
"Text": "Button 2",
"BgColor": "#2db9b9",
"Coloumns": 3
},
{
"ActionType": "reply",
"ActionBody": "Button 3",
"Text": "Button 3",
"BgColor": "#2db9b9",
"Coloumns": 3
}
],
"Type": "keyboard"
}
```