Back to Eliza

Slack Plugin

packages/docs/plugin-registry/platform/slack.md

2.0.14.7 KB
Original Source

The Slack plugin connects Eliza agents to Slack workspaces as a bot app, handling messages in channels, DMs, and threads with support for slash commands and interactive components.

Package: @elizaos/plugin-slack

Installation

bash
eliza plugins install @elizaos/plugin-slack

Setup

1. Create a Slack App

  1. Go to api.slack.com/apps
  2. Click Create New App → From scratch
  3. Name the app and select your workspace

2. Configure Bot Permissions

Navigate to OAuth & Permissions → Scopes → Bot Token Scopes and add:

ScopePurpose
app_mentions:readReceive @mentions
channels:historyRead channel messages
channels:readList channels
chat:writePost messages
groups:historyRead private channel messages
im:historyRead DM history
im:readAccess DM info
im:writeSend DMs
mpim:historyRead group DM history
reactions:writeAdd reactions
users:readLook up user info

Navigate to Socket Mode and toggle it on. Generate an App-Level Token with the connections:write scope.

4. Enable Event Subscriptions

Navigate to Event Subscriptions and subscribe to bot events:

  • app_mention
  • message.channels
  • message.groups
  • message.im
  • message.mpim

5. Install to Workspace

Navigate to OAuth & Permissions and click Install to Workspace. Copy the Bot User OAuth Token (xoxb-...).

6. Configure Eliza

json
{
  "connectors": {
    "slack": {
      "botToken": "<SLACK_BOT_TOKEN>",
      "appToken": "<SLACK_APP_TOKEN>"
    }
  }
}

Configuration

FieldRequiredDescription
botTokenYesBot User OAuth Token (xoxb-...)
appTokenNoApp-Level Token for Socket Mode (xapp-...). Required for Socket Mode (default transport)
modeNoTransport mode: "socket" (default) or "http"
signingSecretNoSigning secret for HTTP mode webhook verification (required when mode is "http")
userTokenNoUser Token (xoxp-...) for user-scoped API calls
enabledNoSet false to disable (default: true)
groupPolicyNoGroup/channel join policy: "open", "disabled", or "allowlist" (default: "allowlist")

Features

  • Slash commands — Register and respond to /commands
  • @mentions — Responds when mentioned in channels
  • DMs — Full private conversation support
  • Threads — Participates in threaded replies
  • Reactions — Adds emoji reactions to messages
  • Socket Mode — Real-time event delivery without a public URL
  • Webhook mode — Production webhook endpoint support
  • Interactive components — Block Kit buttons and modals

Message Flow

Slack Event (via Socket Mode or webhook)
       ↓
Plugin validates event signature
       ↓
Determines response context:
  - app_mention → respond in channel thread
  - message.im → respond in DM
       ↓
AgentRuntime processes message
       ↓
Response posted to Slack channel/DM

Environment Variables

VariableRequiredDescription
SLACK_APP_TOKENYesApp-Level Token for Socket Mode (xapp-...)
SLACK_BOT_TOKENYesBot User OAuth Token (xoxb-...)
SLACK_USER_TOKENNoUser Token (xoxp-...) for user-scoped API calls
SLACK_CHANNEL_IDSNoComma-separated list of channel IDs to monitor
SLACK_SIGNING_SECRETNoSigning secret for HTTP mode webhook verification
SLACK_SHOULD_IGNORE_BOT_MESSAGESNoIgnore messages from other bots
SLACK_SHOULD_RESPOND_ONLY_TO_MENTIONSNoOnly respond when @mentioned

Auto-Enable

The plugin auto-enables when connectors.slack.botToken is set.

Thread Behavior

Thread history scope is configurable. By default, threads maintain isolated conversation history:

json
{
  "connectors": {
    "slack": {
      "botToken": "<SLACK_BOT_TOKEN>",
      "thread": {
        "historyScope": "thread"
      }
    }
  }
}

Set historyScope to "channel" to reuse channel conversation history in threads. Set inheritParent to true to include the parent channel transcript when starting a new thread session.