Chat Ops — connecting Slack
Chat Ops brings Ouroboros into Slack. This page is for the person who sets it up. It covers:
- registering the deployment's own Slack app;
- giving the deployment the app's credentials;
- installing the app into a workspace, and checking that it works;
- how Ouroboros verifies what Slack sends it;
- where Ouroboros posts, and how delivery is retried and reported.
What the cards look like, and how each person links their own Slack identity, are in the User Guide's Chat Ops.
Connecting Slack, linking identities, publishing cards, the
/ouro commands, answering a decision with a card's button and
escalation work now.
Each deployment registers its own app
A self-hosted deployment cannot use anybody else's Slack app. The deployment administrator creates one Slack app for the deployment; an Owner or Maintainer of each Ouroboros workspace then installs it into their Slack workspace.
You need:
- a Slack workspace where you may create and install apps;
- the deployment's public address — the value of
OURO_UI_URL, such ashttps://ouroboros.example.com. It must be HTTPS and reachable from Slack.
Create the app
At api.slack.com/apps choose Create New App, then
From a manifest. Pick the workspace and paste this manifest, replacing every
https://ouroboros.example.com with your deployment's address:
display_information:
name: Ouroboros
description: Answer what your loops are waiting on, from Slack.
features:
bot_user:
display_name: Ouroboros
always_online: true
slash_commands:
- command: /ouro
url: https://ouroboros.example.com/api/v1/slack/commands
description: Ouroboros commands
usage_hint: link | unlink | help
should_escape: false
oauth_config:
redirect_urls:
- https://ouroboros.example.com/api/v1/slack/oauth/callback
scopes:
bot:
- chat:write
- commands
- channels:read
- groups:read
- im:write
- users:read
- users:read.email
settings:
event_subscriptions:
request_url: https://ouroboros.example.com/api/v1/slack/events
bot_events:
- app_uninstalled
- tokens_revoked
interactivity:
is_enabled: true
request_url: https://ouroboros.example.com/api/v1/slack/interactivity
org_deploy_enabled: false
socket_mode_enabled: false
token_rotation_enabled: false
The four addresses
All four are on the deployment's one public address.
| Slack setting | Address |
|---|---|
| Event Subscriptions → Request URL | /api/v1/slack/events |
| Interactivity & Shortcuts → Request URL | /api/v1/slack/interactivity |
Slash Commands → /ouro → Request URL | /api/v1/slack/commands |
| OAuth & Permissions → Redirect URL | /api/v1/slack/oauth/callback |
The scopes
The app asks for seven bot scopes and no user scopes. None of them reads message content.
| Scope | What Ouroboros uses it for |
|---|---|
chat:write | Posting messages as the app in channels it was added to. |
commands | The /ouro command. |
channels:read | Listing public channels, so a channel can be chosen by name. |
groups:read | The same, for private channels the app was invited to. |
im:write | Opening a direct message with a person. |
users:read | A person's display name on the linking screen. |
users:read.email | A suggestion on the linking screen: whether the Slack profile's email matches the signed-in account. It never links anyone by itself. |
Give the deployment the app's credentials
Copy three values from the app's Basic Information page into the REST service's environment:
OURO_SLACK_CLIENT_ID— the Client ID.OURO_SLACK_CLIENT_SECRET— the Client Secret.OURO_SLACK_SIGNING_SECRET— the Signing Secret.
Set all three or none: the REST service refuses to start with only some of them. Restart it after setting them.
Slack checks the Event Subscriptions address the moment you save it. The deployment must already be running with the signing secret set, or Slack reports the address as unverified. If it does, set the variables, restart the REST service, and choose Retry in Slack.
With none of the three set, the Slack tile in Settings reads not connected with No Slack app is registered on this deployment (OURO_SLACK_CLIENT_ID). and offers nothing to press.
Install the app into a workspace
An Owner or Maintainer installs it, from the Chat Ops page:
- Open the Integrations section of Settings and, on the Slack tile,
choose Chat Ops →. The page is at
/chatops. - The page reads Install the Slack app into your workspace. Choose Install.
- Slack shows what the app asks for. Approve it.
- Back in Ouroboros, bind your first channels.
Until the deployment has its Slack app, the same page reads This deployment has no Slack app
yet and lists what to do: create the app from the manifest, give the deployment
OURO_SLACK_CLIENT_ID, OURO_SLACK_CLIENT_SECRET and OURO_SLACK_SIGNING_SECRET, restart
it, and come back to install. There is no Install button in that state — there is nothing
to install yet. A member who is not an Owner or a Maintainer sees what is missing and who can
fix it, and no Install.
Connect on the Slack tile in Settings starts the same installation. Reinstall on the tile, and Re-install on the Chat Ops page, run it again — use them after the app's scopes change, or after Slack revoked the app.
Bind the first channels
After installing, the Chat Ops page reads Bind your first channels. Binding a channel says what it is for, and switches on that purpose's default routes:
| Purpose | Default routes |
|---|---|
| Loops | custom:blocking-questions, with a direct message to the on-call person; custom:loop-finished; custom:stage-transitions, switched off |
| Alerts | custom:build-failures |
| Leads | custom:weekly-insights |
- In Slack, add the bot to each channel:
/invite @Ouroboros. Ouroboros can only post where it is a member, and it cannot join a channel on its own — public or private. - On the Chat Ops page choose Choose a Loops channel (or Alerts, or Leads), pick the channel, and choose Bind.
A route the workspace already has keeps its switch as you left it and is pointed at the new channel; a route it does not have is created. The steps for adding more channels later are in the User Guide's Add a channel. Binding and unbinding a channel are recorded in the audit trail.
After Slack revokes the app
When the app is removed from the Slack workspace, or its token is revoked, the Chat Ops page's connection strip reads revoked with Slack's reason, and nothing reaches your channels. Until it is installed again the page shows each bound channel's mirror as history only: it can be read, and nothing can be run, bound or unbound.
To re-install:
- Open Chat Ops as an Owner or a Maintainer.
- Choose Re-install on the connection strip.
- Approve the app in Slack. You return to Settings, which reads the connection as working.
Your bound channels, routes and linked identities are kept. Messages that could not be sent while the app was revoked were set aside, not queued: they are not sent afterwards.
One Slack workspace connects to one Ouroboros workspace. The token Slack grants is encrypted before it is stored, is never shown again, and is never written to a log.
What the tile says
| The tile reads | It means |
|---|---|
| The Slack workspace's name | Connected and working. |
| not connected, with Connect | The deployment has a Slack app; this workspace has not installed it. |
| not connected, with Slack revoked the app (…) | The app was removed from the Slack workspace, or its token was revoked. Connect installs it again. |
| not connected, with No Slack app is registered on this deployment | The three variables are not set. |
| The workspace's name, marked as needing attention | Installed, but Slack is answering with an error. The tile gives Slack's reason. |
Installing, and the connection being revoked, are both recorded in the audit trail, as is every identity a person links or unlinks.
Check that it works
- Slack's Event Subscriptions page shows the request URL as Verified.
- The Slack tile shows the Slack workspace's name.
- In Slack,
/ouro helpanswers, visible only to you. /ouro linkanswers with a Link your account button, and the page it opens completes the link. See Chat Ops in the User Guide.- Removing the app from the Slack workspace turns the tile to not connected, with Slack's reason.
Where messages go
What Ouroboros posts, and where, is decided by the workspace's notification routes — the same routes the Notifications section of Settings shows (Notifications, email & webhooks). A route delivers to Slack only while Slack is connected: until then it reads locked, connect Slack first.
| What is posted | Route, as the Notifications section lists it |
|---|---|
| A question a loop is waiting on | custom:blocking-questions — to a channel, and as a direct message to the on-call person when the route says so. Needs-you decisions → Slack DM sends the direct message alone. |
| A loop that finished | custom:loop-finished |
| The weekly digest | custom:weekly-insights, once a week at the route's day and time (UTC) |
| A build that failed | custom:build-failures — not posted yet |
| A build that went green | custom:stage-transitions — not posted yet |
A message goes only to a route that is switched on, and each channel gets a given message once, even when two routes name the same channel.
A route's channel is chosen by binding a channel on the Chat Ops page, and changed route by route on that page's What gets published where card. A Slack route is listed in the Notifications section with its switch; switching one on while it has no channel is refused with choose a Slack channel first.
Direct messages go to the person on call:
- Designating the on-call person. An Owner or a Maintainer chooses them with Change, beside + DM on-call on the Chat Ops page's What gets published where card. One person is on call at a time; rotations are not available yet. Needs-you decisions → Slack DM sends each question to that person — and nothing while nobody is designated.
- Direct messages need a link. Only a member who has linked their Slack identity can be designated.
The bot posts only in channels it has been added to. In Slack, add it with /invite @Ouroboros.
Answers from Slack
A button on a decision card answers the decision as the person who pressed it — see Answer a decision from Slack. Nothing needs configuring, and there is no separate permission for it:
- The presser must have linked their Slack identity, and their account must be allowed to give
that answer — for most answers, the
can_approve_loopscapability (Roles). The rule is the inbox's own. - A merge is never completed from Slack. A merge decision's card links into the app, and
/ouro answerrefuses it. - Each answer is in the audit log as answered a decision from Slack, under the person's name, with what permitted it and the channel and message it came from.
Escalation
A decision posted to Slack starts a countdown — its escalation window, counted from when the question was asked. If nobody answers in time, Ouroboros marks the card ⚠ escalated — now in the Needs-you inbox, moves the decision to the top of the Needs-you inbox, and sends the card as a direct message to the on-call person. Answering or snoozing the decision, or the decision being withdrawn, cancels the countdown.
| Decision kind | Window |
|---|---|
| Most kinds — merge approval, protected path, claim waiver and others | 30 minutes |
| Splits and re-sizes | 1 day |
| Facts | 1 week |
- Changing a window for your workspace. A workspace can have its own window for a kind,
of up to seven days. There is no screen or API for it yet: it is a row in the
database table
decision_escalation_overrides(workspace, kind, window), which your operator sets. A new window applies to decisions asked after it is set; a countdown already running keeps the window it started with. - The on-call person. The direct message goes to whoever is on call for decisions, once they have linked their Slack identity. An Owner or a Maintainer designates them; with nobody on call the decision still escalates — the card is marked and the inbox reorders — and no direct message is sent.
- After downtime. A countdown that ended while Ouroboros was stopped escalates once, when it starts again.
- Decisions not posted to Slack — because no route delivers them — start no countdown and do not escalate.
Delivery: retries and failures
Ouroboros records each message it means to send before it sends it, so a message survives a restart, a network failure or a rate limit.
- Retries. A message that fails for a passing reason — Slack unreachable, a server error, a rate limit — is tried again: after 30 seconds, then twice as long each time, up to an hour between attempts, for eight attempts in all.
- Rate limits. When Slack says how long to wait (
Retry-After), Ouroboros waits at least that long, and holds back the other messages for that Slack workspace as well. - No duplicates. The same message is never posted to the same channel twice, however many times it is retried or reported.
- Messages that cannot be delivered. After eight attempts — or at once, if Slack will never accept the message — the message is kept as a dead letter with Slack's error. It is not retried again and not silently dropped.
- Nowhere to send it. If the bot was removed from the channel, the channel was archived, or the app was uninstalled, the message is set aside with that reason rather than retried.
Seeing how delivery stands
GET /api/v1/slack/connection reports it under delivery:
delivery.state | It means |
|---|---|
idle | Nothing has been published, and nothing is waiting. |
healthy | Messages are going out. |
retrying | At least one message failed and will be tried again. |
dead_lettered | At least one message was given up on in the last seven days. lastError carries Slack's error for the most recent one. |
pending, retrying and deadLettered are the counts. stuck counts the messages that have
failed three times and are still being retried, and affectedRoutes lists the routes that have
a dead letter or a stuck message. Dead letters are also written to the REST service's log, and
are kept for 30 days.
The Chat Ops page shows the same thing as a banner under the connection strip, while
deadLettered or stuck is above zero. The User Guide describes it under
Messages are not reaching Slack.
Retry undelivered messages
A dead letter is not retried by itself. To send the dead letters again:
- Fix the cause — the list below says how for the common errors.
- Open Chat Ops as an Owner or a Maintainer.
- Choose Retry now on the banner.
Every message given up on in the last seven days is queued again and gets the full eight attempts. A message is never posted twice. The banner goes away once they are delivered; if a message fails again, the banner returns with Slack's new answer.
The same action is POST /api/v1/slack/connection/delivery/retry. It answers
409 slack_not_connected when the workspace has no working connection — re-install the app
first. Each retry is recorded in the audit trail as
chat.delivery_retried.
Common errors on a dead letter:
channel_not_found,not_in_channel— add the bot to the channel: send/invite @Ouroborosin it, then choose I invited it — refresh on that channel's mirror.missing_scope— the app was installed before a scope was added; choose Reinstall on the Slack tile.bot_token_unreadable— the stored token could not be decrypted; check the deployment's vault key, then Reinstall.
How requests from Slack are verified
Slack calls three addresses: events, button presses and the /ouro command. Ouroboros trusts
nothing about such a request except its signature.
Slack signs each request with the app's signing secret. Ouroboros computes the same signature over the request exactly as it arrived and compares the two. A request that is unsigned, signed with another secret, altered after signing, or more than five minutes old is refused, and the refusal is logged. Nothing in a refused request is read or acted on.
Because requests older than five minutes are refused, keep the server's clock synchronised. A clock that drifts makes Slack's genuine requests look like replays.
Ouroboros acknowledges every request at once and does the work afterwards, so Slack never times a command out. An event Slack sends twice is handled once.
Development: Socket Mode
A stack on your own machine has no public address for Slack to call. For development only, the app can connect out to Slack instead:
- In the app's settings, turn Socket Mode on.
- Under Basic Information → App-Level Tokens, create a token with the
connections:writescope. It beginsxapp-. - Set
OURO_SLACK_SOCKET_MODEtotrueandOURO_SLACK_APP_TOKENto that token, alongside the three variables above.
Events, button presses and /ouro then arrive over that connection. The redirect address can
be http://localhost:3000/api/v1/slack/oauth/callback.
Socket Mode is a development convenience. The REST service refuses to start with
OURO_SLACK_SOCKET_MODE=true in production; HTTPS with verified signatures is the only
supported way to run it.
When something is wrong
- Slack will not verify the Event Subscriptions address. The signing secret is not set, the REST service was not restarted after setting it, or the deployment's address is not reachable from Slack over HTTPS.
/ouroanswers with Slack's own error, such as dispatch_failed. The same causes — or the server's clock is more than five minutes out.- Connect returns to Settings and the tile still reads not connected. The install was declined in Slack, took longer than ten minutes, or was started in one browser and finished in another. Choose Connect again. If that Slack workspace is already connected to a different Ouroboros workspace, it cannot be connected to a second one.
- The tile turned to not connected by itself. The app was removed from the Slack workspace or its token was revoked. Choose Connect to install it again; people's links are kept.
- Nothing is posted to a channel. The route is switched off, has no channel, or the bot is
not in the channel. Check
deliveryonGET /api/v1/slack/connection— see Delivery: retries and failures. - A card still shows answer buttons after the decision was answered. The edit is waiting behind a rate limit or a retry; it is applied when Slack accepts it. Pressing a button on such a card changes nothing: the presser is told who answered.
- A button answers That button is not valid for this message. The press did not come from a card this connection posted for that decision — for example a card posted before Slack was reconnected. Nothing was changed; answer in the Needs-you inbox.
- A decision passed its window and nobody was messaged. Nobody is on call for decisions, or the on-call person has not linked their Slack identity.