

How to Build AI-Powered Q&A Bot with N8n
Auto-respond to Slack mentions by sending questions to GPT-4 and posting AI answers as thread replies.
Steps and UI details are based on platform versions at time of writing β check each platform for the latest interface.
Best for
Teams wanting customizable AI bots with complex prompt logic and response formatting control.
Not ideal for
Quick deployments where basic AI responses without customization are sufficient.
Sync type
real-timeUse case type
notificationReal-World Example
A 25-person software company uses this bot in their #general channel to answer policy questions, debug errors, and explain internal tools. Before automation, employees interrupted managers 15-20 times daily with questions that had standard answers. Now GPT-4 handles 80% of common questions instantly, and managers only get complex issues that need human judgment.
What Will This Cost?
Drag the slider to your expected monthly volume.
Each platform counts differently β Zapier: 1 task per trigger. Make: 1 operation per module per record. n8n: 1 execution per run.





Prices shown for annual billing. Based on published pricing as of April 2026.
Estimated ROI
1000
min saved/mo
$583
labor value/mo
Free
no platform cost
Based on ~2 min manual effort per operation at $35/hr fully loaded labor cost.
Implementation
Import this workflow directly into n8n
Copy the pre-built n8n blueprint and paste it straight into n8n. All modules, filters, and field mappings are already configured β you just need to connect your accounts.
Before You Start
Make sure you have everything ready.
Field Mapping
Map these fields between your apps.
| Field | API Name | |
|---|---|---|
| Required | ||
| Message Text | text | |
| Channel ID | channel | |
| Message Timestamp | ts | |
| AI Response | text | |
| Prompt Text | prompt | |
1 optional fieldβΈ show
| User ID | user |
Step-by-Step Setup
Workflows > New > + > Slack Trigger
Create new N8n workflow
Start a fresh workflow and add the initial Slack trigger. This monitors your workspace for bot mentions and kicks off the AI response flow.
- 1Click 'New Workflow' from the N8n dashboard
- 2Click the '+' button to add your first node
- 3Search for 'Slack' and select 'Slack Trigger'
- 4Choose 'On App Mention' as the trigger event
Node Parameters > Credentials > Create New
Connect Slack workspace
Authenticate N8n with your Slack workspace. You'll need bot token permissions to read mentions and post replies.
- 1Click 'Create New' next to Credentials in the Slack node
- 2Select 'OAuth2 API' credential type
- 3Click 'Connect my account' and authorize N8n
- 4Grant permissions for channels:history and chat:write
Slack Trigger Node > Listen for Test Event
Test Slack trigger
Verify the trigger captures mention data correctly. This confirms your bot receives the message text and thread details needed for GPT-4.
- 1Click 'Listen for Test Event' on the Slack trigger node
- 2Go to Slack and mention your bot with a test question
- 3Return to N8n and click 'Use Workflow Data'
- 4Verify the test data shows message text and channel info
Add Node > OpenAI > Text > Complete
Add OpenAI node
Insert the GPT-4 node that processes user questions. This sends the mentioned text to OpenAI and receives the AI-generated response.
- 1Click '+' after the Slack trigger to add a new node
- 2Search for 'OpenAI' and select it
- 3Choose 'Text' operation and 'Complete' resource
- 4Set Model to 'gpt-4' in the dropdown
OpenAI Node > Credentials > Create New
Configure OpenAI credentials
Add your OpenAI API key so N8n can make requests to GPT-4. This enables the actual AI processing of user questions.
- 1Click 'Create New' next to Credentials in OpenAI node
- 2Paste your OpenAI API key into the API Key field
- 3Click 'Save' to store the credential
- 4Verify connection shows as successful
OpenAI Node > Parameters > Prompt
Map question text to GPT-4 prompt
Extract the user's question from the Slack mention and format it for OpenAI. This removes bot mention syntax and creates a clean prompt.
- 1In the OpenAI node Prompt field, click the expression editor
- 2Enter: {{ $node['Slack Trigger'].json['text'].replace(/<@.*?>/g, '').trim() }}
- 3Set Max Tokens to 500 for reasonable response length
- 4Set Temperature to 0.7 for balanced creativity
OpenAI Node > Execute Node
Test AI response
Verify GPT-4 generates appropriate responses to user questions. This confirms the OpenAI integration works before adding Slack reply logic.
- 1Click 'Execute Node' on the OpenAI node
- 2Check the output data contains a 'text' field with AI response
- 3Verify the response makes sense for your test question
- 4Note the response length and adjust Max Tokens if needed
Add Node > Slack > Message > Post
Add Slack reply node
Create the node that posts GPT-4's response back to Slack. This completes the bot loop by sending AI answers as threaded replies.
- 1Click '+' after the OpenAI node to add another node
- 2Search for 'Slack' and select it again
- 3Choose 'Message' resource and 'Post' operation
- 4Select 'Post to Thread' to reply in the original thread
Slack Reply Node > Parameters
Configure thread reply mapping
Map the OpenAI response text and Slack thread details for proper reply posting. This ensures responses appear as threaded replies to the original mention.
- 1Set Channel to: {{ $node['Slack Trigger'].json['channel'] }}
- 2Set Text to: {{ $node['OpenAI'].json['text'] }}
- 3Set Thread TS to: {{ $node['Slack Trigger'].json['ts'] }}
- 4Leave other fields at default values
Workflow > Execute Workflow
Test complete workflow
Run the full bot flow end-to-end to verify everything works. This confirms mentions trigger AI responses that post back to Slack correctly.
- 1Click 'Execute Workflow' to test the complete flow
- 2Go to Slack and mention your bot with a new question
- 3Check that a threaded reply appears with GPT-4's response
- 4Verify the response timing and accuracy
Workflow > Active Toggle
Activate workflow
Turn on the workflow to handle mentions automatically. This switches from manual testing to live bot operation in your Slack workspace.
- 1Click the toggle switch in the top right to 'Active'
- 2Verify the workflow status changes to 'Active'
- 3Save the workflow with a descriptive name like 'AI Q&A Bot'
- 4Test one final mention to confirm live operation
Drop this into an n8n Code node.
Copy this template{{ $node['Slack Trigger'].json['text'].replace(/<@.*?>/g, '').replace(/^\s+|\s+$/g, '').substring(0, 500) }}βΈ Show code
{{ $node['Slack Trigger'].json['text'].replace(/<@.*?>/g, '').replace(/^\s+|\s+$/g, '').substring(0, 500) }}... expand to see full code
{{ $node['Slack Trigger'].json['text'].replace(/<@.*?>/g, '').replace(/^\s+|\s+$/g, '').substring(0, 500) }}Scaling Beyond 500+ mentions/day+ Records
If your volume exceeds 500+ mentions/day records, apply these adjustments.
Add request queuing
Use N8n's Wait node with random delays between 1-5 seconds to avoid hitting OpenAI's rate limits. The free tier allows 3 requests/minute, paid accounts get 60/minute.
Cache common responses
Add a lookup node that checks frequently asked questions against a predefined response list before calling GPT-4. This cuts API costs by 40-60% for repetitive questions.
Going live
Production Checklist
Before you turn this on for real, confirm each item.
Troubleshooting
Common errors and how to fix them.
Frequently Asked Questions
Common questions about this workflow.
Analysis
Use N8n for this if you want full control over the AI prompt formatting and response processing. N8n's expression editor lets you clean up Slack mention syntax, add context, and format GPT-4 responses exactly how you want. The code nodes also handle complex logic like conversation history or response filtering. Pick Zapier instead if you need this running in 5 minutes with zero customization.
This workflow uses 3 operations per mention: Slack trigger, OpenAI request, and Slack reply. At 200 mentions/month, that's 600 operations monthly. N8n's Starter plan at $20/month includes 2,500 operations, so you're well covered. Zapier would cost $29.99/month for their Professional plan to handle the same volume with GPT-4. Make's $10.59 plan works but caps at 1,000 operations, so you'd hit limits fast.
Zapier wins on setup speed - their OpenAI integration has pre-built prompt templates and auto-formats responses. Make handles high volume better with built-in error retry and rate limiting that N8n requires manual configuration to match. But N8n beats both on customization depth. You can add conversation memory, user-specific prompts, or response post-processing that would require multiple Zaps or complex Make scenarios.
GPT-4 API calls fail randomly about 2% of the time due to OpenAI server load - add error handling or users will see no response to their questions. Slack's real-time API occasionally delivers mention events twice, so track processed message timestamps to avoid duplicate responses. OpenAI charges per token in both directions, so long user questions plus detailed bot responses cost more than simple Q&A pairs.
Ideas for what to build next
- βAdd conversation memory β Store chat history in a database and include recent context in GPT-4 prompts for more intelligent responses.
- βCreate response quality ratings β Add thumbs up/down reactions to bot replies and log feedback for improving prompts and model selection.
- βExpand to direct messages β Duplicate the workflow with a DM trigger so users can ask questions privately without cluttering channels.
Related guides
How to Share Notion Meeting Notes to Slack with Pipedream
~15 min setup
How to Share Notion Meeting Notes to Slack with Power Automate
~15 min setup
How to Share Notion Meeting Notes to Slack with n8n
~20 min setup
How to Send Notion Meeting Notes to Slack with Zapier
~8 min setup
How to Share Notion Meeting Notes to Slack with Make
~12 min setup
How to Create Notion Tasks from Slack with Pipedream
~15 min setup