Build an AI Chatbot with Slack Slash Commands
detail.loadingPreview
This n8n workflow demonstrates how to create an AI chatbot that responds to Slack slash commands. It utilizes a Webhook trigger, a Switch node for command routing, and Langchain nodes for AI message generation before sending a response via the Slack node.
🚀Ready to Deploy This Workflow?
About This Workflow
Overview
This n8n workflow provides a comprehensive guide to building an AI-powered chatbot that integrates seamlessly with Slack using slash commands. It automates responses to user queries by leveraging n8n's node-based automation capabilities. The workflow begins with a Slack slash command triggering a webhook, which then routes the command to a 'Switch' node. This node intelligently directs different commands to specific processing paths. For AI-driven responses, it utilizes 'Basic LLM Chain' and 'OpenAI Chat Model' nodes to generate intelligent replies based on user input. Finally, the 'Send a Message' node dispatches the AI-generated response back to the designated Slack channel.
Key Features
- Trigger chatbot functionality directly from Slack using slash commands.
- Dynamically route different slash commands to distinct workflow paths.
- Integrate with advanced AI models (e.g., OpenAI) for intelligent message generation.
- Automatically send AI-generated responses back to Slack channels.
How To Use
- Configure a Slack App and define your slash commands.
- In n8n, set up the 'Webhook' node with the Slack app's Request URL.
- Use the 'Switch' node to define rules for different slash commands (e.g., '/ask', '/another').
- Connect the appropriate output of the 'Switch' node to your AI processing logic (e.g., 'Basic LLM Chain', 'OpenAI Chat Model').
- Configure the AI nodes with your desired language models and prompts.
- Use the 'Send a Message' node to send the AI's response back to the Slack channel, ensuring the
channel_idis correctly mapped from the webhook input.
Apps Used
Workflow JSON
{
"id": "4c954b1a-c904-409a-b670-de51cd34a83d",
"name": "Build an AI Chatbot with Slack Slash Commands",
"nodes": 0,
"category": "Slack Automation",
"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: 4c954b1a-c904...
About the Author
N8N_Community_Pick
Curator
Hand-picked high quality workflows from the global community.
Statistics
Verification Info
Related Workflows
Discover more workflows you might like
Build an AI Chatbot for Slack with Knowledge Base Integration
Automate Slack DMs with an AI chatbot that queries your knowledge base. This workflow uses OpenAI and a memory buffer to provide context-aware responses, while intelligently handling bot messages and cleaning up communication.