Description
@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:
1. Install Bun:
curl -fsSL https://bun.sh/install | bash
2. Install dependencies:
bun install
3. Build the project:
bun run build
Slack App Setup
Before using this node, you need to create a Slack app with Socket Mode enabled:
1. Go to https://api.slack.com/apps and create a new app
2. Navigate to “Socket Mode” in the left sidebar and enable it
3. Generate an ‘App-Level Token’ with the connections:write scope
4. Go to “OAuth & Permissions” and add the following Bot Token Scopes:
– app_mentions:read
– channels:history
– channels:read
– chat:write
– commands
– reactions:read
– team:read
– (Add any other scopes required for your use case)
5. Install the app to your workspace (This will generate a ‘Bot User OAuth Token’)
6. Copy the Bot User OAuth Token, App-Level Token, and Signing Secret(from the ‘Basic Information’ section) for credential setup
7. Go to ‘Event Subscriptions’ and enable ‘Socket Mode’
8. Subscribe to the events you want to listen to (e.g. appmention, message, reactionremoved, reaction_added)
Credentials
To use this node, you need to set up credentials with the following information:
xoxb-)xapp-)These values can be found in your Slack App configuration.
Node Configuration
The Slack Socket Trigger node can be configured with the following options:
– All Slack events are now supported (app_mention, message, reaction events, channel events, etc.)
– See the Supported Events section below for a complete list of available events
– Example: (?=.botmessage)(?=.#FF0000) matches events that contain both botmessage and the color #FF0000
– Example: help|assist|support matches events containing any of these words anywhere in the event data
g for global, i for case-insensitive)deploy, status, help). Leave empty to listen for all slash commands. Do not include the leading slash.C1234567890, G1234567890)This node supports using an HTTP or HTTPS proxy by reading the following environment variables:
export HTTP_PROXY=http://proxy.example.com:3128
or
export HTTPS_PROXY=http://proxy.example.com:3128
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 messageapp_deleted: User has deleted an appapphomeopened: User clicked into your App Homeapp_installed: User has installed an appapp_mention: Subscribe to only the message events that mention your app or botappratelimited: Indicates your app’s event subscriptions are being rate limitedapp_requested: User requested an appapp_uninstalled: Your Slack app was uninstalledappuninstalledteam: User has uninstalled an appassistantthreadcontext_changed: The context changed while an AI assistant thread was visibleassistantthreadstarted: An AI assistant thread was startedbot_added: A bot user was addedbot_changed: A bot user was changedcall_rejected: A Call was rejectedchannel_archive: A channel was archivedchannel_created: A channel was createdchannel_deleted: A channel was deletedchannelhistorychanged: Bulk updates were made to a channel’s historychannelidchanged: A channel ID changedchannel_joined: You joined a channelchannel_left: You left a channelchannel_marked: Your channel read marker was updatedchannel_rename: A channel was renamedchannel_shared: A channel has been shared with an external workspacechannel_unarchive: A channel was unarchivedchannel_unshared: A channel has been unshared with an external workspacecommands_changed: A slash command has been added or changeddnd_updated: Do not Disturb settings changed for the current userdndupdateduser: Do not Disturb settings changed for a memberemaildomainchanged: The workspace email domain has changedemoji_changed: A custom emoji has been added or changedexternalorgmigration_finished: An enterprise grid migration has finished on an external workspaceexternalorgmigration_started: An enterprise grid migration has started on an external workspacefile_change: A file was changedfilecommentadded: A file comment was addedfilecommentdeleted: A file comment was deletedfilecommentedited: A file comment was editedfile_created: A file was createdfile_deleted: A file was deletedfile_public: A file was made publicfile_shared: A file was sharedfile_unshared: A file was unsharedfunction_executed: Your app function is executed as a step in a workflowgoodbye: The server intends to close the connection soongridmigrationfinished: An enterprise grid migration has finished on this workspacegridmigrationstarted: An enterprise grid migration has started on this workspacegroup_archive: A private channel was archivedgroup_close: You closed a private channelgroup_deleted: A private channel was deletedgrouphistorychanged: Bulk updates were made to a private channel’s historygroup_joined: You joined a private channelgroup_left: You left a private channelgroup_marked: A private channel read marker was updatedgroup_open: You created a group DMgroup_rename: A private channel was renamedgroup_unarchive: A private channel was unarchivedhello: The client has successfully connected to the serverim_close: You closed a DMim_created: A DM was createdimhistorychanged: Bulk updates were made to a DM’s historyim_marked: A direct message read marker was updatedim_open: You opened a DMinvite_requested: User requested an invitelink_shared: A message was posted containing one or more links relevant to your applicationmanualpresencechange: You manually updated your presencememberjoinedchannel: A user joined a public channel, private channel or MPDMmemberleftchannel: A user left a public or private channelmessage: A message was sent to a channelmessage.app_home: A user sent a message to your Slack appmessage.channels: A message was posted to a channelmessage.groups: A message was posted to a private channelmessage.im: A message was posted in a direct message channelmessage.mpim: A message was posted in a multiparty direct message channelmessagemetadatadeleted: Message metadata was deletedmessagemetadataposted: Message metadata was postedmessagemetadataupdated: Message metadata was updatedpin_added: A pin was added to a channelpin_removed: A pin was removed from a channelpref_change: You have updated your preferencespresence_change: A member’s presence changedpresence_query: Determine the current presence status for a list of userspresence_sub: Subscribe to presence events for the specified usersreaction_added: A member has added an emoji reaction to an itemreaction_removed: A member removed an emoji reactionreconnect_url: Experimentalresources_added: Access to a set of resources was granted for your appresources_removed: Access to a set of resources was removed for your appscope_denied: OAuth scopes were denied to your appscope_granted: OAuth scopes were granted to your appsharedchannelinvite_accepted: A shared channel invite was acceptedsharedchannelinvite_approved: A shared channel invite was approvedsharedchannelinvite_declined: A shared channel invite was declinedsharedchannelinvite_received: A shared channel invite was sent to a Slack usersharedchannelinvite_requested: A shared channel invite was requestedstar_added: A member has saved an item for later or starred an itemstar_removed: A member has removed an item saved for later or starred an itemsubteam_created: A User Group has been added to the workspacesubteammemberschanged: The membership of an existing User Group has changedsubteamselfadded: You have been added to a User Groupsubteamselfremoved: You have been removed from a User Groupsubteam_updated: An existing User Group has been updated or its members changedteamaccessgranted: Access to a set of teams was granted to your org appteamaccessrevoked: Access to a set of teams was revoked from your org appteamdomainchange: The workspace domain has changedteam_join: A new member has joinedteammigrationstarted: The workspace is being migrated between serversteamplanchange: The account billing plan has changedteamprefchange: A preference has been updatedteamprofilechange: The workspace profile fields have been updatedteamprofiledelete: The workspace profile fields have been deletedteamprofilereorder: The workspace profile fields have been reorderedteam_rename: The workspace name has changedtokens_revoked: API tokens for your app were revokedurl_verification: Verifies ownership of an Events API Request URLuser_change: A member’s data has changeduserresourcedenied: User resource was denied to your appuserresourcegranted: User resource was granted to your appuserresourceremoved: User resource was removed from your appuser_typing: A channel member is typing a messageview_submission: When a modal view is submitted view_closed: When a modal view is closedworkflow_deleted: A workflow that contains a step supported by your app was deletedworkflow_published: A workflow that contains a step supported by your app was publishedworkflowstepdeleted: A workflow step supported by your app was removed from a workflowworkflowstepexecute: A workflow step supported by your app should executeworkflow_unpublished: A workflow that contains a step supported by your app was unpublishedslash_command: When a user invokes a slash commandUsage 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:
help|assist|supportiThis 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]
1. Slack Socket Trigger: Configured to trigger on app mentions
2. JSON Parse: Extracts the message text and channel from the event data
3. IF: Checks if the message contains certain keywords
4. HTTP Request: Fetches relevant data based on the message
5. 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
Resources
Workflow Building Tools
Contributors
We appreciate all contributions to this project! 🎉
How to Contribute
1. Fork the repository
2. Create a feature branch (git checkout -b feature/amazing-feature)
3. Make your changes
4. Run tests and ensure build passes (bun run build)
5. Commit your changes (git commit -m 'Add some amazing feature')
6. Push to the branch (git push origin feature/amazing-feature)
7. Open a Pull Request
Special thanks to all contributors who help improve this project!
Version History
– Added slash_command event listener for handling slash commands
– Added configurable slash commands field to filter specific commands
– Enables building interactive Slack workflows with custom slash commands in n8n
– Fixed dependency resolution issues that caused ENOENT errors during installation
– Resolved nested dependency conflicts with @slack/logger and other Slack packages
– If you experienced installation errors, please upgrade to 1.6.0
– Added view_submission event listener for handling modal form submissions
– Added view_closed event listener for detecting when modals are dismissed
– Enables building interactive Slack workflows with modal forms in n8n
– Changed regex matching to work against the entire event JSON instead of just the text field
– Enables matching on any event property including subtypes, attachment colors, metadata, etc.
– Supports complex patterns like (?=.bot_message)(?=.#FF0000) to match multiple conditions
– Provides more flexible event filtering for advanced use cases
– Each channel entry now properly supports both dropdown selection and manual ID input
– Maintained backward compatibility with legacy single-channel selector
– Stable release of message event handler improvements from 1.3.5
– Production-ready named function handlers for all message events
– Verified event capture and processing reliability
– Ready for enterprise deployments with improved debugging capabilities
– Refactored message event handlers into named functions (handleMessageEvent, handleMessageSubtypeEvent)
– Fixed event capture and processing by separating handler definition from registration
– Improved app.event() listener registration to properly catch all message events
– Enhanced code maintainability and debugging with named function handlers
– Better event handling reliability for message and message subtype events
– Refactored message event listeners to use app.event() instead of app.message()
– Fixed regex state management by resetting lastIndex for global regex flags
– Enhanced null safety with explicit event and text validation
– Reduced code duplication in message subtype handling
– Improved early return pattern for better code readability
– Added proper acknowledgement for block actions interactions
– Fixed socket to Slack communication for button interactions
– Fixed channel filtering for events like reactionadded, pinadded, file_shared, etc.
– Added comprehensive channel ID extraction from multiple event properties (event.channel, event.item.channel, event.item.channel_id, event.file.channels)
– Added “Channel to watch” field similar to official Slack trigger node
– Implemented optional channel ID parameter to filter incoming Slack events
– Added searchable dropdown with channel selection via Slack API
– Improved event targeting by filtering events from specific channels only
– Added channel ID format validation for manual entry
– Added http-proxy-agent dependency for HTTP/HTTPS proxy support
– Enhanced connectivity options for enterprise environments
– Fixed invalid message.im event type with proper channel_type filtering
– Added support for filtering Slack messages by channel type (channels, groups, im, mpim, app_home)
– Improved message filtering capabilities using Slack Bolt framework best practices
– Resolved TypeScript typing issues
– Updated to include all events from the Slack Events API
– Improved event descriptions and documentation
– Support for app_mention, message, reaction events
– Added button interaction support
License
MIT License
Copyright (c) 2025 Mehmet Burak Akgün
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.