Back to Eliza

Slack Connector

packages/docs/connectors/slack.md

2.0.19.6 KB
Original Source

Slack Connector

Connect your agent to Slack workspaces using the @elizaos/plugin-slack package.

Prerequisites

  • A Slack app with a Bot Token (xoxb-...) and an App-Level Token (xapp-...) for Socket Mode
  • Alternatively, a Signing Secret for HTTP webhook mode

Configuration

NameRequiredDescription
SLACK_APP_TOKENYesSlack App Token (xapp-...) for Socket Mode connections
SLACK_BOT_TOKENYesSlack Bot Token (xoxb-...) for API authentication
SLACK_USER_TOKENNoOptional User Token (xoxp-...) for enhanced permissions
SLACK_SIGNING_SECRETNoSlack Signing Secret for verifying HTTP webhook requests
SLACK_CHANNEL_IDSNoComma-separated list of channel IDs to restrict the bot to
SLACK_SHOULD_IGNORE_BOT_MESSAGESNoIf true, ignore messages from other bots
SLACK_SHOULD_RESPOND_ONLY_TO_MENTIONSNoIf true, only respond when @mentioned

The connector auto-enables when botToken, token, or apiKey is truthy in the connector config and enabled is not explicitly false.

Configure in ~/.eliza/eliza.json:

json
{
  "connectors": {
    "slack": {
      "botToken": "xoxb-your-bot-token",
      "appToken": "xapp-your-app-level-token"
    }
  }
}

The default transport is Socket Mode, which requires both botToken and appToken. Providing only botToken is enough to trigger auto-enable, but Socket Mode will fail to connect without appToken. For HTTP webhook mode, appToken is not needed — set "mode": "http" and provide a signingSecret instead:

json
{
  "connectors": {
    "slack": {
      "botToken": "xoxb-your-bot-token",
      "signingSecret": "your-signing-secret",
      "mode": "http"
    }
  }
}

To disable:

json
{
  "connectors": {
    "slack": {
      "botToken": "xoxb-your-bot-token",
      "enabled": false
    }
  }
}

Setup

  1. Create a Slack app at api.slack.com/apps.
  2. Enable Socket Mode and generate an App-Level Token (xapp-...).
  3. Under OAuth & Permissions, add the required bot scopes and install to your workspace to get a Bot Token (xoxb-...).
  4. Add both tokens to connectors.slack in your config.
  5. Start your agent -- the Slack connector will auto-enable.

Features

Environment Variables

When the connector is loaded, the runtime pushes the following secrets from your config into process.env for the plugin to consume:

VariableRequiredDescription
SLACK_BOT_TOKENYesBot token (xoxb-...)
SLACK_APP_TOKENYesApp-level token (xapp-...) for Socket Mode
SLACK_USER_TOKENNoUser token (xoxp-...) for user-scoped actions
SLACK_SIGNING_SECRETNoSigning secret for HTTP mode request verification
SLACK_CHANNEL_IDSNoComma-separated list of channel IDs to restrict the bot to
SLACK_SHOULD_IGNORE_BOT_MESSAGESNoIgnore messages from other bots
SLACK_SHOULD_RESPOND_ONLY_TO_MENTIONSNoOnly respond when @mentioned

Transport Modes

Slack supports two transport modes:

Socket Mode (default)

Uses WebSocket via Slack's Socket Mode API. Requires an app-level token (xapp-...).

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

HTTP Mode

Receives events via HTTP webhooks. Requires a signing secret for request verification.

json
{
  "connectors": {
    "slack": {
      "mode": "http",
      "botToken": "<SLACK_BOT_TOKEN>",
      "signingSecret": "your-signing-secret",
      "webhookPath": "/slack/events"
    }
  }
}

When mode is "http", signingSecret is required (validated by the schema).

Full Configuration Reference

All fields under connectors.slack:

