n8n

How to Route Slack Commands for Team Operations?

Give your team a simple way to run internal actions from Slack. Teammates type a command and the request is routed to the right n8n workflow, with clear replies and optional threads in a shared channel. This fits common IT and operations needs like user changes, data checks, or on demand jobs.

A secure webhook receives the Slack command. The flow validates the token and signing secret, parses the text, and looks up a command map set in a config node. When a thread is needed, it opens a thread in a chosen alerts channel and shares a direct link to the exact execution for fast support. It then forwards the request with thread details to a target sub workflow using Execute Workflow Trigger. Help and Unknown paths reply to Slack using the response_url so users always get feedback.

Setup needs a Slack app with a slash command, a bot token, and the signing secret. You can also connect PostgreSQL for data actions. Map each command name to a workflow id and choose if it should start a Slack thread. Expect faster responses, fewer handoffs, and a clear audit trail in channels for each request.

What are the key features?

  • Webhook entry that receives Slack slash commands securely
  • Signature and token checks to validate every request
  • Command parsing and switch based routing with a config map
  • Optional Slack thread creation in a defined alerts channel
  • Ephemeral confirmations to users via response_url
  • Debug link posted with instance and execution id for quick support
  • Execute Workflow to start sub workflows via Execute Workflow Trigger
  • Thread info merged into the payload so subflows can reply in context
  • Help and Unknown handlers that guide users to the right commands
  • Example PostgreSQL steps to get or delete a user and confirm in thread

What are the benefits?

  • Reduce manual triage from 30 minutes to 2 minutes
  • Automate up to 80 percent of routine Slack requests
  • Cut handoff errors by 80 percent with one command format
  • Handle 5 times more internal requests without extra staff
  • Connect Slack and PostgreSQL in one flow
  • Share instant debug links to speed up fixes by 50 percent

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. You'll need accounts with Slack and PostgreSQL. See the Tools Required section above for links to create accounts with these services.
  3. In the Slack API dashboard, create or open your app. Add a Slash Command and set the Request URL to the Production URL from the Webhook node in n8n.
  4. Install the Slack app to your workspace. Copy the Bot User OAuth Token and the Signing Secret for later steps.
  5. In n8n, open any Slack node, double click it, then in the Credential to connect with menu click Create new credential and follow the on screen steps. Use the bot token you copied.
  6. Open the Webhook node in n8n and copy both Test and Production URLs. Keep the Production URL in Slack so commands work when the workflow is active.
  7. Open the Set config node. Fill alerts_channel, instance_url, help_docs_url, slack_token, and slack_secret_signature with your Slack app values.
  8. In the Set config node, add entries to commands that map each command name to a workflowId and a startThread flag. Example info mapped to a workflow id with startThread false.
  9. Create a sub workflow for each command. Use the Execute Workflow Trigger node at the start so the parent workflow can pass data into it.
  10. If a sub workflow should reply in a Slack thread, read channel and thread_ts from the input and post replies using a Slack node set to Reply in thread.
  11. If your actions need a database, open a PostgreSQL node, click Create new credential, and enter host, port, database, user, and password from your server.
  12. Activate the parent workflow. In Slack, run your slash command with help to see the help reply. Try a known command and confirm you get an immediate confirmation and, when enabled, a new thread in the alerts channel.
  13. Open the posted debug link to review the exact execution if something fails. If Slack shows invalid request, recheck the signing secret and token values in the Set config node. If Unknown command appears, fix the commands mapping.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

PostgreSQL

Sign up

Free: $0 (open-source PostgreSQL License; self-hosted)

Slack

Sign up

Free plan: $0 / mo; limited to 10 apps (third-party or custom) and usable via Slack API

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.