Slack Connector¶
This document covers the Slack connector under src/node_wire_slack in two parts:
- Slack Bot Setup — Create a Slack app, configure OAuth scopes, and obtain your bot token.
- REST API Reference — Connector actions, request/response shapes, and flexible channel resolution.
For MCP (e.g. ToolHive), tools are named slack.<action> from the connector manifest (e.g. slack.post_message).
Slack Bot Setup¶
The Slack connector uses a Bot User OAuth Token to interact with your workspace.
Prerequisites¶
- A Slack workspace where you have permission to install apps.
- Slack API Dashboard access.
Step 1: Create a Slack App¶
- Go to api.slack.com/apps and click Create New App.
- Select From scratch.
- Give your app a name (e.g.,
Node-Wire Connector) and select your workspace. - Click Create App.
Step 2: Configure Scopes¶
- In the left sidebar, go to OAuth & Permissions.
- Scroll down to Scopes > Bot Token Scopes.
- Add the following scopes:
chat:write— Send messages to channels and DMs.files:write— Upload and share files.im:write— Start direct messages with users.groups:read(optional) — If you need to post to private channels the bot is invited to.channels:read(optional) — If you need to resolve channel names.
Step 3: Install and Get Token¶
- Scroll back up to the top of the OAuth & Permissions page.
- Click Install to Workspace.
- Click Allow to authorize the bot.
- Copy the Bot User OAuth Token (it starts with
xoxb-).
Step 4: Configure the Connector¶
Add the token to your .env file:
Step 5: Invite the Bot (Important)¶
Slack bots cannot "see" private channels unless they are explicitly invited.
- Go to the Slack channel you want the bot to use.
- Type
/invite @YourAppNameand press Enter.
REST API Reference¶
The connector exposes actions as standard REST endpoints. Channel identifiers are flexible and automatically resolved.
Operations overview¶
- Connector ID:
slack - Base REST path:
POST /connectors/slack/{action}
Actions¶
post_message¶
Send a message to a channel, group, or user.
Request body:
{
"channel": "#general",
"message": "Clinical alert: Patient summary available.",
"blocks": [
{
"type": "section",
"text": { "type": "mrkdwn", "text": "*Emergency Update*: BP 180/110" }
}
]
}
Channel Resolution:
- Channel Name: Starts with # (e.g., #general).
- Channel ID: Starts with C or G (e.g., C12345).
- User ID: Starts with U or W (e.g., U12345). Automatically resolved to a DM channel.
send_direct_message¶
A specialized action for DMs. If targeted at a User ID, the connector ensures the DM channel is open before posting.
Request body:
upload_file¶
Uploads a file to a Slack channel or DM.
Request body (Base64):
{
"channel": "C12345678",
"filename": "labs.pdf",
"content_base64": "JVBER...",
"initial_comment": "Here is the PDF summary."
}
Request body (Filesystem):
Note:
filepathmust be within the directory defined byNW_SLACK_ATTACHMENTS_DIR(default/slack_attachments).
Error Taxonomy¶
| Category | Platform Code | Cause |
|---|---|---|
AUTH |
SLACK_AUTH_ERROR |
Invalid or revoked token |
AUTH |
SLACK_PERMISSION_ERROR |
Missing OAuth scope |
RETRYABLE |
SLACK_RATE_LIMIT |
Slack rate limit (429) |
BUSINESS |
SLACK_MESSAGE_ERROR |
Channel not found or invalid payload |
BUSINESS |
SLACK_UPLOAD_ERROR |
File too large or bad content |
Related¶
- Individual MCP Servers: docs/mcp-servers.md
- Connector Architecture: docs/connectors.md