mirror of
https://github.com/coleam00/Archon
synced 2026-04-21 13:37:41 +00:00
- Add SlackAdapter using @slack/bolt with Socket Mode (no HTTP endpoints needed) - Implement thread handling mirroring Discord pattern (channel:thread_ts conversation IDs) - Add Slack URL normalization to strip <url> formatting from messages - Add user whitelist authorization (SLACK_ALLOWED_USER_IDS) - Support @mention activation in channels and direct DMs - Add comprehensive setup guide and update README with Slack section
4.7 KiB
4.7 KiB
Slack Bot Setup Guide
This guide walks you through creating a Slack app with Socket Mode for the Remote Coding Agent.
Overview
The remote coding agent 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 .env file
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: Configure Environment Variables
Add to your .env file:
SLACK_BOT_TOKEN=xoxb-your-bot-token
SLACK_APP_TOKEN=xapp-your-app-token
# Optional: Restrict to specific users
SLACK_ALLOWED_USER_IDS=U1234ABCD,W5678EFGH
# Optional: Streaming mode (batch is default for Slack)
SLACK_STREAMING_MODE=batch
Step 7: Invite Bot to Channel
- Go to the Slack channel where you want to use the bot
- Type
/invite @agent-name(your bot's name) - The bot should now respond to @mentions in that channel
Usage
Clone a Repository (Main Channel)
@Remote Coding Agent /clone https://github.com/user/repo
Continue Work (Thread)
Reply in the thread created by the clone message:
@Remote Coding Agent /status
Start Parallel Work (Worktree)
@Remote Coding Agent /worktree feature-branch
Direct Messages
You can also DM the bot directly - no @mention needed:
/help
Troubleshooting
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 @Remote Coding Agent
"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)
Finding User IDs
To restrict access to specific users:
- In Slack, click on a user's profile
- Click the ... (More) button
- Click Copy member ID
- Add to
SLACK_ALLOWED_USER_IDS
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