1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-01-28 05:46:35 +02:00
OpenIntegrations/docs/en/md/Viber/Message-sending/Create-keyboard-from-array-button.md
Vitaly the Alpaca (bot) 217c3b0626 Main build (Jenkins)
2024-09-29 21:40:58 +03:00

71 lines
1.4 KiB
Markdown

---
sidebar_position: 7
---
# Create a keyboard from an array of buttons
Returns a keyboard structure for messages
`Function CreateKeyboardFromArrayButton(Val ButtonArray, Val ButtonColor = "#2db9b9") Export`
| Parameter | CLI option | Type | Description |
|-|-|-|-|
| ButtonArray | --buttons | Array of String | Array of buttons |
| ButtonColor | --color | String | HEX color of buttons with # at the beginning |
Returns: Structure - Create a keyboard from an array of buttons:
<br/>
```bsl title="Code example"
ButtonArray = New Array;
ButtonArray.Add("Button 1");
ButtonArray.Add("Button 2");
ButtonArray.Add("Button 3");
Result = OPI_Viber.CreateKeyboardFromArrayButton(ButtonArray);
```
```sh title="CLI command example"
oint viber CreateKeyboardFromArrayButton --buttons %buttons% --color %color%
```
```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"
}
```