Smart Slack Assistant with AI Chat Memory
detail.loadingPreview
This workflow creates an intelligent Slack chatbot that responds to user messages in dedicated channels. It leverages AI models via OpenRouter and maintains conversational context using PostgreSQL, ensuring personalized and coherent interactions for enhanced team productivity.
About This Workflow
Empower your team with an advanced AI assistant directly within Slack. This robust n8n workflow listens for user messages, intelligently processes them using customizable AI agents powered by OpenRouter's diverse language models, and provides context-aware responses by storing chat history in a PostgreSQL database. Enhance communication, automate information retrieval, or offer instant support with a chatbot that remembers past conversations and responds in real-time, complete with a 'thinking' status for a seamless user experience. Perfect for internal tools, Q&A bots, or departmental support, this workflow brings powerful conversational AI to your daily operations.
Key Features
- Intelligent Slack Integration: Listens for user messages in specified Slack channels and responds in real-time within the same thread.
- Advanced AI Agent: Utilizes Langchain to create a customizable AI persona, ensuring helpful, friendly, and markdown-formatted responses.
- Flexible LLM Support via OpenRouter: Connects to a wide range of Large Language Models (LLMs) through OpenRouter, allowing you to choose the best model for your needs.
- Persistent Chat Memory: Stores conversational history in a PostgreSQL database, enabling the AI to recall past interactions and provide context-aware replies.
- Enhanced User Experience: Displays a "thinking" status in Slack threads while the AI processes requests, improving responsiveness perception.
How To Use
- Configure Slack Trigger: In the "On Message Received" node, select your Slack app credentials. Replace
"YOUR_APPS_CHANNEL_ID"with the actual ID of the Slack channel your app is installed in and where you want the bot to listen. - Set up "Thinking" Status: Update the "Set Thinking Status" node with your Slack app's bearer token for API access. This token needs
chat:writeandchat:write.customizescopes. - Customize AI Agent: Open the "AI Agent" node. Modify the
systemMessageparameter to define your bot's personality and instructions. ThepromptTypecan also be adjusted for different agent behaviors. - Connect LLM (OpenRouter): Ensure your OpenRouter credentials are correctly set up in the "OpenRouter Chat Model" node. You can explore different models available via OpenRouter in its configuration to find one that best suits your needs.
- Configure Postgres Memory: In the "Postgres Chat Memory" node, provide your PostgreSQL database credentials and ensure the
tableName(defaultchat_histories) is appropriate. ThesessionKeyshould dynamically pull the Slack user's ID or channel ID to maintain distinct chat histories for each conversation. - Review Slack Reply: Verify the "Send Reply" node uses the correct Slack credentials and ensures the message is formatted as desired (Markdown block is already configured to send rich text).
- Activate Workflow: Once all configurations are complete, activate the workflow to launch your intelligent AI Slack assistant.
Apps Used
Workflow JSON
{
"id": "02afe7ba-5fe5-4b64-aabb-377e52a69e49",
"name": "Smart Slack Assistant with AI Chat Memory",
"nodes": 21,
"category": "Operations",
"status": "active",
"version": "1.0.0"
}Note: This is a sample preview. The full workflow JSON contains node configurations, credentials placeholders, and execution logic.
Get This Workflow
ID: 02afe7ba-5fe5...
About the Author
Free n8n Workflows Official
System Admin
The official repository for verified enterprise-grade workflows.
Statistics
Related Workflows
Discover more workflows you might like
Universal CSV to JSON API Converter
Effortlessly transform CSV data into structured JSON with this versatile n8n workflow. Integrate it into any application as a custom API endpoint, supporting various input methods including file uploads and raw text.
Instant WooCommerce Order Notifications via Telegram
When a new order is placed on your WooCommerce store, instantly receive detailed notifications directly to your Telegram chat. Stay on top of your e-commerce operations with real-time alerts, including order specifics and a direct link to view the order.
On-Demand Microsoft SQL Query Execution
This workflow allows you to manually trigger and execute any SQL query against your Microsoft SQL Server database. Perfect for ad-hoc data lookups, administrative tasks, or quick tests, giving you direct control over your database operations.