Skip to main content

Interactions

ChatOps4s supports Slack interactions exclusively through Socket Mode. This means your application connects to Slack over a WebSocket — no public URL, no HTTP server, no ingress configuration needed.

Socket Mode

When you call slack.start(botToken, Some(appToken)), the library:

  1. Calls apps.connections.open to get a WebSocket URL.
  2. Opens and maintains a WebSocket connection.
  3. Routes incoming events (button clicks, slash commands, form submissions) to the handlers you registered.

The appToken (an xapp-... token with connections:write scope) is required for Socket Mode. If you only need to send messages without receiving interactions, you can pass None for the app token — but then you won't receive button clicks, slash commands, or form submissions.

Disconnect Handling

Slack periodically disconnects Socket Mode clients (e.g. during deployments or when a connection has been open too long). ChatOps4s handles these disconnects automatically by reconnecting when it receives a disconnect frame with reasons like link_disabled, warning, or refresh_requested.

You don't need to add any retry logic — the library takes care of it.

Interaction Types

ChatOps4s supports three types of interactive features, each covered in its own section:

FeatureDescription
Slash CommandsUsers type /command args in Slack. Arguments parsed into typed values.
ButtonsClickable buttons attached to messages. Handlers receive typed payloads.
FormsModal dialogs with input fields. Derived from case classes.

All interactions require Socket Mode (i.e. an appToken).