docs/guides/slack-ai-agent.md
This guide connects nanobot to Slack through Socket Mode. No public webhook URL is required for the first working setup.
slack channel enabled in nanobotnanobot agent -m "Hello!"
python -m pip install nanobot-ai
nanobot onboard --wizard
Install the optional channel dependency:
nanobot plugins enable slack
In Slack, create an app, enable Socket Mode, create an app-level token with
connections:write, add bot scopes, subscribe to bot events, and install the
app to your workspace.
Merge this snippet into ~/.nanobot/config.json:
{
"channels": {
"slack": {
"enabled": true,
"botToken": "xoxb-...",
"appToken": "xapp-...",
"groupPolicy": "mention",
"dm": {
"policy": "allowlist"
}
}
}
}
Slack DMs are open by default. Setting dm.policy to "allowlist" with no
dm.allowFrom entries makes new DM senders receive a pairing code. Approve the
code before using the bot normally.
nanobot channels status
nanobot gateway
DM the Slack bot directly. It should return a pairing code. Approve it from a trusted local surface:
nanobot agent -m "/pairing approve ABCD-EFGH"
Then DM the bot again, or mention it in a channel:
@nanobot Hello from Slack
groupPolicy as mention unless the bot is intentionally listening to
every channel message.dm.policy as "allowlist" when you want pairing-based approval.groupAllowFrom with allowlist mode for approved channels.xapp-.files:write, reinstall the app, and
restart nanobot.dm.policy is
"allowlist".