agent-orchestrator/website/content/docs/plugins/notifiers/slack.mdx

106 lines
4.2 KiB
Plaintext

---
title: Slack notifier
description: Slack incoming webhook. Minimal config, no bot token required.
---
<div style={{ display: "flex", alignItems: "center", gap: "0.75rem", margin: "0.5rem 0 1.25rem" }}>
<Logo name="slack" size={28} color />
<span style={{ fontSize: "0.8125rem", color: "var(--color-fd-muted-foreground)" }}>
Slot: <code>notifier</code> · Name: <code>slack</code>
</span>
</div>
<PlatformSupport macos="full" linux="full" windows="full" />
## Setup
Run the setup command:
```bash
ao setup slack
```
If Slack is already configured, the command asks whether to keep the existing
webhook URL, change it, create a new one, or cancel. If you already have a
Slack incoming webhook URL, paste it when prompted. If not, the command shows
the Slack apps URL and waits while you create one. From the setup steps screen
you can paste the URL, show the steps again, go back to the previous options, or
cancel. The change-webhook path also lets you paste a new URL, view creation
steps, go back, or cancel.
1. Open **https://api.slack.com/apps**.
2. Create a new app, or select an existing app.
3. Open **Incoming Webhooks** and turn on **Activate Incoming Webhooks**.
4. Select **Add New Webhook to Workspace**.
5. Pick the channel AO should post to, authorize, and copy the webhook URL.
The command sends a test message before writing AO config.
Before saving, AO also asks which notification priorities Slack should receive:
`urgent-only`, `urgent-action`, or `all`. For scriptable setup, pass
`--routing-preset <preset>`.
Useful setup checks:
```bash
ao setup slack --status
ao setup slack --refresh
```
```yaml title="agent-orchestrator.yaml"
notifiers:
slack:
plugin: slack
webhookUrl: https://hooks.slack.com/services/...
username: "Agent Orchestrator"
channel: "#agents" # optional; should match the webhook's channel
```
## Config
| Key | Required | Default | What it does |
| ------------ | -------- | -------------------- | --------------------------------------------------------------------------------------------------- |
| `webhookUrl` | ✓ | — | Slack incoming webhook URL |
| `channel` | optional | webhook default | Informational/compatibility channel name; should match the channel chosen when creating the webhook |
| `username` | optional | `Agent Orchestrator` | Requested display name |
## Notes
- No bot token / OAuth to manage. Incoming webhooks are the simplest integration Slack offers.
- Slack incoming webhook URLs are tied to the channel selected during setup. Do not rely on `channel` to reroute messages to a different channel.
- For private channels, the installing Slack user must already be in the channel before creating the webhook.
- Treat the webhook URL as a secret; do not commit it publicly.
- This notifier does **not** handle `Retry-After` headers — if you're sending at high volume, use the [webhook notifier](/docs/plugins/notifiers/webhook) with retries configured.
- Messages use Slack Block Kit (header + section + context blocks). Action URLs render as inline links in the context block.
<Accordions>
<Accordion title="Outgoing payload shape">
```json
{
"blocks": [
{
"type": "header",
"text": { "type": "plain_text", "text": "🔔 pr.created — sess_01HXY...", "emoji": true }
},
{
"type": "section",
"text": { "type": "mrkdwn", "text": "PR opened: fix(auth): handle token expiry" }
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "*Project:* myproject | *Priority:* info | *Time:* <!date^1713387600^{date_short_pretty} {time}|2026-04-17T...>"
}
]
},
{
"type": "section",
"text": { "type": "mrkdwn", "text": ":github: <https://github.com/owner/repo/pull/123|View Pull Request>" }
}
]
}
```
</Accordion>
</Accordions>