## Keyboard

Interactive buttons under a message. Passed in the `keyboard` field when sending — an array where each button is a separate object.

## Button fields

| Field | Type | Default | Description |
|------|-----|-----------|---------|
| `TEXT` | string | — | Button text. Required for all buttons except `TYPE: "NEWLINE"` |
| `TYPE` | string | — | Special type: `NEWLINE` — wrap to a new line |
| `LINK` | string | — | URL — the button becomes a link |
| `ACTION` | string | — | Action on click: `PUT` (insert into the input field), `SEND` (send text), `COPY` (copy), `CALL` (call), `DIALOG` (open chat) |
| `ACTION_VALUE` | string | — | Value for `ACTION`: text, phone number or chat ID |
| `BG_COLOR_TOKEN` | string | `base` | Preset background color (see [tokens below](#color-tokens)) |
| `BG_COLOR` | string | — | Background color in hexadecimal format (`#ff6600`) |
| `TEXT_COLOR` | string | — | Text color in hexadecimal format |
| `DISPLAY` | string | `BLOCK` | Layout: `LINE` (inline with others) or `BLOCK` (full width) |
| `DISABLED` | string | `N` | Inactive button: `Y` or `N` |
| `BLOCK` | string | `N` | `Y` — the button is disabled after a click |
| `WIDTH` | integer | — | Button width in pixels |
| `CONTEXT` | string | `ALL` | Where to show: `MOBILE`, `DESKTOP`, `ALL` |

## Color tokens

| Token | Color | Purpose |
|-------|------|-----------|
| `primary` | Blue | Primary action |
| `secondary` | Gray | Secondary action |
| `alert` | Red | Dangerous action |
| `base` | White | Neutral button (default) |

## Example

```json
{
  "message": "Confirm the action:",
  "keyboard": [
    { "TEXT": "Approve", "BG_COLOR_TOKEN": "primary", "ACTION": "SEND", "ACTION_VALUE": "/approve", "BLOCK": "Y" },
    { "TEXT": "Reject", "BG_COLOR_TOKEN": "alert", "ACTION": "SEND", "ACTION_VALUE": "/reject", "BLOCK": "Y" },
    { "TYPE": "NEWLINE" },
    { "TEXT": "Details", "LINK": "https://example.com/tasks/42", "BG_COLOR_TOKEN": "secondary", "DISPLAY": "LINE" }
  ]
}
```

## See also

- [Send a message](/docs/chats/messages/send)
- [Text formatting](/docs/chats/messages/formatting)
- [Attachments](/docs/chats/messages/attach)
