Slack AI ChatBot : context-aware, replies to mentions AND also DMs
$20/month : Unlimited workflows
2500 executions/month
THE #1 IN WEB SCRAPING
Scrape any website without limits
HOSTINGER 🎉 Early Black Friday Deal
DISCOUNT 20% Try free
DISCOUNT 20%
Self-hosted n8n
Unlimited workflows - from $4.99/mo
#1 hub for scraping, AI & automation
6000+ actors - $5 credits/mo
Click here to access this Workflow for free.
Get your own custom ChatGPT inside your Slack Workspace
Description
This n8n workflow enables a fully autonomous AI assistant within your Slack Workspace. It listens for both public mentions and direct messages (DMs), and replies in real-time using a large language model (OpenAI's GPT-4o by default). The assistant can dynamically fetch previous messages for better context, providing smart, coherent, and personalized responses.
🔧 Key Features
- Dual Trigger: Reacts to both public bot mentions and private DMs.
- Context-Aware AI: Dynamically fetches the last 20 messages from either public or private conversations.
- Smart Routing: Replies either in the original public channel or via DM, depending on where the message came from.
- Custom Prompting: Easily modify the system prompt to define the AI’s tone, behavior, and personality.
- Fully Autonomous: No manual intervention required — the bot always replies instantly.
✅ Requirements
- An operational n8n instance.
- A Slack workspace (you can create one for free here)
- A Slack account with Admin or Owner privileges (required to install apps)
🧰 Setup Instructions
Slack Bot Setup
- Create a Slack App with the necessary permissions and configurations > You will find in the next step a complete tutorial to craft your own bot with the right confirguration and permissions for this workflow to work
- Set your Slack bot token in n8n's credential manager.
🤖 How It Works
- When a public mention is detected, the bot replies directly in the channel, referencing the original message.
- When a DM is received, it responds privately.
- The AI uses a tool to read the latest 20 public or private messages to build accurate context before replying.
🛠 Customization Options
- Change LLM: Swap out OpenAI with any LLM that has an API.
- Edit Prompt Behavior: Modify the system prompt to control tone and personality.