

























11---
2-summary: "Slack setup and runtime behavior (Socket Mode + HTTP Request URLs)"
2+summary: "Slack setup and runtime behavior (Socket Mode, HTTP Request URLs, and relay mode)"
33read_when:
4- - Setting up Slack or debugging Slack socket/HTTP mode
4+ - Setting up Slack or debugging Slack socket, HTTP, or relay mode
55title: "Slack"
66---
778-Production-ready for DMs and channels via Slack app integrations. Default mode is Socket Mode; HTTP Request URLs are also supported.
8+Production-ready for DMs and channels via Slack app integrations. Default mode is Socket Mode; HTTP Request URLs are also supported. Relay mode is intended for managed deployments where a trusted router owns Slack ingress.
991010<CardGroup cols={3}>
1111 <Card title="Pairing" icon="link" href="/channels/pairing">
@@ -41,6 +41,37 @@ Both transports are production-ready and reach feature parity for messaging, sla
4141**Pick HTTP Request URLs** when running multiple Gateway replicas behind a load balancer, when outbound WSS is blocked but inbound HTTPS is allowed, or when you already terminate Slack webhooks at a reverse proxy.
4242</Note>
434344+### Relay mode
45+46+Relay mode separates Slack ingress from the OpenClaw gateway. A trusted router owns the
47+single Slack Socket Mode connection, chooses a destination gateway, and forwards a typed
48+event over an authenticated websocket. The gateway continues to use its bot token for
49+outbound Slack Web API calls.
50+51+```json5
52+{
53+ channels: {
54+ slack: {
55+ mode: "relay",
56+ botToken: { source: "env", provider: "default", id: "SLACK_BOT_TOKEN" },
57+ relay: {
58+ url: "wss://router.example.com/gateway/ws",
59+ authToken: { source: "env", provider: "default", id: "SLACK_RELAY_AUTH_TOKEN" },
60+ gatewayId: "team-gateway",
61+ },
62+ },
63+ },
64+}
65+```
66+67+The relay URL must use `wss://` unless it targets localhost. Treat the bearer token and
68+router route table as part of the Slack authorization boundary: routed events enter the
69+normal Slack message handler as authorized activations. A router-provided `slack_identity`
70+in the websocket `hello` frame can set the default outbound username and icon; an explicit
71+identity supplied by the caller still wins. The relay connection reconnects with the same
72+bounded backoff timing used by Socket Mode and clears the router-provided identity whenever
73+it disconnects.
74+4475## Install
45764677Install Slack before configuring the channel:
@@ -863,7 +894,8 @@ The default manifest enables the Slack App Home **Home** tab and subscribes to `
863894864895- `botToken` + `appToken` are required for Socket Mode.
865896- HTTP mode requires `botToken` + `signingSecret`.
866-- `botToken`, `appToken`, `signingSecret`, and `userToken` accept plaintext
897+- Relay mode requires `botToken` plus `relay.url`, `relay.authToken`, and `relay.gatewayId`; it does not use an app token or signing secret.
898+- `botToken`, `appToken`, `signingSecret`, `relay.authToken`, and `userToken` accept plaintext
867899 strings or SecretRef objects.
868900- Config tokens override env fallback.
869901- `SLACK_BOT_TOKEN` / `SLACK_APP_TOKEN` env fallback applies only to the default account.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。