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
Messages
slack_send_message- Send a message to a channel or userslack_list_messages- List messages in a channelslack_add_reaction- Add emoji reaction to a messageslack_search_messages- Search messages
Channels
slack_list_channels- List channelsslack_get_channel- Get channel details
Users
slack_list_users- List workspace usersslack_get_user- Get user details
Files
slack_upload_file- Upload a file
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 default scopes are ['chat:write', 'channels:read', 'users:read', 'search:read', 'files:write']. You may need different scopes:
chat:write- Send messageschat:write.public- Send messages to any public channelchannels:read- View channelschannels:history- View messages in channelsusers:read- View userssearch:read- Search messages and filesfiles:write- Upload filesreactions:write- Add reactions
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