Files
vercel__chat/packages/adapter-slack
2026-01-02 14:33:31 -08:00
..
2026-01-02 13:56:55 -08:00
2026-01-02 14:20:41 -08:00
2025-12-31 13:14:26 -08:00
2025-12-21 20:48:14 -08:00
2025-12-21 20:48:14 -08:00
2025-12-21 20:48:14 -08:00

@chat-adapter/slack

Slack adapter for the chat SDK.

Installation

npm install chat @chat-adapter/slack

Usage

import { Chat } from "chat";
import { createSlackAdapter } from "@chat-adapter/slack";

const chat = new Chat({
  userName: "mybot",
  adapters: {
    slack: createSlackAdapter({
      botToken: process.env.SLACK_BOT_TOKEN!,
      signingSecret: process.env.SLACK_SIGNING_SECRET!,
    }),
  },
});

// Handle @mentions
chat.onNewMention(async (thread, message) => {
  await thread.post("Hello from Slack!");
});

Configuration

Option Required Description
botToken Yes Slack bot token (starts with xoxb-)
signingSecret Yes Slack signing secret for webhook verification

Required Slack Scopes

Your Slack app needs these OAuth scopes:

Bot Token Scopes:

  • chat:write - Send messages
  • channels:history - Read channel messages
  • groups:history - Read private channel messages
  • im:history - Read DM messages
  • mpim:history - Read group DM messages
  • reactions:read - Read reactions
  • reactions:write - Add reactions
  • files:read - Read file attachments
  • users:read - Read user info

Event Subscriptions:

  • message.channels - Channel messages
  • message.groups - Private channel messages
  • message.im - Direct messages
  • message.mpim - Group DMs
  • app_mention - @mentions
  • reaction_added - Reaction events
  • reaction_removed - Reaction events

Features

  • Message posting and editing
  • Thread subscriptions
  • Reaction handling (add/remove/events)
  • File attachments
  • Rich cards (Block Kit)
  • Action callbacks (interactive components)
  • Direct messages

License

MIT