DEVELOPERS · PREVIEW
Cards (blocks and elements)
Cards are a subset of Slack Block Kit. Cairn accepts only what both the web and mobile apps can render, and rejects everything else when you post.
This specification is a preview. External developers cannot register apps or issue bot tokens yet (only first-party apps run today). Details may change before registration opens.
Example card
Pass an array of blocks as blocks to chat.postMessage / chat.update. When sending form-urlencoded, encode it as a JSON string (Bolt’s default).
[
{ "type": "header", "text": { "type": "plain_text", "text": "Lunch vote" } },
{
"type": "section",
"text": { "type": "mrkdwn", "text": "*Where shall we go?* <@8f0c...-uuid>" },
"accessory": {
"type": "button",
"action_id": "vote",
"value": "ramen",
"text": { "type": "plain_text", "text": "Ramen" },
"style": "primary"
}
},
{ "type": "context", "elements": [{ "type": "mrkdwn", "text": "Closes at 12:00" }] }
]Supported blocks
| Block | Messages | Modals | Contents |
|---|---|---|---|
section | ✓ | ✓ | text (mrkdwn / plain_text), fields, accessory (button / static_select / image). Needs text or fields |
actions | ✓ | ✓ | button, static_select |
context | ✓ | ✓ | text (mrkdwn / plain_text), image |
image | ✓ | ✓ | image_url (https only), alt_text (required), title |
divider | ✓ | ✓ | — |
header | ✓ | ✓ | text (plain_text) |
input | — | ✓ | plain_text_input, static_select; label, hint, optional |
markdown | ✓ | — | Standard Markdown (same shape as Slack’s markdown block) |
Supported elements
| Element | Fields |
|---|---|
button | text (plain_text), action_id, value, url (https only), style (primary / danger), confirm |
static_select | options, initial_option, placeholder, action_id, confirm (not allowed inside a modal input) |
image | image_url (https only), alt_text |
plain_text_input | action_id, placeholder, initial_value, multiline, min_length, max_length (input blocks only) |
meter | value, max, min (defaults to 0), label (for screen readers). An element of context blocks. Cairn-specific |
confirmis a confirmation dialog withtitle/text/confirm/deny/style- Option
values in astatic_selectmust be unique.initial_optionmust match one of theoptionsexactly, including its text and description - Buttons with a
urlalso notify your app when pressed, as in Slack
Limits
Limits follow Slack. Exceeding one makes the post or update fail with invalid_blocks.
| Item | Limit |
|---|---|
| Blocks per message | 50 |
| Blocks per modal | 100 |
| section text, context text | 3,000 |
| section fields | 10 |
| Characters per field | 2,000 |
| Elements in actions | 25 |
| Elements in context | 10 |
| header text | 150 |
| block_id | 255 |
| action_id | 255 |
| Button text | 75 |
| Button value | 2,000 |
| URL (buttons, images) | 3,000 |
| static_select options | 100 |
| Option text and description | 75 |
| Option value | 150 |
| placeholder | 150 |
| Image alt_text | 2,000 |
| Image title | 2,000 |
| Confirm dialog title | 100 |
| Confirm dialog text | 300 |
| Confirm dialog buttons | 30 |
| input label | 2,000 |
| input hint | 2,000 |
| Modal title | 24 |
| Modal submit / close | 24 |
| private_metadata | 3,000 |
| callback_id | 255 |
block_id and action_id
block_idmust be unique within the card andaction_idunique within its block. Together they identify the target of an interaction- If omitted, Cairn assigns IDs such as
cairn-b0/cairn-a0. We recommend setting your own IDs on elements you handle - Built-in object property names such as
__proto__andconstructorcannot be used as IDs
mrkdwn syntax
mrkdwn text uses Slack’s syntax and is interpreted separately from the Markdown of regular Cairn messages.
| Syntax | Result |
|---|---|
*bold* | Bold |
_italic_ | Italic |
~strike~ | Strikethrough |
`code` | Inline code |
```multi-line``` | Code block |
> quote | Quote at the start of a line |
<https://example.com|label> | Link (bare https URLs are linked too; disable with verbatim: true) |
<@user UUID> | Mention |
<!here> <!channel> <!everyone> | Broadcast label |
Markers next to ASCII letters or digits are not treated as formatting, so snake_case and 2*3*4 stay intact, while Japanese text like これは*太字*です is bolded. Only the & < > entities are decoded.
Rejected blocks and errors
Unknown blocks, elements and fields are all rejected. As in Slack, reasons come back as [ERROR] reason [json-pointer:...] (reason texts are currently in Japanese).
{
"ok": false,
"error": "invalid_blocks",
"response_metadata": {
"messages": ["[ERROR] 未対応のブロック種別です: rich_text [json-pointer:/blocks/1/type]"]
}
}- Only https URLs are accepted (http is mixed content on the web and cannot be shown on iOS)
- Visible card text goes through the same safety filter as regular messages
- When an older mobile app meets an element it does not know, it shows “update the app” in its place, and falls back to the message
textif the whole card cannot be drawn
markdown block and meter element
markdown block
Same shape as Slack’s markdown block: write standard Markdown with headings, tables and lists. It is drawn with the same components as regular Cairn messages, so Mermaid code blocks become diagrams. Messages only, not modals. The total length of all markdown blocks in a message is limited to 12,000 characters.
{ "type": "markdown", "text": "## Result\n\n| Option | Votes |\n|---|---|\n| Ramen | 3 |" }meter element (Cairn-specific)
A bar showing a quantity (same meaning as HTML’s <meter>), placed as a context element — for example a poll’s share of votes. min defaults to 0; require min < max and min ≤ value ≤ max. label is for screen readers; show visible text next to the bar with a text element in the same context. Slack has no such element, so branch your output if the same code also targets Slack.
{
"type": "context",
"elements": [
{ "type": "meter", "value": 3, "max": 5, "label": "Ramen: 3 of 5 votes" },
{ "type": "mrkdwn", "text": "Ramen — 3 votes" }
]
}Next
Post and update cards with the Bot Web API; receive presses and selections via Interactions.