---
sidebar_position: 16
description: Generate keyboard from array of buttons and other functions to work with Telegram in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, Telegram]
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Generate keyboard from array of buttons
 Generates a simple JSON keyboard from an array of buttons for a message or bottom panel



`Function FormKeyboardFromButtonArray(Val ButtonArray, Val UnderMessage = False, Val OneByOne = True) Export`

  | Parameter | CLI option | Type | Required | Description |
  |-|-|-|-|-|
  | ButtonArray | --buttons | Array of String | &#x2714; | Array of buttons |
  | UnderMessage | --under | Boolean | &#x2716; | Keyboard under the message or on the bottom panel |
  | OneByOne | --column | Boolean | &#x2716; | True > buttons are displayed in a column, False > in a row |

  
  Returns:  String - Keyboard JSON

:::tip
About keyboards in the API documentation: [InlineKeyboardMarkup](https://core.telegram.org/bots/api#inlinekeyboardmarkup)
:::
<br/>


```bsl title="1C:Enterprise/OneScript code example"
    ButtonArray = New Array;
    ButtonArray.Add("Button1");
    ButtonArray.Add("Button2");
    ButtonArray.Add("Button3");

    Result = OPI_Telegram.FormKeyboardFromButtonArray(ButtonArray);
```
 

 <Tabs>
  
    <TabItem value="bash" label="Bash" default>
        ```bash
            oint telegram FormKeyboardFromButtonArray \
             --buttons "['Button1','Button2','Button3']" \
             --under true
        ```
    </TabItem>
  
    <TabItem value="bat" label="CMD/Bat" default>
        ```batch
            oint telegram FormKeyboardFromButtonArray ^
             --buttons "['Button1','Button2','Button3']" ^
             --under true
        ```
    </TabItem>
</Tabs>


```json title="Result"
{
 "keyboard": [
  [
   {
    "text": "Button1",
    "callback_data": "Button1"
   }
  ],
  [
   {
    "text": "Button2",
    "callback_data": "Button2"
   }
  ],
  [
   {
    "text": "Button3",
    "callback_data": "Button3"
   }
  ]
 ],
 "resize_keyboard": "***"
}
```
