feat(slack): add Socket Mode support to Slack adapter#2613
Open
apparentsoft wants to merge 1 commit into
Open
Conversation
The Slack adapter now auto-detects Socket Mode when `SLACK_APP_TOKEN` is set, and falls back to webhook mode using `SLACK_SIGNING_SECRET` otherwise. This is purely additive — existing webhook installs keep working without changes. Why Socket Mode matters: - Removes the requirement for a publicly reachable webhook URL, which is the biggest install blocker for NanoClaw users running on a laptop, NAS, or home network. - No ngrok / Cloudflare Tunnel / reverse-proxy setup needed. - Slack opens the outbound WebSocket from the bot, not the other way around — works behind NAT. Implementation: - `src/channels/slack.ts` reads `SLACK_APP_TOKEN` in addition to the existing env keys. If present, constructs the adapter with `mode: 'socket'`; otherwise uses the existing webhook construction. - Bumps the `/add-slack` install pin from `@chat-adapter/slack@4.26.0` to `4.27.0` because `mode: 'socket'` is not present in 4.26's `SlackAdapterConfig` type. - `SKILL.md` documents both delivery modes with a comparison table and step-by-step setup for each. Socket Mode is presented as the recommended path for local installs. Tested locally against my own Slack workspace in Socket Mode for months on a Mac without a public endpoint.
This was referenced May 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Socket Mode support to the Slack channel adapter. Mode is auto-detected from env:
SLACK_APP_TOKENis set → Socket ModeSLACK_SIGNING_SECRETPurely additive. Existing webhook installs are byte-identical at runtime — no env change, no config change, same code path.
Motivation
Webhook mode requires a stable, publicly reachable URL for Slack to POST events. For installs on a laptop, home NAS, or anything behind NAT, that means setting up ngrok / Cloudflare Tunnel / a reverse-proxy. Socket Mode opens an outbound WebSocket from the bot to Slack and removes the public-URL requirement entirely.
What changed
src/channels/slack.ts— adds anenv.SLACK_APP_TOKEN ? socket : webhookbranch aroundcreateSlackAdapter. Everything else (resolveChannelName, concurrency, thread support, bridge wiring) is unchanged..claude/skills/add-slack/SKILL.md— adds a mode-comparison table at the top of the Credentials section and side-by-side step-by-step setup for each mode. Bumps the pinned install from@chat-adapter/slack@4.26.0→4.27.0becausemode: 'socket'is not present in 4.26'sSlackAdapterConfigtype (added in 4.27).Test plan for review
@chat-adapter/slack@4.27.0is acceptable as the new install pin (the current^4.24.0range allows it;mode: 'socket'is required for the new branch to typecheck).SLACK_APP_TOKENcontinue to construct the adapter via the unchangedsigningSecretpath.SLACK_BOT_TOKEN+SLACK_APP_TOKEN(no signing secret, no public URL), follow Socket Mode setup steps inSKILL.md, verify events delivered formessage.channels,message.im,app_mention.Compatibility
No breaking changes. No schema/DB changes. No host or container API surface changes. Single new optional env var.