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
- Go to Slack API Apps
- Create a new app
- Configure OAuth & Permissions
- Add Bot Token Scopes
- 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 repliesslack_list_messages- Get message history from a channelslack_get_thread_replies- Get all replies in a message threadslack_update_message- Update the text of an existing messageslack_delete_message- Delete a messageslack_schedule_message- Schedule a message to be sent at a future timeslack_get_permalink- Get a permanent URL for a specific messageslack_search_messages- Search for messages across the workspace
Channels
slack_list_channels- List channels in the workspaceslack_get_channel- Get details about a specific channelslack_create_channel- Create a new channelslack_invite_to_channel- Invite one or more users to a channelslack_list_channel_members- List all members of a channelslack_set_channel_topic- Set the topic of a channelslack_archive_channel- Archive a channel
Users
slack_list_users- List all users in the workspaceslack_get_user- Get detailed profile for a userslack_lookup_user_by_email- Find a user by their email address
Reactions
slack_add_reaction- Add an emoji reaction to a messageslack_remove_reaction- Remove an emoji reaction from a messageslack_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 channelslack_unpin_message- Unpin a message in a channelslack_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 channelschannels:history- View messages in channelschannels:manage- Create channels, set topics, archive channelschat:write- Send, update, and delete messagesusers:read- View usersusers:read.email- Look up users by emailsearch:read- Search messages and filesfiles:write- Upload filesreactions:read- View reactions on messagesreactions:write- Add and remove reactionspins:read- View pinned itemspins: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
- Explore the WhatsApp Integration
- Explore the Intercom Integration
- See Advanced Usage for more examples