Cairn Developers

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

BlockMessagesModalsContents
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

ElementFields
buttontext (plain_text), action_id, value, url (https only), style (primary / danger), confirm
static_selectoptions, initial_option, placeholder, action_id, confirm (not allowed inside a modal input)
imageimage_url (https only), alt_text
plain_text_inputaction_id, placeholder, initial_value, multiline, min_length, max_length (input blocks only)
metervalue, max, min (defaults to 0), label (for screen readers). An element of context blocks. Cairn-specific
  • confirm is a confirmation dialog with title / text / confirm / deny / style
  • Option values in a static_select must be unique. initial_option must match one of the options exactly, including its text and description
  • Buttons with a url also notify your app when pressed, as in Slack

Limits

Limits follow Slack. Exceeding one makes the post or update fail with invalid_blocks.

ItemLimit
Blocks per message50
Blocks per modal100
section text, context text3,000
section fields10
Characters per field2,000
Elements in actions25
Elements in context10
header text150
block_id255
action_id255
Button text75
Button value2,000
URL (buttons, images)3,000
static_select options100
Option text and description75
Option value150
placeholder150
Image alt_text2,000
Image title2,000
Confirm dialog title100
Confirm dialog text300
Confirm dialog buttons30
input label2,000
input hint2,000
Modal title24
Modal submit / close24
private_metadata3,000
callback_id255

block_id and action_id

  • block_id must be unique within the card and action_id unique 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__ and constructor cannot be used as IDs

mrkdwn syntax

mrkdwn text uses Slack’s syntax and is interpreted separately from the Markdown of regular Cairn messages.

SyntaxResult
*bold*Bold
_italic_Italic
~strike~Strikethrough
`code`Inline code
```multi-line```Code block
> quoteQuote 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 &amp; &lt; &gt; 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 text if 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.