Slack
The Slack integration runs over Socket Mode, which means it works from behind your firewall with no public URL. Z.E.N. opens a WebSocket out to Slack and Slack delivers events down that pipe.
What you can do with it: dispatch workflows by mentioning the bot in a channel, pull message history into a workflow node, post a workflow's output back to a channel or DM. The morning-brief and meeting-capture patterns both lean on Slack heavily.
Prerequisites
- Z.E.N. server running (see Getting Started)
- A Slack workspace where you have permission to install apps
Overview
Z.E.N. uses Socket Mode for Slack integration, which means:
- No public HTTP endpoints needed
- Works behind firewalls
- Simpler local development
- Not suitable for Slack App Directory (fine for personal/team use)
Step 1: Create a Slack App
- Go to Slack API Apps
- Log in if prompted
- Choose the workspace for your app
- Click Create New App
- Choose From scratch
- Enter:
- App Name: Any name (this is what you will use to @mention the bot)
- Workspace: Select your workspace
- Click Create App
Step 2: Enable Socket Mode
- In the left sidebar, click Socket Mode
- Toggle Enable Socket Mode to ON
- When prompted, create an App-Level Token:
- Token Name:
socket-mode - Scopes: Add
connections:write - Click Generate
- Token Name:
- Copy the token (starts with
xapp-); this is yourSLACK_APP_TOKEN - Copy the token and put it in your
.envfile
Step 3: Configure Bot Scopes
- In the left sidebar, click OAuth & Permissions
- Scroll down to Scopes > Bot Token Scopes
- Add these scopes to bot token scopes:
app_mentions:read; Receive @mention eventschat:write; Send messageschannels:history; Read messages in public channels (for thread context)channels:join; Allow bot to join public channelsgroups:history; Read messages in private channels (optional)im:history; Read DM history (for DM support)im:write; Send DMsim:read; Read DM history (for DM support)mpim:history; Read group DM history (optional)mpim:write; Send group DMs
Step 4: Subscribe to Events
- In the left sidebar, click Event Subscriptions
- Toggle Enable Events to ON
- Under Subscribe to bot events, add:
app_mention; When someone @mentions your botmessage.im; Direct messages to your botmessage.channels; Messages in public channels (optional, for broader context)message.groups; Messages in private channels (optional)
- Click Save Changes
Step 5: Install to Workspace
- In the left sidebar, click Install App
- Click Install to Workspace
- Review the permissions and click Allow
- Copy the Bot User OAuth Token (starts with
xoxb-); this is yourSLACK_BOT_TOKEN - Set the bot token in your
.envfile
Step 6: Set Environment Variables
Add to your .env file:
SLACK_BOT_TOKEN=xoxb-your-bot-token
SLACK_APP_TOKEN=xapp-your-app-tokenStep 7: Invite Bot to Channel
- Go to the Slack channel where you want to use the bot
- Type
/invite @your-bot(your bot's display name) - The bot should now respond to @mentions in that channel
Configure User Whitelist (Optional)
To restrict bot access to specific users:
- In Slack, go to a user's profile > click "..." > "Copy member ID"
- Add to environment:
SLACK_ALLOWED_USER_IDS=U01ABC123,U02DEF456When set, only listed user IDs can interact with the bot. When empty/unset, the bot responds to all users.
Configure Streaming Mode (Optional)
SLACK_STREAMING_MODE=batch # batch (default) | streamFor streaming mode details, see Configuration.
Usage
@Mention in Channels
@your-bot /clone https://github.com/user/repoContinue Work in Thread
Reply in the thread created by the initial message:
@your-bot /statusStart Parallel Work (Worktree)
@your-bot /worktree feature-branchDirect Messages
You can also DM the bot directly; no @mention needed:
/helpTroubleshooting
Bot Doesn't Respond
- Check that Socket Mode is enabled
- Verify both tokens are correct in
.env - Check the app logs for errors
- Ensure the bot is invited to the channel
- Make sure you're @mentioning the bot (not just typing)
"channel_not_found" Error
The bot needs to be invited to the channel:
/invite @your-bot"missing_scope" Error
Add the required scope in OAuth & Permissions and reinstall the app.
Thread Context Not Working
Ensure these scopes are added:
channels:history(public channels)groups:history(private channels)
Security Recommendations
- Use User Whitelist: Set
SLACK_ALLOWED_USER_IDSto restrict bot access - Private Channels: Invite the bot only to channels where it's needed
- Token Security: Never commit tokens to version control