Package Information
Documentation
@mbakgun/n8n-nodes-slack-socket-mode
+
This is an n8n community node that lets you use Slack Socket Mode in your n8n workflows. It enables real-time event processing from Slack without requiring public URLs for webhooks.
Since the current integration of Slack in n8n only supports webhooks, this node allows you to use the Slack Socket Mode to listen to events in your Slack workspace in real-time, even in local development environments.
n8n is a fair-code licensed workflow automation platform.
Table of Contents
- Installation
- Slack App Setup
- Credentials
- Node Configuration
- Supported Events
- Usage Examples
- Example Workflow
- Compatibility
- Resources
- Version History
Installation
Follow the installation guide in the n8n community nodes documentation.
Using Bun (recommended):
bun add @mbakgun/n8n-nodes-slack-socket-mode
Using npm:
npm install @mbakgun/n8n-nodes-slack-socket-mode
After installation, restart n8n and the node will be available in the nodes panel.
Development Setup
This project uses Bun as its package manager. To set up your development environment:
Install Bun:
curl -fsSL https://bun.sh/install | bashInstall dependencies:
bun installBuild the project:
bun run build
Slack App Setup
Before using this node, you need to create a Slack app with Socket Mode enabled:
- Go to https://api.slack.com/apps and create a new app
- Navigate to "Socket Mode" in the left sidebar and enable it
- Generate an 'App-Level Token' with the
connections:writescope - Go to "OAuth & Permissions" and add the following Bot Token Scopes:
app_mentions:readchannels:historychannels:readchat:writereactions:readteam:read- (Add any other scopes required for your use case)
- Install the app to your workspace (This will generate a 'Bot User OAuth Token')
- Copy the Bot User OAuth Token, App-Level Token, and Signing Secret(from the 'Basic Information' section) for credential setup
- Go to 'Event Subscriptions' and enable 'Socket Mode'
- Subscribe to the events you want to listen to (e.g.
app_mention,message,reaction_removed,reaction_added)
Credentials
To use this node, you need to set up credentials with the following information:
- Bot Token: Your Slack Bot User OAuth Token (starts with
xoxb-) - App-Level Token: Your Slack App-Level Token for Socket Mode (starts with
xapp-) - Signing Secret: Your Slack App Signing Secret
These values can be found in your Slack App configuration.
Node Configuration
The Slack Socket Trigger node can be configured with the following options:
Trigger On: Select which Slack events should trigger your workflow:
- Bot / App Mention
- Button Interaction
- New Message Posted to Channel
- New Public Channel Created
- New User
- Reaction Added
- Reaction Removed
Regex Pattern: Optional regular expression to match against incoming Slack messages
Regex Flags: Flags for the regular expression (e.g.,
gfor global,ifor case-insensitive)
Supported Events
The node currently supports the following Slack events:
app_mention: When your bot is mentioned in a channelblock_actions: When a user interacts with buttons, including NPS-style ratingsmessage: When a message is posted to a channel the app is added tochannel_created: When a new public channel is createdteam_join: When a new user is added to Slackreaction_added: When a reaction is added to a messagereaction_removed: When a reaction is removed from a message
Usage Examples
Respond to mentions
Configure the node to trigger on app_mention events to make your workflow respond when someone mentions your bot.
Process messages matching a pattern
Use the Regex Pattern field to only trigger on messages that match a specific pattern:
- Pattern:
help|assist|support - Flags:
i
This will trigger the workflow only when messages containing "help", "assist", or "support" (case-insensitive) are posted.
Monitor channel creation
Set the trigger to channel_created to run workflows whenever a new channel is created in your workspace.
Example Workflow
Here's an example of a simple workflow that responds to Slack mentions:
[Slack Socket Trigger] → [JSON Parse] → [IF] → [HTTP Request] → [Slack]
- Slack Socket Trigger: Configured to trigger on app mentions
- JSON Parse: Extracts the message text and channel from the event data
- IF: Checks if the message contains certain keywords
- HTTP Request: Fetches relevant data based on the message
- Slack: Sends a response back to the channel
This workflow allows you to create a Slack bot that responds to mentions with data from external APIs, all without needing to expose your n8n instance to the internet.
Compatibility
- Requires n8n version 1.6.0 or later
- Tested against n8n versions 1.91.3
- Uses Bun as package manager for improved performance
Resources
- n8n community nodes documentation
- Slack API Documentation
- Slack Socket Mode Documentation
- Slack Events API Documentation
- Bun Documentation
Version History
- 1.0.0: Initial release - Project initialized with Socket Mode support for Slack events
- Support for app_mention, message, reaction events
- Added button interaction support