MCP
messaging

Slack

Post messages, read channels, and manage conversations in a Slack workspace.

Requires Growth plan or above.

Connect Slack

Create a Slack app at api.slack.com/apps, add Bot Token Scopes, install to your workspace, and paste the Bot User OAuth Token (xoxb-...) on the Slack card at /dashboard/connections.

Example

Post a message to the #general channel from a server route.

app/api/notify/route.ts
export async function POST() {
const res = await fetch('https://leash.build/api/integrations/slack/slack_post_message', {
method: 'POST',
headers: {
'x-api-key': process.env.LEASH_API_KEY!,
'content-type': 'application/json',
},
body: JSON.stringify({
channel: 'general',
text: 'Hello from Leash',
}),
})
const { data } = await res.json()
// data =>
// {
// ok: true,
// channel: 'C0123456789',
// ts: '1715711600.123456',
// message: { user: 'U042...', text: 'Hello from Leash', ... }
// }
return Response.json(data)
}

Available tools

  • slack_post_message — post to a channel.
  • slack_reply_to_thread — reply in a thread.
  • slack_add_reaction — add an emoji reaction.
  • slack_get_channel_history — recent messages in a channel.
  • slack_get_thread_replies — all replies in a thread.
  • slack_list_channels — channels in the workspace.
  • slack_get_users — workspace user directory.
  • slack_get_user_profile — single user's profile.

Common gotchas

  • The bot must be in the channel. Either invite it (/invite @yourbot) or use the channel ID instead of the name.
  • Scopes are per-action. Posting needs chat:write; channel history needs channels:history. Re-install after adding scopes.
  • Slack rate limits are tier-based. Posting is Tier 1 (~1 msg/sec/channel); back off on 429.

See the Slack Web API reference for the underlying provider docs.

Other languages: see SDK overview.