Create a keyboard from an array of buttons
Returns a keyboard structure for messages
- Parameters
- Advanced call ?
Function CreateKeyboardFromArrayButton(Val ButtonArray, Val ButtonColor = "#2db9b9") Export
| 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 |
Returns
Structure - Create a keyboard from an array of buttons:
| Parameter | Description |
|---|---|
| dontwait | Creates a background job and returns its data (for 1C and OneScript only) |
1C:Enterprise/OneScript code example
ButtonArray = New Array;
ButtonArray.Add("Button 1");
ButtonArray.Add("Button 2");
ButtonArray.Add("Button 3");
Result = OPI_Viber.CreateKeyboardFromArrayButton(ButtonArray);
- Bash
- CMD/Bat
oint viber CreateKeyboardFromArrayButton \
--buttons "['Button 1','Button 2','Button 3']"
oint viber CreateKeyboardFromArrayButton ^
--buttons "['Button 1','Button 2','Button 3']"
Result
{
"Buttons": [
{
"ActionType": "reply",
"ActionBody": "Button 1",
"Text": "Button 1",
"BgColor": "#2db9b9",
"Columns": 3
},
{
"ActionType": "reply",
"ActionBody": "Button 2",
"Text": "Button 2",
"BgColor": "#2db9b9",
"Columns": 3
},
{
"ActionType": "reply",
"ActionBody": "Button 3",
"Text": "Button 3",
"BgColor": "#2db9b9",
"Columns": 3
}
],
"Type": "keyboard"
}