FieldTypeDefaultDescription
botTokenstringBot token (xoxb-...)
appTokenstringApp-level token (xapp-...) for Socket Mode
userTokenstringUser token (xoxp-...) for user-scoped API calls
userTokenReadOnlybooleantrueRestrict user token to read-only operations
mode"socket" | "http""socket"Transport mode
signingSecretstringSigning secret for HTTP mode (required when mode is "http")
webhookPathstring"/slack/events"HTTP webhook endpoint path
namestringAccount display name
enabledbooleanExplicitly enable/disable
capabilitiesstring[]Capability flags
allowBotsbooleanfalseAllow bot messages to trigger responses
requireMentionbooleanOnly respond when @mentioned
groupPolicy"open" | "disabled" | "allowlist""allowlist"Group/channel join policy
historyLimitinteger >= 0Max messages in conversation context
dmHistoryLimitinteger >= 0History limit for DMs
dmsRecord<string, {historyLimit?}>Per-DM history overrides
textChunkLimitinteger > 0Max characters per message chunk
chunkMode"length" | "newline"Long message splitting strategy
blockStreamingbooleanDisable streaming responses
blockStreamingCoalesceobjectCoalescing: minChars, maxChars, idleMs
mediaMaxMbnumber > 0Max media file size in MB
replyToMode"off" | "first" | "all"Reply threading mode
configWritesbooleantrueAllow config writes from Slack events
markdownobjectTable rendering: tables can be "off", "bullets", or "code"
commandsobjectnative and nativeSkills toggles

Reply-To Mode by Chat Type

Override replyToMode per chat type:

json
{
  "connectors": {
    "slack": {
      "replyToModeByChatType": {
        "direct": "all",
        "group": "first",
        "channel": "off"
      }
    }
  }
}

Actions

FieldTypeDescription
actions.reactionsbooleanAdd reactions
actions.messagesbooleanSend messages
actions.pinsbooleanPin messages
actions.searchbooleanSearch messages
actions.permissionsbooleanManage permissions
actions.memberInfobooleanView member info
actions.channelInfobooleanView channel info
actions.emojiListbooleanList available emoji

Reaction Notifications

FieldTypeDescription
reactionNotifications"off" | "own" | "all" | "allowlist"Which reactions trigger notifications
reactionAllowlist(string|number)[]Reaction names to notify on (when using "allowlist")

DM Policy

FieldTypeDefaultDescription
dm.enabledbooleanEnable/disable DMs
dm.policy"pairing" | "allowlist" | "open" | "disabled""pairing"DM access policy
dm.allowFrom(string|number)[]Allowed user IDs. Must include "*" for "open" policy
dm.groupEnabledbooleanEnable group DMs
dm.groupChannels(string|number)[]Allowed group DM channel IDs
dm.replyToMode"off" | "first" | "all"DM-specific reply threading

Thread Configuration

FieldTypeDescription
thread.historyScope"thread" | "channel""thread" isolates history per thread. "channel" reuses channel conversation history
thread.inheritParentbooleanWhether thread sessions inherit the parent channel transcript (default: false)

Slash Commands

json
{
  "connectors": {
    "slack": {
      "slashCommand": {
        "enabled": true,
        "name": "agent",
        "sessionPrefix": "slash",
        "ephemeral": true
      }
    }
  }
}
FieldTypeDescription
slashCommand.enabledbooleanEnable slash command handling
slashCommand.namestringSlash command name (e.g., /agent)
slashCommand.sessionPrefixstringSession ID prefix for slash command conversations
slashCommand.ephemeralbooleanSend responses as ephemeral (visible only to invoker)

Channel Configuration

Per-channel settings under channels.<channel-id>:

FieldTypeDescription
enabledbooleanEnable/disable this channel
allowbooleanAllow bot in this channel
requireMentionbooleanOnly respond when @mentioned
toolsToolPolicySchemaTool access policy
toolsBySenderRecord<string, ToolPolicySchema>Per-sender tool policies
allowBotsbooleanAllow bot messages in this channel
users(string|number)[]Allowed user IDs
skillsstring[]Allowed skills
systemPromptstringChannel-specific system prompt

Heartbeat

json
{
  "connectors": {
    "slack": {
      "heartbeat": {
        "showOk": true,
        "showAlerts": true,
        "useIndicator": true
      }
    }
  }
}

Multi-Account Support

json
{
  "connectors": {
    "slack": {
      "accounts": {
        "workspace-1": { "botToken": "<SLACK_BOT_TOKEN>", "appToken": "<SLACK_APP_TOKEN>" },
        "workspace-2": { "botToken": "<SLACK_BOT_TOKEN>", "appToken": "<SLACK_APP_TOKEN>" }
      }
    }
  }
}