|
1 | 1 | --- |
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)" |
3 | 3 | read_when: |
4 | | - - Setting up Slack or debugging Slack socket/HTTP mode |
| 4 | + - Setting up Slack or debugging Slack socket, HTTP, or relay mode |
5 | 5 | title: "Slack" |
6 | 6 | --- |
7 | 7 |
|
8 | | -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. |
9 | 9 |
|
10 | 10 | <CardGroup cols={3}> |
11 | 11 | <Card title="Pairing" icon="link" href="/channels/pairing"> |
@@ -41,6 +41,37 @@ Both transports are production-ready and reach feature parity for messaging, sla |
41 | 41 | **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. |
42 | 42 | </Note> |
43 | 43 |
|
| 44 | +### 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 | + |
44 | 75 | ## Install |
45 | 76 |
|
46 | 77 | Install Slack before configuring the channel: |
@@ -863,7 +894,8 @@ The default manifest enables the Slack App Home **Home** tab and subscribes to ` |
863 | 894 |
|
864 | 895 | - `botToken` + `appToken` are required for Socket Mode. |
865 | 896 | - 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 |
867 | 899 | strings or SecretRef objects. |
868 | 900 | - Config tokens override env fallback. |
869 | 901 | - `SLACK_BOT_TOKEN` / `SLACK_APP_TOKEN` env fallback applies only to the default account. |
|
0 commit comments