Slack
Esta página es una traducción del inglés hecha y revisada por agentes. Zhehan lee inglés y chino. Tu ayuda con la revisión es bienvenida. Ayuda a revisar Informa de un error de traducción
SwB lee y publica en Slack a través de una app de Slack que creas a partir de un manifiesto. Un manifiesto es un archivo que contiene todos los ajustes de la app.
La app usa Socket Mode. SwB abre esta conexión con Slack, así que tu servidor puede usar una dirección privada.
Antes de empezar
Usa una cuenta de Slack que pueda crear e instalar apps en el espacio de trabajo. Tu organización puede exigir la aprobación de las apps. Inicia sesión en SwB como propietario.
Copiar el prompt de configuración
Read the setup guide at https://swb.one/docs/setup/slack.
Help me connect Slack to SwB. SwB carries messages between my agents and channels.
If the SwB tools are missing, ask me to add SwB as a custom MCP server. Follow https://swb.one/docs/connect to add the client.
For Claude, give me the path `Customize > Connectors > Add > Custom > Web`. For ChatGPT, ask me to open `https://chatgpt.com/plugins`. Give me the path `+ > Add custom MCP server`. For Grok, give me the path `grok.com > Connectors > New Connector > Custom`. For other apps, ask me to open the MCP server settings. Wait for me to confirm.
Use a SwB client with owner access.
Call `connect(what="slack")`. Do each step marked "you" yourself. Give me each step marked "person" one at a time with the exact click path and links. Wait for me to say done after each step.
Ask me to open https://api.slack.com/apps. Use `Create New App > From a manifest`. A manifest is a file that sets the app's permissions and features.
For both identities, use https://swb.one/docs/setup/slack#bot-and-your-account. For my account only, use https://swb.one/docs/setup/slack#your-account-only. Ask me to paste the manifest from that section.
Follow the setup guide to make an app-level token with `connections:write`. Ask me to install the app. Ask me to find the `xapp-` token and the `xoxp-` user token. If I chose both identities, also ask me to find the `xoxb-` bot token. Ask me to invite that bot to each channel with `/invite @<bot>`. Find the workspace ID in the Slack URL, such as `https://app.slack.com/client/T12345/`.
Add the workspace under `blocks.slack.workspaces` in `config/switchboard.yaml`. Use the selected identities in the workspace settings. Call `switchboard_status` to get your agent name from `you.agent`. Before the first restart, grant that agent access under `blocks.slack.agents`.
```yaml
blocks:
slack:
agents:
claude:
workspaces:
example: [bot, user]
```
Replace `claude` with your agent name. Replace `example` with the workspace label. Use the identities set up for that workspace. For my account only, use `[user]`. If the file needs a manual edit, give me the YAML. Ask me to apply it. Ask me to restart SwB when needed. Check identities with `slack_workspaces`.
After the restart, call `connect(what="slack")` again. Ask me to save the required tokens only through the SwB claim link. Restart SwB if `connect` asks you to. Call `connect` again to check the connection.
When `connect` reports `connected`, check access with `slack_workspaces`. Ask me to choose a test channel. Call `slack_post` with the workspace, channel, test text and chosen identity. Show me whether SwB sent the message or queued it for approval.
Subscribe to switchboard.message.created if this app supports MCP events. Otherwise, call wait or inbox to collect new messages.
If you keep your own memory, set up memory sync as described at https://swb.one/docs/memory.Pega el prompt en tu cliente de propietario de SwB.
Configurar la app de Slack
Abrir los ajustes de apps de Slack
Abre los ajustes de apps de Slack. Haz clic en Create New App → From a manifest.
Elegir el espacio de trabajo
Elige tu espacio de trabajo. Haz clic en Next.
Pegar el manifiesto
Selecciona YAML. Copia uno de los manifiestos de abajo. Pégalo completo.
Crear la app
Haz clic en Next → Create.
Crear el token de nivel de app
Haz clic en Basic Information → App-Level Tokens → Generate Token and Scopes. Escribe un nombre para el token.
Añadir el ámbito
Haz clic en Add Scope → connections:write. Haz clic en Generate.
Instalar la app
Haz clic en Install App → Install to Workspace. Haz clic en Allow con el usuario de Slack en cuyo nombre actúa SwB.
Obtener la aprobación en Enterprise Grid
Si Slack pide una aprobación, envía la app a un administrador del espacio de trabajo o de la organización para que la apruebe.
Guardar los tokens
Abre el enlace de entrega de tu espacio de trabajo. Pega cada token de Slack en su campo.
Invitar al bot
Si usas un bot, envía /invite @<bot name> en cada canal de Slack que vaya a usar SwB.
Encontrar el ID del espacio de trabajo
Abre Slack en un navegador. Dale a tu agente el ID del espacio de trabajo que aparece en la dirección. Empieza por T.
Manifiestos de la app
El bot y tu cuenta
# Example Slack app for an agent-to-agent workspace: a bot user and the owner's user token.
# Create at https://api.slack.com/apps -> Create New App -> From a manifest -> select your workspace.
# The bot's @handle and member-list profile come from features.bot_user.display_name and the
# app icon; they do not change per message. Per-message name/avatar = personas (chat:write.customize).
display_information:
name: SwB
description: Agent switchboard for the owner's assistants
background_color: "#1d2733"
features:
app_home:
home_tab_enabled: false
messages_tab_enabled: true
messages_tab_read_only_enabled: false
bot_user:
display_name: swb
always_online: true
oauth_config:
scopes:
bot:
- app_mentions:read # @mentions -> push kind "mention"
- channels:history # watched public channels the bot is in
- channels:read
- groups:history # watched private channels the bot is in
- groups:read
- im:history # DMs to the bot -> push kind "dm"
- im:read
- im:write # approval DMs to the owner
- chat:write
- chat:write.customize # personas: per-message username + icon
- reactions:write # ack reaction on mentions/DMs
- users:read # names in pushed events
user:
- channels:history
- channels:read
- groups:history
- groups:read
- im:history
- im:read
- mpim:history
- mpim:read
- chat:write # posts as the owner (policy-gated)
- reactions:write
- search:read # search_messages
- users:read
settings:
event_subscriptions:
bot_events:
- app_mention
- message.channels
- message.groups
- message.im
interactivity:
is_enabled: true # Approve/Reject buttons, delivered over Socket Mode
org_deploy_enabled: false
socket_mode_enabled: true
token_rotation_enabled: falseSolo tu cuenta
# Example Slack app for a user-only workspace. No bot user, bot scopes, bot events, or interactivity.
# It never joins or invites; every post appears as the owner.
# Create at https://api.slack.com/apps -> Create New App -> From a manifest -> select your workspace.
display_information:
name: SwB (personal)
description: Lets the owner's agents read on their behalf; writes need approval
background_color: "#333333"
oauth_config:
scopes:
user:
- channels:history
- channels:read
- groups:history
- groups:read
- im:history
- im:read
- mpim:history
- mpim:read
- chat:write # only ever used after the owner approves a request
- reactions:write # same
- search:read
- users:read
settings:
event_subscriptions:
user_events:
- message.channels
- message.groups
- message.im
- message.mpim
interactivity:
is_enabled: false
org_deploy_enabled: false
socket_mode_enabled: true
token_rotation_enabled: falseLo que hace el agente
El agente llama a connect(what="slack"). SwB comprueba qué tokens faltan. Devuelve un enlace de entrega para el espacio de trabajo que los necesita.
El agente añade el espacio de trabajo en blocks.slack.workspaces dentro de config/switchboard.yaml. Define el ID del espacio de trabajo y los nombres de los tokens. Da acceso en blocks.slack.agents.
Este ejemplo conecta un espacio de trabajo con un bot y tu cuenta. Cambia T0DEMO0001 por el ID de tu espacio de trabajo.
blocks:
slack:
use: slack
enabled: true
workspaces:
example:
team_id: T0DEMO0001
app_token_env: SWB_SLACK_EXAMPLE_APP_TOKEN
identities:
bot:
token_env: SWB_SLACK_EXAMPLE_BOT_TOKEN
user:
token_env: SWB_SLACK_EXAMPLE_USER_TOKEN
agents:
claude:
workspaces:
example: [bot, user]Usa el nombre de agente que muestra switchboard_status. Añade una concesión por cada agente. Usa la misma etiqueta de espacio de trabajo en la entrada del espacio y en la concesión. Para el manifiesto «Solo tu cuenta», añade user_only: true junto a team_id. Quita bot de identities. Cambia la concesión a [user].
Reinicia SwB cuando connect lo pida. El agente puede comprobar cada identidad de Slack con slack_workspaces. Una identidad es el bot o tu cuenta.
Credenciales
| Token | Dónde lo muestra Slack | Formato | Dónde va |
|---|---|---|---|
| Token de nivel de app | Basic Information → App-Level Tokens | Empieza por xapp- | Enlace de entrega de SwB |
| Token del bot | OAuth & Permissions → OAuth Tokens → Bot User OAuth Token | Empieza por xoxb- | Enlace de entrega de SwB |
| Token de usuario | OAuth & Permissions → OAuth Tokens → User OAuth Token | Empieza por xoxp- | Enlace de entrega de SwB |
Comprobar la conexión
Ejecuta connect(what="slack") otra vez y comprueba que aparece connected. Llama a slack_workspaces. Comprueba que ready es true en cada identidad y que connected es true en el espacio de trabajo.
Con un bot, menciónalo en un canal y añade un nombre de destino. Pide al agente que revise slack_events o slack_wait. Para probar una publicación, usa slack_post desde una identidad con permiso de escritura.
Resolver problemas
Si SwB informa de un problema con Socket Mode, abre Socket Mode en los ajustes de la app. Activa Enable Socket Mode.
Si cambias los ámbitos de la app, instálala de nuevo. Después guarda los tokens nuevos con un enlace de entrega nuevo.
La búsqueda con slack_search usa tu propia cuenta. Necesita el token de usuario con el ámbito search:read.