Slack Plugin
Install
pnpm add -D @theholocron/holocron-plugin-slackCapabilities
| Capability | Token |
|---|---|
notifications | HOLOCRON_SLACK_TOKEN (slack) |
Config
Section titled “Config”providers: { notifications: ["slack", { // Optional: default channel id used when send() is called without a channel defaultChannel: "C0123456789", }],}Options
Section titled “Options”| Option | Required | Description |
|---|---|---|
defaultChannel |
No | Slack channel id (e.g. C0123456789) used as the fallback channel |
Authentication
Section titled “Authentication”1. Create a Slack app
Section titled “1. Create a Slack app”- Go to api.slack.com/apps and click Create New App → From scratch
- Name it (e.g. “Holocron”) and select your workspace
2. Add the bot scope
Section titled “2. Add the bot scope”- Under OAuth & Permissions → Scopes → Bot Token Scopes, click Add an OAuth Scope
- Add
chat:write— required to post messages - Optionally add
channels:readif you want name-to-id resolution
3. Install to workspace and copy the token
Section titled “3. Install to workspace and copy the token”- Under OAuth & Permissions, click Install to Workspace
- Approve the permissions
- Copy the Bot User OAuth Token — it starts with
xoxb-
4. Store the token
Section titled “4. Store the token”holocron auth set slack xoxb-xxxxxxxxxxxx-xxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxOr via env var:
export HOLOCRON_SLACK_TOKEN=xoxb-...# Also recognized:export SLACK_BOT_TOKEN=xoxb-...What notifications provides
Section titled “What notifications provides”send(channel, message)— post a plain-text message to a channel id. Falls back todefaultChannelwhenchannelis an empty string.
Example
Section titled “Example”import { createPlugin } from "@theholocron/holocron-plugin-slack";
const plugin = createPlugin({ token: process.env.HOLOCRON_SLACK_TOKEN, defaultChannel: "C0123456789",});const notif = plugin.capabilities.notifications();
await notif.send("C0123456789", "Deploy complete :white_check_mark:");// or use the default channel:await notif.send("", "Deploy complete");