How to Set Up and Connect a Slack Bot to n8n (Step‑by‑Step Tutorial)
by Bradford Carlton - Automate Business AI
The video walks through creating a Slack app, generating a bot token and signing secret, configuring OAuth scopes and event subscriptions, installing the app to a workspace, and connecting the resulting credentials to n8n via a Slack Trigger node and a Slack Message node. It demonstrates how to test the workflow by sending a message to the bot in Slack and having n8n reply, while highlighting common pitfalls like missing scopes, wrong token types, and the need to invite the bot to channels.
How to Set Up and Connect a Slack Bot to n8n
Overview
This guide reproduces the exact steps shown in Bradford Carlton’s video "How to Set Up and Connect a Slack Bot to n8n". You’ll create a Slack app, configure it for bot usage, install it to your workspace, set up event subscriptions, and wire everything into an n8n workflow that responds to app_mention events.
Prerequisites
- A Slack workspace where you have admin rights.
- An n8n instance (self‑hosted or n8n Cloud).
- Basic familiarity with the Slack API and n8n UI.
Step‑by‑Step Instructions
1. Create a Slack App
- Go to api.slack.com/apps and click Create New App → From scratch.
- Name the app (e.g.,
n8n Test Bot) and select your workspace. - Click Create App.
2. Add Bot Token Scopes
- In the left sidebar, open OAuth & Permissions.
- Under Bot Token Scopes, click Add an OAuth Scope and add the following:
app_mentions:readchannels:historychannels:readchat:writefiles:readfiles:writegroups:historygroups:readim:historyim:readmpim:historympim:readreactions:readreactions:write
- (Optional) Add any additional scopes you need for your workflow.
3. Install the App to Workspace
- Still in OAuth & Permissions, scroll to OAuth Tokens for Your Workspace.
- Click Install to Workspace and grant the requested permissions.
- Copy the Bot User OAuth Token (starts with
xoxb-). - Copy the Signing Secret from Basic Information → App Credentials.
4. Configure Event Subscriptions
- In the Slack app, open Event Subscriptions.
- Toggle Enable Events to On.
- For Request URL, paste a placeholder for now (you’ll replace it with the n8n webhook later).
- Under Subscribe to bot events, add:
app_mentionmessage.channelsmessage.groupsmessage.im
- Save changes.
5. Create an n8n Workflow
- In n8n, click New Workflow.
- Add a Slack Trigger node.
- Authentication: Create a new credential of type Slack OAuth2 API.
- Client ID & Client Secret: Paste the values from your Slack app’s Basic Information.
- Redirect URL: Copy the OAuth Callback URL shown in the credential and paste it into OAuth & Permissions → Redirect URLs.
- Trigger on:
app_mention.
- Add a Slack Message node (to reply).
- Authentication: Create a new credential of type Slack using the Bot User OAuth Token.
- Resource:
Message. - Operation:
Send. - Send Message To:
Channel. - Channel:
#n8n-test(or any channel the bot is invited to). - Message Text:
{{ $json.text }}(or any custom response).
- Connect the Trigger to the Message node.
- Save the workflow and Activate it.
6. Wire the Webhook URL to Slack
- In the Slack Trigger node, copy the Webhook URL (the Production URL if the workflow is active).
- Return to your Slack app’s Event Subscriptions.
- Replace the placeholder Request URL with the copied webhook URL.
- Slack will verify the URL; once verified, the subscription is live.
7. Invite the Bot to a Channel
- In Slack, open the channel you chose in step 5.
- Type
/invite @YourBotNameand press Enter.
8. Test the Bot
- In the channel, type
@YourBotName hello. - The bot should respond with the message defined in the n8n workflow.
Tips & Gotchas
- Wrong token type: Using an OAuth2 credential for the Slack Message node will send from your personal account, not the bot. Use the Bot User OAuth Token instead.
- Token rotation: If you enable token rotation in Slack, the
xoxb-token will expire after 12 h. Disable it during setup. - Channel invitation: The bot cannot post to a channel it isn’t invited to; use
/invite. - Testing vs Production URLs: While testing, use the Test URL from the Trigger node and keep Slack pointing to it. When you activate the workflow, switch to the Production URL in Slack.
- Event verification: Slack will immediately ping the webhook URL; if it fails, check that the workflow is active and the URL is correct.
- Avoid loops: If the bot replies to its own messages, you’ll get an endless loop. Exclude the bot’s user ID in the Trigger on field or filter in the workflow.
This markdown guide mirrors the exact sequence demonstrated in the video, ensuring that anyone following it will replicate the same working Slack bot integrated with n8n.





