Skip to main content

Installation

Environment Variables

Get these credentials from your Slack app dashboard.

Configuration Options

Setup

For internal bots serving one workspace:

OAuth Flow (Multi-Workspace)

For multi-workspace apps, handle the OAuth callback:
The adapter automatically:
  1. Exchanges the authorization code for an access token
  2. Stores the installation via StateAdapter.set()
  3. Encrypts the token if encryptionKey is provided

Webhook Handler

Features

Supported Events

  • message - Regular messages in channels/DMs
  • app_mention - Bot mentions (@bot-name)
  • reaction_added / reaction_removed - Emoji reactions
  • assistant_thread_started - Slack AI Assistant thread created
  • app_home_opened - User opens bot’s Home tab
  • member_joined_channel - User/bot joins a channel

Slash Commands

Interactive Components

Button clicks are automatically routed to chat.onAction():

Modals

Modals are not yet fully implemented in the SDK. Use publishHomeView() for Home tab views.

Home Tab

Publish a custom Home tab view:

Slack Assistant API

For Slack AI features:

Thread IDs

Slack thread IDs encode channel and message timestamp:
Examples:
  • Channel message: slack:C1234567890:1234567890.123456
  • DM (top-level): slack:D9876543210: (empty threadTs for DM roots)
  • DM reply: slack:D9876543210:1234567890.123456

Platform Limits

  • Message length: 40,000 characters (Block Kit) or 4,000 characters (plain text)
  • Blocks per message: 50 blocks
  • Rate limits: Tier-based (1+ requests/second for most methods)
  • File size: 1 GB per file
See Slack rate limits for details.

Code Examples

Troubleshooting

  • Ensure SLACK_SIGNING_SECRET matches your app configuration
  • Check that the request body is raw (not parsed JSON)
  • Verify timestamp is within 5 minutes (check server clock)
  • Add bot to the channel (/invite @bot-name)
  • Verify bot has chat:write scope
  • Check webhook URL is publicly accessible
  • Enable message.channels event subscription
  • Use a persistent StateAdapter (Redis, not Memory)
  • Ensure OAuth redirect URL is whitelisted in app settings
  • Check that installations are being saved (debug logs)

Required Scopes

Add these OAuth scopes to your Slack app: Bot Token Scopes:
  • chat:write - Post messages
  • reactions:write - Add reactions
  • channels:history - Read channel messages
  • groups:history - Read private channel messages
  • im:history - Read DM messages
  • mpim:history - Read group DM messages
  • users:read - Look up user info
Event Subscriptions:
  • message.channels
  • message.groups
  • message.im
  • message.mpim
  • app_mention
  • reaction_added
  • reaction_removed
See Slack permissions for full scope list.

Next Steps

Message Handling

Process messages and build conversation flows

Block Kit Cards

Create interactive UIs with buttons and forms

Multi-Workspace Apps

Build apps for public distribution

State Management

Persist data across requests