This plugin is in development. Its offline fixtures use fictional Slack transports and accounts.
Installed acceptance against the released SDK and a new gallery review are pending. The existing
captures illustrate earlier behavior.
heinzel-slack
Slack as an extra notification channel and as a place to share a draft and get a yes or no back: a
Heinzelmännchen plugin, released on its own.
- A notice says why. Every message carries "Why you are seeing this", because a nudge that cannot say why is noise.
- A draft is shared with Approve and Decline. The answer is for the exact text you saw, and only you can give it.
- Your DM for you. Notices, drafts and questions go to your direct message with your own app, nobody else.
- Chat for your Heinzels. As Core's
chat capability it reads channels its bot was invited to and posts there
for publish operations, every mention made inert; and it notifies and asks you in your DM, options as buttons.
Lotte has a draft for you
Weekly report
Why you are seeing this: It is Friday and you asked for a report.
| Weekly report ... |
Nothing goes out until you say so. Fingerprint 3fa9c1d2b4e0 · answer by 16:00 · only your click counts.
[ Approve ] [ Decline ]
Prerequisites
The bot channel needs all of these. The separate reviewed-link adapter does not use the bot or app tokens.
For links-only use, explicitly run hz system config set slack.bot_enabled false and configure the SlackCLI
path/profile described below. The bot's local and live health checks then report it disabled without contacting
Slack; reviewed links still require their own exact account, target, grant and human approval checks.
slack.bot_enabled true enables the bot and reports every missing prerequisite. When unset, any configured
owner/workspace or stored bot/app token retains the existing bot setup and its missing-prerequisite checks,
even when SlackCLI selectors are also configured. An entirely unconfigured bot is optional and neutral.
hz setup slack explicitly enables the bot. Disabling it prevents bot sends, listening and approval consumption;
it does not grant reviewed-link delivery or remove its independent safeguards.
- Heinzelmännchen 0.9.20 or newer within the 0.9 series. The development lock uses 0.9.20.
- A Slack workspace where you may install an app. You create a private app that only you use, in your own
workspace, from the manifest this plugin ships. If your workspace lets only admins install apps, ask for approval
of that one app (the manifest lists exactly what it can do) or use a workspace of your own. The plugin does not
work around that setting.
- Your Slack member ID: your profile, the three dots, "Copy member ID" (like
U01ABCDEF), and your
workspace ID (like T01ABCDEF), configured as slack.owner and slack.team. Both are required.
- Two tokens from your app, kept in the OS keychain by
hz, never in a file or a repository:
- the bot token (
xoxb-..., on Install App), scopes channels:history, channels:read, chat:write,
im:history, im:write, users:read (see Scopes); an app installed from an earlier manifest
needs the new manifest and a reinstall for the chat capability;
- an app-level token (
xapp-..., on Basic Information, scope connections:write) for Socket Mode.
- Python 3.12+ (supplied by uv) and an internet connection to
slack.com. No public address, no port to open.
Set up (about three minutes)
hz slack manifest # copy the JSON
# api.slack.com/apps, Create New App, From a manifest, paste it, Create, Install to Workspace.
# Basic Information, App-Level Tokens, Generate Token with connections:write.
hz system credential set bot-token --service slack
hz system credential set app-token --service slack
hz system config set slack.owner U01ABCDEF # or: hz setup slack
hz system config set slack.team T01ABCDEF
hz system doctor # then: hz system connector test slack
The adapter registers notification and approval ports for the core channel consumer. Registration
alone does not route notices or grant consent. In the installed offline acceptance flow, the source-bound host
reviews each exact posting target and message through its normal human confirmation surface before sending.
Consenting to post a draft does not approve that draft: an owner click is a separate claim the host verifies.
The plugin operations can be used explicitly:
hz slack notify "Build done" "You asked to know when it finishes." --helper Otto
hz slack ask "Send the weekly report" "$(cat report.md)" --helper Lotte
hz slack wait <request-id> # listens for your click, up to --seconds; or: hz slack status <request-id>
Clicks are only registered while something listens (wait, listen, or the five-minute listen job while a draft is waiting). A button pressed with
nobody listening shows Slack's "not responding" notice and the draft stays waiting; press it again once hz listens.
The message says nothing false in the meantime: it still shows the buttons because it is still unanswered.
What approval means here
Approval follows a typed code path (T3). DraftStanding.approves(draft) checks an approved state and the exact
draft digest. A host consuming ChannelApprovalReply must separately validate the request, actor, argument digest
and expiry before acting. The plugin records a decision only if all of this held:
| Held at click time |
How |
| It is a button press on our message |
Replies, reactions and slash commands are not even subscribed to, and any such payload is refused |
| The person is you |
The clicker's Slack ID equals the owner recorded before posting; a project hz.toml cannot set it |
| Right workspace, conversation and message |
Compared with what was recorded when the message was posted |
| The exact bytes |
The button carries the host argument digest; the stored preview is hashed again under the lock; DraftStanding.approves(draft) hashes what you pass |
| Still fresh |
Pending, not expired (default 4 hours), click time plausible; replacing a draft requires an explicit host settle(reference, "superseded") call |
| Once |
The move from pending to decided is a single atomic update, so a second click, a Slack retry or a replay is refused |
Everything else from Slack is data. Only identifiers are read; message text, names and replies are never parsed for
meaning. A draft containing control, zero-width or bidirectional characters is refused (it could not be reviewed as
it is), and a draft over 4,000 characters is refused (you could not read it all in Slack). The draft is shown in a
literal preformatted block, so mentions and links in it are inert. Refused clicks are recorded in the audit trail
(approvals.sqlite3 in the state folder, readable by you only) with a code of ours, never Slack's text.
What this does not prove: that a human, rather than software running as you in Slack, pressed the button. It is an
application-level decision by the owner's Slack account, as in hz core's own confirmations. Anyone who controls
your Slack account or the machine controls your approvals.
Why your own app and not a browser session or the Slack CLI
| Approach |
Verdict |
Browser session tokens (community CLIs such as slackcli with xoxc/xoxd) |
Acts as you, nothing to install, but it is an unofficial use of your login that Slack can break or forbid at any time, tokens die when you sign out, and it cannot receive button clicks. Approval would be a reaction or a typed reply, which cannot be bound to the exact bytes. Not a dependency for a product. |
The official Slack CLI (slack) |
Builds and runs apps on Slack's platform and manages manifests; it has no way to post a message or receive a click for another tool. Useful for creating and installing the app during development. |
A private Slack app (this plugin): bot token for the Web API, Socket Mode for clicks, official slack-sdk |
Supported by Slack, least privilege (six bot scopes, no user scope, no event subscriptions), signed identity of the clicker in every click, and no inbound address, so nothing is hosted. Chosen. |
Tenets weighed: P1 ("your identity over a bot identity") and ADR 0035 ("only what an ordinary employee may do, no admin-registered
apps") against T3 and P2 (approval must be bound and verifiable) and distributability. The app here is yours alone, in
your workspace, created by you, and it writes to your own DM as a mailbox. It never posts as you: when Core's chat
capability posts to a channel the bot was invited to, it is the app speaking, for a publish operation Core gated. Anything published under your name later is a separate step with your identity. If you cannot install an
app, the plugin reports so; it does not fall back to a browser session.
Chat capability and self channel
The plugin provides Core's chat capability as the adapter slack (read and write; bind it with
[capabilities] chat = "slack" when another chat adapter is installed too). It does not replace the ports below:
reviewed helper notices and draft Approve/Decline stay on SlackChannel.
messages(channel, window) reads a public channel the bot was invited to, by id (C...) or #name: top-level
messages in the window and the replies in their threads, oldest first, paging until the window is covered. Text,
names and labels are untrusted data: mentions come back as names (@Ada, never U...), links as label and
address, and everything passes Core's clean_text. A reply in a thread started before the window is not found:
Slack's bot API lists replies per thread, not by time. Too many messages for one window ask for a narrower one.
post(channel, text, thread=None) posts as the app with every &, < and > escaped, so <!channel>,
<!here>, <@U...> and group mentions stay text, and bare @here, @channel and @everyone get a full-width
at sign. Unfurling and name linking are off. Text over Slack's 40,000 characters is refused, never cut.
Direct messages and group chats are out of the capability's scope.
notify_self(text, thread=None, context=None) posts to your DM with the app (slack.owner), as a reply in
thread when given; the returned thread continues the conversation. context is a short bold label.
ask_self(question, options=(), timeout=..., thread=None, context=None, cancel=None) posts the question with one
button per option and waits, up to timeout seconds, for your click (Socket Mode, the app-level token) or a
message you type in its thread, or for a top-level question in the DM after it (polled every
slack.poll_seconds, default 3). Only your own click or message counts. It returns the chosen option (also as
its text), your typed text (cleaned), or timed_out; a timeout or cancel never raises. Every exit closes the
socket, and the buttons are then taken off the message in the background. Without an app-level token, the
options are listed and a reply naming one chooses it. The timeout counts from the call; a Slack call under way
when it passes or cancel is set ends within its own limit (slack.timeout to connect or post, 5 s for a reply
read), and a rate-limited reply read is retried at the next check, never slept on. Two top-level questions open
at once both take your next top-level DM message as their answer; reply in a question's thread to answer just it.
Each waiting question holds one Socket Mode connection (Slack allows ten per app); beyond that, typed replies
still answer.
Self-channel buttons have their own action ids (hz_self_<n>) and a per-question nonce; they are never an approval,
a ChannelApprovalReply or a change to a DraftStanding. Socket Mode spreads one app's events over all its
connections, so the approval listener may receive a question's click and an asking question an approval click: each
listener routes self-channel clicks to the local store, where the waiting question reads them, and approval clicks to
the approval checks above. Calls that hit Slack's rate limit wait for its Retry-After (at most 30 s per wait,
60 s per call), then give up with an error; a lost post acknowledgement is reported as unknown and never retried.
Core calls notify_self and ask_self itself (ADR 0160); operations cannot reach them through a handle.
This needs a Core with ADR 0160 (0.9.43 or later). An older Core gets messages and post only.
Scopes
| Scope |
For |
chat:write |
Notices, drafts and questions in your DM; posts for the chat capability |
im:write |
Opening your DM with the app |
im:history |
Reading your typed answer to a question in that DM |
channels:read |
Resolving a #name to a channel id |
channels:history |
Reading messages of public channels the bot was invited to |
users:read |
Showing names instead of member ids |
connections:write (app-level token) |
Socket Mode: receiving button clicks without a public address |
Ports
The plugin registers one service, SlackChannel, a NotificationChannel and an ApprovalChannel as the candidate
SDK defines them; core imports nothing from this plugin and names no Slack. A channel carries words and never decides: