Integrate
Integrations

Slack

Send messages, manage channels, and search conversations

The Slack integration provides access to Slack's API through the Integrate MCP server.

Installation

The Slack integration is included with the SDK:

import { slackIntegration } from "integrate-sdk/server";

Setup

1. Create a Slack App

  1. Go to Slack API Apps
  2. Create a new app
  3. Configure OAuth & Permissions
  4. Add Bot Token Scopes
  5. Note your Client ID and Client Secret

2. Configure the Integration on Your Server

Add the Slack integration to your server configuration. The integration automatically reads SLACK_CLIENT_ID and SLACK_CLIENT_SECRET from your environment variables:

import { createMCPServer, slackIntegration } from "integrate-sdk/server";

export const { client: serverClient } = createMCPServer({
  apiKey: process.env.INTEGRATE_API_KEY,
  integrations: [
    slackIntegration({
      scopes: [
        "chat:write",
        "channels:read",
        "users:read",
        "search:read",
        "files:write",
      ], // Optional
    }),
  ],
});

You can override the environment variables by passing explicit values:

slackIntegration({
  clientId: process.env.CUSTOM_SLACK_ID,
  clientSecret: process.env.CUSTOM_SLACK_SECRET,
  scopes: ["chat:write", "channels:read"],
});

3. Client-Side Usage

The default client automatically includes all integrations. You can use it directly:

import { client } from "integrate-sdk";

await client.authorize("slack");
const channels = await client.slack.listChannels({});

If you're using a custom client, add the integration to the integrations array:

import { createMCPClient, slackIntegration } from "integrate-sdk";

const customClient = createMCPClient({
  integrations: [slackIntegration()],
});

Configuration Options

Prop

Type

Available Tools

Messaging

  • slack_send_message - Send a message to a channel, supports threaded replies
  • slack_list_messages - Get message history from a channel
  • slack_get_thread_replies - Get all replies in a message thread
  • slack_update_message - Update the text of an existing message
  • slack_delete_message - Delete a message
  • slack_schedule_message - Schedule a message to be sent at a future time
  • slack_get_permalink - Get a permanent URL for a specific message
  • slack_search_messages - Search for messages across the workspace

Channels

  • slack_list_channels - List channels in the workspace
  • slack_get_channel - Get details about a specific channel
  • slack_create_channel - Create a new channel
  • slack_invite_to_channel - Invite one or more users to a channel
  • slack_list_channel_members - List all members of a channel
  • slack_set_channel_topic - Set the topic of a channel
  • slack_archive_channel - Archive a channel

Users

  • slack_list_users - List all users in the workspace
  • slack_get_user - Get detailed profile for a user
  • slack_lookup_user_by_email - Find a user by their email address

Reactions

  • slack_add_reaction - Add an emoji reaction to a message
  • slack_remove_reaction - Remove an emoji reaction from a message
  • slack_get_reactions - Get all reactions on a message

Files

  • slack_upload_file - Upload a text file to one or more channels

Pins

  • slack_pin_message - Pin a message in a channel
  • slack_unpin_message - Unpin a message in a channel
  • slack_list_pins - List all pinned items in a channel

Examples

Send a Message

const result = await client.slack.sendMessage({
  channel: "C1234567890",
  text: "Hello from Integrate SDK!",
  blocks: [
    {
      type: "section",
      text: {
        type: "mrkdwn",
        text: "*Hello!* This is a rich message.",
      },
    },
  ],
});

console.log("Message sent:", result);

List Channels

const result = await client.slack.listChannels({
  excludeArchived: true,
  types: "public_channel,private_channel",
});

console.log("Channels:", result);

Search Messages

const result = await client.slack.searchMessages({
  query: "important announcement",
  sort: "timestamp",
  sortDir: "desc",
});

console.log("Search results:", result);

Upload a File

const result = await client.slack.uploadFile({
  channels: "C1234567890",
  content: fileBuffer,
  filename: "report.pdf",
  title: "Monthly Report",
  initialComment: "Here's the monthly report",
});

console.log("File uploaded:", result);

OAuth Scopes

The following scopes are supported. Enable them on your Slack app based on the tools you need:

  • channels:read - View channels
  • channels:history - View messages in channels
  • channels:manage - Create channels, set topics, archive channels
  • chat:write - Send, update, and delete messages
  • users:read - View users
  • users:read.email - Look up users by email
  • search:read - Search messages and files
  • files:write - Upload files
  • reactions:read - View reactions on messages
  • reactions:write - Add and remove reactions
  • pins:read - View pinned items
  • pins:write - Pin and unpin messages

Error Handling

try {
  const result = await client.slack.sendMessage({
    channel: "C1234567890",
    text: "Hello!",
  });
} catch (error) {
  if (error.message.includes("channel_not_found")) {
    console.error("Channel not found");
  } else if (error.message.includes("not_in_channel")) {
    console.error("Bot not in channel");
  } else {
    console.error("Unexpected error:", error);
  }
}

Next Steps

On this page