CLOUDMORROW

Quills / Communication

Slack bridge

Channels and Slack as one conversation: what is said in a linked channel is said in the other, threads and all.

Star on GitHub · 0 Nobody has starred it yet

What it does

  • Link a channel here to a channel in Slack: what is written in either shows up in the other
  • Replies stay in their thread, on both sides
  • A message from Slack says who wrote it — Ada (Slack) — and is news here like any other
  • What you write is posted in Slack under your own name
  • Your own Slack app, made from a manifest in two minutes: no service in between, nothing leaves but the messages
  • Set up once by an administrator, under Administration › Quills › Slack bridge

Add it to your cloud

In your cloud, open Quills: Administration → Quills as an administrator, Me → Your Quills as anybody else. On its Catalog tab, Slack bridge is on the Communication shelf: open it and say yes. Its id, wherever your cloud asks for a quill by name:

id slack

Or on the command line, as an administrator for everyone, with --mine for yourself alone:

$ cm quill add slack

Either way your cloud shows you everything below and waits for your yes.

What it adds to your cloud

Datamodels

The kinds of data it works with. On a fresh cloud everyone can read and write what it brings the moment it is installed; the install sheet says so, and an administrator narrows it with circles. Records belong to the people who write them, not to the quill: removing it leaves every one where it is. What it adds — fields of its own, datamodels of its own — stays too, unless the administrator removing it chooses to drop them.

Uses

Channel channel

foundational

A room people talk in: public, private, or between two people.

  • Name name text, one linerequired Encrypted
  • Kind kind one of Public, Private, Direct Indexed
  • Topic topic text Encrypted
Uses

Message message

foundational

What somebody said in a channel.

  • Channel channel link to Channelrequired · deleted with its channel Indexed
  • Body body textrequired Encrypted
  • Sent at sent_at date and time Indexed
  • Reply to reply_to link to Messagedeleted with its message Indexed
  • Pinned pinned yes or no Indexed
Adds fields to

Message message

foundational

Fields of its own on every message, readable by anyone who may read the record, never required.

  • Slack message slack.ts text, one line Indexed
Introduces

Slack link slack.link

new, from Slack bridge

A channel here and a channel in Slack, kept as one conversation.

  • Channel channel link to Channelrequired · deleted with its channel Indexed
  • Slack channel id slack_channel text, one linerequired Indexed
  • Slack channel slack_name text, one linerequired Encrypted
Introduces

Slack member slack.member

new, from Slack bridge

Somebody in the Slack workspace, by name, as messages from them say it.

  • Slack user id user_id text, one linerequired Indexed
  • Name name text, one linerequired Encrypted
Introduces

Slack workspace slack.workspace

new, from Slack bridge

The Slack workspace this server's channels are bridged to: its bot, and how the bridge is doing.

  • Team team text, one line Encrypted
  • Team id team_id text, one line Indexed
  • Url url text, one line Encrypted
  • Bot user bot_user text, one line Encrypted
  • Bot id bot_id text, one line Encrypted
  • Token token text, one linerequired Encrypted
  • Signing secret signing_secret text, one linerequired Encrypted
  • Status status text, one line Encrypted
  • Received received whole number Encrypted
  • Last heard from Slack heard_at date and time Encrypted

Indexed fields are kept plain, so your cloud can sort and filter by them. Encrypted fields are encrypted before they reach the disk.

Screens

SlackDrawn by its code, settings().

Each is a tab, drawn by your cloud itself on every surface:

  • Phonethe web app, made for the phone
  • Webthe full web app, in a browser
  • Terminalthe terminal app
  • Command linecm slack
  • Assistanttools for your assistant, as you

Its own code

Webhook eventsPOST /hooks/slack/events, answered by its code, events()
Action connectConnect Slack; asks for token, signing_secret
Action linkLink to Slack; asks for channel, slack
Action unlinkUnlink, on a slack link; asks for nothing
Action disconnectDisconnect Slack; asks for nothing
Hook to_slackwhen a message is created
Reaches slack.comto post what is written in a linked channel to Slack, and to learn the names of the people who write there

Its Python, quill.py, runs in a sandbox on your cloud, as whoever uses it, and reaches only what it declares. Your cloud shows all of this before you say yes; code on your own machine runs only once you switch it on there.

In its own words

Channels and Slack as one conversation: link a channel on your Cloudmorrow server to a channel in Slack, and what is written in either shows up in the other, replies in their threads.

A Quill for Cloudmorrow, an add-on to Channels: install it from the Quill Catalog (Channels comes with it), or from this repository with cm quill add --source https://github.com/Cloudmorrow/quill-slack --ref v1.0.0. It needs Cloudmorrow 0.94.0 or later, the first that lets a Quill deliver into a datamodel it uses ([[delivers]]).

How it works

  • Your own Slack app carries the messages: made in your workspace from the manifest the settings page shows, in two minutes. There is no service in between; the server talks to slack.com and Slack talks to the server.
  • Written here, posted in Slack: a message in a linked channel is posted in the Slack channel by the app, under the writer's name. A reply goes into its thread.
  • Said in Slack, brought here: Slack's Events API tells the server, and the message arrives in the channel as from its sender there — Ada (Slack) — never as from anybody on this server. It is news like any other message: unread, pushed, counted. Every event is checked against the app's Signing Secret as well as the webhook's own token.
  • Not carried: edits, deletions, reactions, files (a file says shared a file in Slack), and anything said before the link. Direct messages are never linked.

Setting it up

An administrator, under Administration › Quills › Slack bridge:

  1. Make the app. At api.slack.com/apps, Create New App › From a manifest, pick the workspace, paste the JSON the page shows, and Install to Workspace.
  2. Connect it. Paste the app's Bot User OAuth Token (xoxb-…) and its Signing Secret, and press Connect Slack.
  3. Let Slack tell the server. In the app's Event Subscriptions, switch it on, paste the Quill's events webhook address (with its token, as the Quill's sheet shows it) as the Request URL, subscribe to the bot events message.channels and message.groups, and save. The server must be reachable from the internet at that address.
  4. Link channels. Link to Slack beside a channel, and the Slack channel's name. A public Slack channel is joined by the app; a private one needs /invite @Cloudmorrow in it first.

The people who post into a linked channel need the Slack bridge's data in one of their circles (the install sheet asks which), so their messages can find the link and go across.

What it adds to your Cloudmorrow

Needs Channels, installed with it
Datamodels uses channel, message; extends message with slack.ts; introduces slack.workspace, slack.link, slack.member
Brings in from outside message: what is said in a linked Slack channel, as from its sender there
Screens Slack, the settings, for an administrator on the Quill's sheet
Actions Connect Slack; Link to Slack; Unlink; Disconnect Slack — an administrator's
Code quill.py, in the sandbox: a hook when a message is written, a webhook for Slack's events; reaches slack.com only

Working on it

uv sync                  # .venv with Cloudmorrow and pytest
cm quill check           # the manifest, as a server would install it
cm quill test            # tests/, against the real record store and gate, Slack faked
cm quill test --sandbox  # the same, with quill.py in the sandbox