Cairn Developers

DEVELOPERS · PREVIEW

Interactions

When a member presses a button or picks an option on a card, submits a modal, or launches your app from a menu, Cairn POSTs it, signed, to your app’s Request URL. The format is the same as Slack Interactivity.

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.

Delivery

  • POST with Content-Type: application/x-www-form-urlencoded and a payload=<JSON> body (menu launches are the exception: a flat form, see below)
  • Return a 2xx within 3 seconds. The 3 seconds include resolving the Request URL. Cairn does not retry
  • On a timeout, a non-2xx status or a connection failure, only the member who acted sees “The app didn’t respond”; the card is unchanged
  • Redirects are not followed. Up to 256 KB of the response body is read
  • The response body to a button or select is not used. To change the card, call chat.update (response_url is not supported yet)

Request URL

  • Only https is accepted. Credentials in the URL (user:pass@) are not allowed
  • If the host resolves to any non-public address (private, loopback, link-local, …), nothing is sent. This is checked both when the URL is registered and when sending

Verifying signatures

Requests use Slack’s v0 signature with the same header names, so Bolt verifies them unchanged.

HeaderValue
X-Slack-Request-TimestampUNIX time (seconds) when sent
X-Slack-Signaturev0= + hex of HMAC-SHA256(signing secret, "v0:" + timestamp + ":" + body)

Compute it over the raw body before parsing, compare in constant time, and reject timestamps older than 5 minutes.

import { createHmac, timingSafeEqual } from 'node:crypto'

// rawBody is the body exactly as received (before parsing)
function verify(signingSecret, headers, rawBody) {
  const timestamp = headers['x-slack-request-timestamp']
  const signature = headers['x-slack-signature']
  if (!timestamp || !signature) return false
  // Reject requests older than 5 minutes as replays
  if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 60 * 5) return false
  const expected = 'v0=' + createHmac('sha256', signingSecret).update(`v0:${timestamp}:${rawBody}`).digest('hex')
  return expected.length === signature.length && timingSafeEqual(Buffer.from(expected), Buffer.from(signature))
}

block_actions (buttons and selects)

{
  "type": "block_actions",
  "team": { "id": "<workspace UUID>", "domain": "<workspace slug>" },
  "user": { "id": "<user UUID>", "name": "<display name>", "team_id": "<workspace UUID>" },
  "api_app_id": "<app UUID>",
  "token": "",
  "trigger_id": "<one-time ID>",
  "container": { "type": "message", "message_ts": "<message UUID>", "channel_id": "<channel UUID>", "is_ephemeral": false },
  "channel": { "id": "<channel UUID>", "name": "<channel name>" },
  "message": {
    "type": "message",
    "ts": "<message UUID>",
    "text": "<fallback text>",
    "user": "<bot user UUID>",
    "bot_id": "<installation UUID>",
    "blocks": [ ... ]
  },
  "actions": [
    {
      "type": "button",
      "block_id": "poll",
      "action_id": "vote",
      "text": { "type": "plain_text", "text": "Ramen" },
      "value": "ramen",
      "action_ts": "1761200000.123000"
    }
  ],
  "cairn": { "message_id": "<message UUID>", "interaction_id": "<UUID>", "locale": "ja" }
}

For a static_select, the entry in actions looks like this:

{
  "type": "static_select",
  "block_id": "pick",
  "action_id": "place",
  "selected_option": { "text": { "type": "plain_text", "text": "Ramen" }, "value": "ramen" },
  "action_ts": "1761200000.123000"
}
  • Button values and options are taken from the card Cairn has stored, not from the member’s device, so tampered values never reach your app
  • token is always empty (the deprecated verification token is not used; verify the signature instead)

cairn.* fields

The cairn object in payloads is a Cairn extension. Apps written for Slack can ignore it.

FieldContents
cairn.message_idUUID of the card’s message (block_actions)
cairn.channel_idUUID of the channel the modal was opened from (view_submission)
cairn.interaction_idA UUID per action, for de-duplication (below)
cairn.localeThe member’s display language (ja / en / ko). Use it to answer with modals, input errors and messages in that language

cairn.locale is the language the member’s device is actually showing. If the device does not send one, it is taken from Accept-Language.

Duplicates and idempotency

If your app processes an action but its response is lost, Cairn sees a failure and the member may try again. Build for that:

  • Record processed cairn.interaction_ids and never process the same ID twice
  • Make buttons idempotent (“vote for this option” gives the same result however often it is pressed; avoid toggles, and use a separate button to undo)

trigger_id

  • A one-time ID for opening a modal with views.open, bound to the member who acted and to your installation
  • It expires 6 seconds after it is issued (3 seconds for delivery plus 3 seconds to call views.open after you respond). Open the modal right after you ack

Launching from the menu

When a member picks your app from the app menu next to the message composer, Cairn sends a form shaped like a Slack slash command (a flat form, not payload=).

token=&team_id=<workspace UUID>&team_domain=<slug>&channel_id=<channel UUID>&channel_name=<name>
&user_id=<user UUID>&user_name=<display name>&command=/poll&text=&api_app_id=<app UUID>
&is_enterprise_install=false&trigger_id=<one-time ID>&locale=ja
  • text is always empty; typing commands into the composer is not available yet
  • No response_url is sent. Respond with views.open (using the trigger_id) and chat.postMessage
  • locale is a Cairn addition not present in Slack, with the same meaning as cairn.locale
For modal submissions (view_submission), see Modals.