Channels

Slack

Use Socket Mode so there is no public URL. Catalog socket inbound is cx.listen("slack"). Slack Events url_verification currently parses to [] with no HTTP echo — do not use handle("slack") for this example.

Install

pip install 'caspian-sdk[slack-socket]'
bun add caspian-sdk

Socket Mode

  1. Enable Socket Mode on the Slack app.
  2. Create an App-Level Token (xapp-) with connections:write.
  3. Install the app; copy the Bot User OAuth Token (xoxb-).
  4. Copy Signing Secret from Basic Information (kept on the connection even though Socket Mode inbound is trusted).

Invite the bot. Subscribe to message.channels / message.groups / message.im as needed.

export SLACK_BOT_TOKEN='xoxb-…'
export SLACK_APP_TOKEN='xapp-…'
export SLACK_SIGNING_SECRET='…'
bot.py
cx = Caspian()   # no Caspian key
cx.channels.add(
    "slack",
    via="self-host",
    bot_token=token,
    signing_secret=signing_secret,
    app_token=app_token,
)
cx.listen("slack")
bot.ts
const cx = new Caspian()
await cx.channels.add("slack", {
  via: "self-host",
  bot_token: token,
  signing_secret,
  app_token,
})
await cx.listen("slack")

What it can do

Receive, reply, send, media, buttons, blocks, react, edit, delete, threading, modals, history. Overlap is per Slack thread (slack:C…:ts) — see Overlap.