# Message blocks

Lay out what your app posts: headings, sections with fields, images, context lines and buttons.

`blocks` is a list, sent with or instead of `text` from the [Web API](https://www.kinnlo.com/docs/apps/web-api), a [webhook](https://www.kinnlo.com/docs/apps/webhooks) or a [command’s answer](https://www.kinnlo.com/docs/apps/commands#answer).

```json
[
  {"type": "header", "text": "Deploy finished"},
  {"type": "section", "text": "*web* is live on main.", "fields": ["**Took**\n42 s", "**By**\nAda Lin"]},
  {"type": "divider"},
  {"type": "actions", "items": [
    {"type": "button", "text": "Open site", "url": "https://example.com"},
    {"type": "button", "text": "Roll back", "actionId": "rollback", "style": "danger"}
  ]},
  {"type": "context", "items": [{"type": "text", "text": "Sent by the deploy pipeline"}]}
]
```

## Block types

| Type | Fields |
| --- | --- |
| `header` | `text`, up to 150 characters. |
| `section` | `text`, `fields` (up to 10, each up to 2,000 characters) and an `accessory` (a button or an image). Needs text or fields. |
| `context` | `items`: 1 to 10 small `{type: "text", text}` or images. |
| `divider` | A line. |
| `image` | `url`, `alt` and an optional `title` (up to 150 characters). |
| `actions` | `items`: 1 to 10 buttons. |

## Buttons

| Field | What it is |
| --- | --- |
| `text` | The label, up to 75 characters. |
| `actionId` | Sent to your server when pressed, up to 255 characters. Unique within its block. |
| `value` | Optional, up to 2,000 characters, sent with `actionId`. |
| `url` | Optional: an `http` or `https` address the button opens instead. |
| `style` | Optional: `primary` or `danger`. |

## Limits

- Up to 50 blocks a message, and 3,000 characters of text in a block.
- Text in blocks takes [Kinnlo’s formatting](https://www.kinnlo.com/docs/messages#formatting) and `<@member id>` mentions.
- Image addresses are `http` or `https`.
- Polls are made in the composer, not by apps.
- Fields Kinnlo doesn’t know are dropped; a block type it doesn’t know is refused.
