Slack Socket Mode Trigger icon

Slack Socket Mode Trigger

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

Slack Socket Mode Trigger

AI-generated

Overview

This node triggers workflows in n8n when specific Slack events occur via Slack's Socket Mode. It listens for a wide range of Slack event types such as messages, app installations, channel activities, reactions, slash commands, and more. Users can filter events by selecting specific event triggers, applying regex patterns to message content, specifying slash commands to listen for, and filtering by Slack channels. This node is useful for automating workflows based on real-time Slack interactions, such as responding to messages matching certain patterns, handling slash commands, or reacting to channel or user events.

Use Case Examples

  1. Trigger a workflow when a message containing a specific keyword or pattern is posted in Slack.
  2. Start a workflow when a user installs or uninstalls the Slack app.
  3. Listen for specific slash commands like '/deploy' or '/status' to trigger deployment or status check workflows.
  4. Filter events to only trigger workflows for messages or actions in selected Slack channels.

Properties

Name Meaning
Trigger On Select one or more Slack event types to listen for, such as messages, app installs, reactions, channel events, and slash commands.
Regex Pattern Regular expression to match against incoming Slack messages. Capture groups can be used to extract data.
Regex Flags Flags for the regular expression (e.g., g for global, i for case-insensitive).
Slash Commands Comma-separated list of slash commands to listen for (e.g., deploy, status, help). Leave empty to listen for all slash commands. Do not include the leading slash. Only shown if 'Slash Command' trigger is selected.
Channels to Watch Select channels to filter events. If specified, only events from these channels will trigger the workflow. Multiple channels can be added. To enter IDs manually, add each channel separately (e.g., C1234567890, G1234567890).
Legacy Channel to Watch Legacy single-channel selector retained for workflows created before version 1.4.0. Allows selecting a single channel to filter events.

Output

JSON

  • event - The Slack event data that triggered the workflow, including all event details.

Dependencies

  • Slack API credentials with bot token, app token, and signing secret for Socket Mode

Troubleshooting

  • Ensure Slack API credentials include bot token, app token, and signing secret; missing any will cause errors.
  • If no events trigger, verify that the selected triggers match the Slack app's subscribed events and that the app is properly installed and authorized.
  • Regex pattern errors can cause no matches; verify the regex pattern and flags are correct.
  • Channel filtering requires valid channel IDs; ensure channels are correctly selected or entered.
  • Errors during event processing are logged; check logs for details and ensure network connectivity to Slack Socket Mode.

Discussion