Slack Slash Command AI Chat
Users type a slash command in public Slack channels to get an instant AI-generated answer based on their question.
What it does
Type a slash command in public Slack channels to instantly receive an AI-generated answer tailored to your question. The system processes your input through OpenAI and posts the relevant response directly back into the chat for immediate visibility.
Step by step
- Configure the Slack app with a Request URL pointing to your n8n webhook endpoint and enable the slash command trigger.
- Set up an n8n workflow that starts with a Webhook node set to receive POST requests from Slack.
- Add a Switch node in n8n to route incoming commands based on the text payload or specific keyword matches.
Where the LLM does the work
- Design the prompt template for the OpenAI Chat Model to ensure responses are concise and formatted appropriately for Slack's message blocks.
- Determine how to handle context or memory if users expect follow-up questions within the same conversation thread.
- Decide on the tone and style guidelines in the system prompt to match your team's communication culture.
Watch out for
Tools that fit
The agent brief
You are helping me build the following AI agent workflow. ## Goal Slack Slash Command AI Chat: Users type a slash command in public Slack channels to get an instant AI-generated answer based on their question. ## Specification - What it does: Type a slash command in public Slack channels to instantly receive an AI-generated answer tailored to your question. The system processes your input through OpenAI and posts the relevant response directly back into the chat for immediate visibility. - Trigger: Run manually (Manual · on slash command) - Autonomy: Fully hands-off - Expected setup effort: about an afternoon - Tools/services involved: - Slack: User interface and webhook trigger - n8n Webhook: Receiving slash command requests - OpenAI Chat Model: Generating chatbot responses ## Known pitfalls, handle each one explicitly in your implementation 1. The webhook URL must be publicly accessible via HTTPS so configure your n8n instance with proper domain and SSL certificates before linking it in Slack settings. 2. Command permissions require admin approval in Slack workspaces so ensure you have the necessary administrative rights to install and configure the app initially. ## Reference implementation https://n8n.io/workflows/2905 (workflow template) Fetch and inspect this before building. If it matches my stack, adapt it; if not, rebuild the pattern with my tools. ## Process requirements 1. Before building: ask me which of the listed tools I actually use and what my platform is (n8n / Make / code / other). Do not assume. 2. Adapt the pattern to my answers; do not force the reference stack. 3. Address every pitfall above; tell me how you handled each. 4. Provide a test plan I can run before letting this touch real data. 5. Ask before any step that sends messages, modifies data, or spends money. Source: https://usecasesforagents.com/use-case/slack-slash-command-ai-chat-bot/ via usecasesforagents.com
Frequently asked questions
Can I use a different Messaging than Slack?
Yes. Slack is only the example messaging in this recipe. The same flow works with ClickSend API, Discord, Google Chat and LINE Messaging API. Swap the messaging connection and keep the rest of the setup as written.
Want this running in your business?
Who it's for
Built for developers who want the busywork around code automated, not the code itself.
Ops-IT teams triaging their own internal requests get the same pattern, different queue.