Slack Socket Mode Trigger icon

Slack Socket Mode Trigger

Triggers workflow when a Slack message matches a regex pattern via Socket Mode

Overview

This node triggers workflows based on real-time Slack events received via Slack's Socket Mode. It listens for specific event types such as messages sent to channels, app mentions, reactions added to messages, or interactive actions (like button clicks or select menu changes). The node is useful for automating responses or processes triggered by Slack activity without needing a public HTTP endpoint.

Common scenarios:

  • Triggering a workflow when a new message is posted in certain Slack channels.
  • Responding automatically when the app is mentioned in a conversation.
  • Tracking emoji reactions added to messages for sentiment analysis or approvals.
  • Handling interactive Slack components like buttons or menus to drive custom workflows.

Practical example:

  • Automatically create a task in a project management tool when a message containing a specific keyword is posted in a monitored channel.
  • Send a notification or log an entry whenever someone reacts with a thumbs-up emoji to a message.
  • Process user input from Slack interactive buttons to update records or trigger other services.

Properties

Name Meaning
Trigger On The type of Slack event to listen for. Options:
• Message — When a message is sent to a channel
• App Mention — When the app is mentioned in a message
• Reaction Added — When a reaction is added to a message
• Action — When an interactive action is triggered (buttons, select menus, etc.)
Channels to Watch List of Slack channel IDs to monitor for events. You can select channels from a list or specify them dynamically using expressions. If empty, all channels are monitored.
Message Filter (Optional) A regular expression pattern to filter incoming messages. Only messages matching this regex will trigger the workflow. Applicable only when "Trigger On" is set to "Message". Leave empty to allow all messages.
Allow Bot Messages Whether to include messages sent by bots. By default, bot messages and message updates are ignored. Applicable only when "Trigger On" is set to "Message".
Action ID (Optional) Specific action ID to filter interactive actions. Only actions matching this ID will trigger the workflow. Leave empty to listen to all action IDs. Applicable only when "Trigger On" is set to "Action".

Output

The node outputs JSON data representing the Slack event that triggered it. The structure varies depending on the event type but generally includes:

  • body: The full raw event body received from Slack.
  • payload: The payload object related to the event.
  • context: Additional context information provided by the Slack SDK.
  • event or action: The specific event or interactive action details.

This output allows downstream nodes to access all relevant Slack event data for further processing.

The node does not output binary data.

Dependencies

  • Requires a Slack app configured with Socket Mode enabled.
  • Needs an API authentication token credential with appropriate permissions (bot token, signing secret, app token).
  • Uses the official Slack Bolt SDK for Node.js to manage the Socket Mode connection and event handling.
  • n8n must be configured with the corresponding Slack API credentials.

Troubleshooting

  • Common issues:

    • Invalid or missing Slack credentials will prevent the node from connecting.
    • Incorrect channel IDs or insufficient permissions may cause no events to be received.
    • Invalid regex patterns in the message filter will be logged as errors and ignored.
    • If multiple instances of the node run with the same credentials, they share the underlying Slack connection; stopping one may affect others.
  • Error messages:

    • "Invalid regex pattern:" indicates the message filter regex is malformed. Fix the pattern syntax.
    • "Error starting Slack Socket Mode app" suggests problems with credentials or network connectivity.
    • "Error emitting ... event to subscriber" means an error occurred while forwarding the event internally; check workflow logic.
  • Resolutions:

    • Verify Slack app tokens and permissions.
    • Test regex patterns independently before use.
    • Ensure selected channels exist and the bot has access.
    • Review logs for detailed error traces.

Links and References

Discussion