DEVELOPERS · PREVIEW
Building apps for Cairn
This is the specification for apps that post cards (Block Kit–compatible messages) to Cairn channels as a bot and receive button, select and modal interactions. The wire format follows Slack, so that an app written with Bolt for JavaScript can run against Cairn by changing only the API endpoint.
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.
How apps work
An app talks to Cairn over three paths.
| Direction | Path | Details |
|---|---|---|
| App → Cairn | Call POST /api/app-api/<method> with a bot token (post, update, open modals) | Bot Web API |
| Cairn → App | Button presses, selections, modal submissions and menu launches are POSTed, signed, to your Request URL | Interactions |
| People | Members use the cards in a channel and fill in the modals your app opens (web, desktop, iOS / Android) | Cards |
An app is installed into a workspace, and each installation has its own bot (the sender) and bot token. A bot can only post to channels that members have added it to. Messages from a bot always carry an “App” badge so they are never mistaken for a person.
Using Bolt for JavaScript
Point Bolt’s clientOptions.slackApiUrl at Cairn and client.chat.postMessage and friends call Cairn directly. Interactions are signed with the same X-Slack-Signature header as Slack, so Bolt’s signature verification works unchanged.
const { App } = require('@slack/bolt')
const app = new App({
token: process.env.CAIRN_BOT_TOKEN, // cairn_bot_...
signingSecret: process.env.CAIRN_SIGNING_SECRET,
// Point the Web API at Cairn (keep the trailing slash)
clientOptions: { slackApiUrl: 'https://oss-cairn.com/api/app-api/' },
})
app.action('vote', async ({ ack, body, client }) => {
await ack()
await client.chat.update({
channel: body.channel.id,
ts: body.message.ts,
text: 'Thanks for voting',
blocks: [{ type: 'section', text: { type: 'mrkdwn', text: '*Voted!*' } }],
})
})
app.start(3000)Cairn supports a subset of the Slack API. See Differences from Slack for the supported methods and blocks and for behaviour that differs.
Scopes and permissions
Scope names follow Slack.
| Scope | Allows |
|---|---|
chat:write | Posting to channels the bot is in, and updating or deleting its own messages |
users:read | Reading the ID, display name and avatar of active workspace members |
channels:read | Listing the members of channels the bot is in |
auth.test,views.openandviews.updateneed no scope (a modal can only be opened while atrigger_idissued by a member’s action is valid)- Receiving interactions is enabled by registering a Request URL, not by a scope
- Workspace owners and admins install and uninstall apps
- Any member with access to a channel can add the bot to it or remove it. Bots cannot be added to DMs
- Anyone who can read the channel (guests included) can use its cards. Deactivated members cannot
Tokens and IDs
- Bot tokens start with
cairn_bot_(not Slack’sxoxb-). Send them in anAuthorization: Bearer <token>header or as atokenfield in the body - Workspace, user, channel and message IDs are UUIDs. A message’s
tsis also the message UUID (not Slack’s1700000000.000100format) - IDs may move to a more Slack-like format in the future. So that you can keep reading UUIDs when that happens, payloads also carry them in a Cairn-specific
cairnobject
In this guide
- Cards (blocks and elements) — accepted blocks, elements and limits, and mrkdwn syntax
- Bot Web API — methods, request format and error codes
- Interactions — delivery, signing, the 3-second deadline and payloads
- Modals —
views.open,view_submissionand returning input errors - Differences from Slack — what is not supported and what behaves differently