Skip to main content

Connect Slack

Connect a Slack workspace and your agent can read channels and post messages there. You talk to the agent in Custodian (the chat link, the Flow Builder or the SDK), and it uses Slack as a tool:

You: "Summarize today's messages in #support and post the summary to #team-leads."
Agent: reads #support → writes the summary → posts it to #team-leads
ToolWhat it does
slack_list_channelsLists the channels the bot can see.
slack_readReads recent messages in a channel, or the replies in a thread.
slack_sendPosts a message to a channel.
slack_replyReplies in a thread.

slack is shorthand for all four. Messages appear in Slack as your bot, not as you.

note

The agent works from Custodian to Slack. It doesn't reply when people @mention or DM the bot inside Slack.

1. Create a Slack app​

You need your own Slack app in the workspace. It takes about five minutes.

  1. Go to api.slack.com/apps and click Create New App.
  2. Choose Paste a manifest (not a template), and pick your workspace.
  3. Choose JSON, replace everything in the editor with the manifest below, then click Next → Create.
{
"display_information": { "name": "Custodian Bot" },
"features": {
"bot_user": { "display_name": "Custodian Bot", "always_online": false }
},
"oauth_config": {
"scopes": {
"bot": ["channels:read", "channels:history", "chat:write", "groups:read", "groups:history"]
}
},
"settings": {
"org_deploy_enabled": false,
"socket_mode_enabled": false,
"token_rotation_enabled": false
}
}

You can change the name. Keep token_rotation_enabled set to false: with rotation on, Slack's tokens expire after 12 hours and the agent stops working.

ScopeLets the agent
channels:readList public channels.
channels:historyRead messages in public channels.
chat:writePost messages and thread replies.
groups:read, groups:historyDo the same in private channels. Optional: remove them if the agent should only see public channels.

2. Install it and copy the bot token​

  1. In your app's settings, open OAuth & Permissions and click Install to Workspace, then Allow.
  2. Copy the Bot User OAuth Token. It starts with xoxb-.

Use the bot token, not a user token (xoxp-) or an app-level token (xapp-). Custodian rejects anything that doesn't start with xoxb-.

3. Invite the bot to your channels​

The bot can only read and post in channels it has joined. In each channel the agent should use, either:

  • type /invite @Custodian Bot, or
  • click the channel name → Agents & apps (or Integrations) → Add apps.

4. Find a channel ID (optional)​

You can set a default channel that the agent uses when you don't name one. It must be a channel ID, not a name: click the channel name, and the ID is at the bottom of the About tab. It looks like C0123ABCD.

Don't use the App ID from your app's settings page. It starts with A, and channel IDs start with C.

5. Connect it in Custodian​

  1. In the Flow Builder, drag Slack onto an agent.
  2. Open the agent's settings, paste the bot token, and optionally the default channel ID.
  3. Click Connect Slack. Custodian checks the token with Slack and shows Connected to your workspace.
  4. Deploy.

In a squad, connect Slack only on the agent that needs it.

Keep it safe​

  • The token is stored encrypted and never returned by the API. Only a masked form such as xoxb-…1a2b is shown.
  • Exported flows never include the token. Reconnect Slack after importing a flow.
  • Deploy with private or password sharing. With a public link, anyone who has it can ask the agent to read or post in your workspace.
  • Ask for a draft before posting. Put it in the system prompt, as in the examples above.
  • Keep the token out of code and git. Use an environment variable or the dashboard.
  • If a token leaks, revoke it in your app's OAuth & Permissions page and reinstall the app to get a new one.

Troubleshooting​

When something goes wrong, the agent tells you what to fix. Common messages:

MessageWhat to do
The Slack bot token is invalidCopy the Bot User OAuth Token again. If you reinstalled the app, the token may have changed.
The Slack bot is not a member of this channelInvite the bot to the channel (step 3).
The Slack app is missing the <scope> scopeAdd the scope under OAuth & Permissions, then click Reinstall to Workspace.
Channel not foundCheck the spelling, or use the channel ID. The bot must be able to see the channel.
No channel given and no default channel is configuredName a channel in your message, or set a default channel ID (step 4).
Slack rate limit reachedWait the number of seconds shown and try again.
Slack is not connected for this custodianConnect Slack on this agent (step 5).
Private channels aren't listedAdd groups:read and groups:history, reinstall, and invite the bot to the private channel.

See also: Built-in tools · Custodians & Tools