Using n8n with Slack for Automated Alerts
Introduction
Integrate Slack with n8n workflows to deliver real-time alerts and notifications to team channels, improving incident response.
Prerequisites
- n8n v1.0+
- Slack workspace and API token
Step 1: Create Slack App
- In Slack API dashboard, create new app.
- Enable chat:write scope and install to workspace.
- Copy Bot User OAuth Token.
Step 2: Add Slack Credentials in n8n
In n8n UI, navigate to Credentials > Add Slack:
- API Token: paste Bot OAuth token.
Step 3: Create Workflow
- Trigger: Webhook or schedule.
- Next Node: Slack node, configure:
- Resource: Message
- Operation: Post Message
- Channel:
#alerts
- Text:
{{ $json["eventType"] }} occurred at {{ $json["timestamp"] }}
[!code highlight:1]
Step 4: Add Conditions
Use IF node to filter events:
{{$node["Webhook"].json["status"] === 'error'}}
Then connect IF true to Slack node.
Step 5: Test and Deploy
Execute workflow manually or trigger external event. Verify message in Slack channel.
Summary
n8n’s Slack integration enables automated, conditional alerts directly in your communication channels, streamlining operations and on-call workflows.