DEVELOPERS · PREVIEW
Bot Web API
Apps call Cairn’s Web API with a bot token to post and update cards and open modals. Method names, arguments, responses and error codes follow the Slack Web API.
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.
Requests
- The endpoint is
POST https://oss-cairn.com/api/app-api/<method>(laid out like Slack’shttps://slack.com/api/<method>). Self-hosted deployments use their own host - Send
application/x-www-form-urlencoded(the default of Bolt and@slack/web-api) orapplication/json. With form encoding, sendblocks/viewas JSON strings. Bodies are limited to 1 MB - Pass the token as
Authorization: Bearer <token>or as atokenbody field (the header wins)
curl -X POST https://oss-cairn.com/api/app-api/chat.postMessage \
-H "Authorization: Bearer $CAIRN_BOT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"channel": "3b1f...-channel-uuid",
"text": "Lunch vote",
"blocks": [{ "type": "section", "text": { "type": "mrkdwn", "text": "*Where shall we go?*" } }]
}'Responses
As in Slack, the HTTP status is always 200 and success is indicated by ok. On failure, error holds an error code and response_metadata.messages holds details when available.
{
"ok": true,
"channel": "3b1f...-channel-uuid",
"ts": "9c2e...-message-uuid",
"message": {
"type": "message",
"text": "Lunch vote",
"user": "<bot user UUID>",
"bot_id": "<installation UUID>",
"app_id": "<app UUID>",
"ts": "9c2e...-message-uuid",
"blocks": [ ... ]
},
"cairn": { "message_id": "9c2e...-message-uuid" }
}The exception is rate limiting: above 120 calls per minute per token, Cairn returns HTTP 429 with Retry-After: 60 (Bolt waits and retries).
Methods
| Method | Scope | Arguments | Description |
|---|---|---|---|
auth.test | — | — | Verifies the token (Bolt calls it on start). Returns team_id, user_id (the bot), bot_id, app_id and more |
chat.postMessage | chat:write | channel, text, blocks, client_msg_id | Posts to a channel the bot is in |
chat.update | chat:write | channel, ts, text, blocks | Updates a message posted by the same installation’s bot |
chat.delete | chat:write | channel, ts | Deletes a message posted by the same installation’s bot |
users.info | users:read | user | ID, display name and avatar of an active workspace member |
conversations.members | channels:read | channel | IDs of active members of a channel the bot is in. Not paginated; next_cursor is always empty |
views.open | — | trigger_id, view | Opens a modal (see Modals) |
views.update | — | view_id, view, hash | Replaces an open modal |
chat.postMessage / chat.update / chat.delete
textis the fallback used for notifications, search, quotes and clients that cannot draw the card. If omitted, Cairn builds it from the blocks’ headers and text. When nothing can be built (e.g. a card with only buttons) you getno_text, so passtextclient_msg_id(a UUID) becomes the message ID; a retry with the same ID returns the existing message instead of posting again, so retries never double-postthread_tsis not supported. Threads in Cairn are separate channels, so pass the thread’s channel ID aschannelchat.updatedoes not mark the message as edited. Omittingtextkeeps the fallback text; sending onlytextwithoutblocksremoves the card and turns it into a regular message (as in Slack)- For
chat.update/chat.delete, pass the message UUID (thetsfrom the post response) asts - Like messages from people, bot messages trigger mention notifications and are searchable
users.info / conversations.members
- Only active workspace members are returned; deactivated members are treated as absent
- The
userfromusers.infohasid,team_id,name,real_name,profile.display_name,profile.image_72and so on. Email addresses are not returned conversations.membersdoes not include the bot itself
Error codes
| error | Methods | Meaning |
|---|---|---|
not_authed | All | No token was sent |
invalid_auth | All | The token is not valid |
token_revoked | All | The token was revoked or the app was uninstalled |
ratelimited | All | Rate limit exceeded (HTTP 429) |
missing_scope | All | A scope is missing; needed / provided are included |
unknown_method | All | The method is not supported |
invalid_form_data | All | The body could not be read or exceeded 1 MB |
internal_error | All | An error on Cairn’s side |
channel_not_found | chat.*, conversations.members | No such channel, or it belongs to another workspace |
not_in_channel | chat.*, conversations.members | The bot has not been added to the channel |
is_archived | chat.*, conversations.members | The channel (or the thread’s parent) is archived |
method_not_supported_for_channel_type | chat.*, conversations.members | DMs are not supported |
no_text | chat.postMessage, chat.update | Neither text nor blocks, or no fallback text can be built from the blocks |
msg_too_long | chat.postMessage, chat.update | text exceeds 40,000 characters |
invalid_blocks | chat.postMessage, chat.update | The blocks are not accepted; reasons in response_metadata.messages |
invalid_blocks_format | chat.postMessage, chat.update | blocks is not valid JSON |
invalid_arguments | chat.*, views.* | Invalid arguments (thread_ts, a non-UUID client_msg_id, an invalid view, …) |
client_msg_id_conflict | chat.postMessage | The client_msg_id is already used in another channel or by another sender |
message_not_found | chat.update, chat.delete | No such message, or it was deleted |
cant_update_message | chat.update | Not a message from this bot |
cant_delete_message | chat.delete | Not a message from this bot |
user_not_found | users.info | Not an active member |
invalid_trigger_id | views.open | The trigger_id is invalid or already used |
expired_trigger_id | views.open | The trigger_id expired (6 seconds) |
not_found | views.update | No such modal, or it was closed |
hash_conflict | views.update | The view changed since the given hash |
view_is_submitting | views.update | The view cannot be replaced while a submission is being delivered |
Reason texts in
response_metadata.messages are currently in Japanese. Branch on the error code.