What This Workflow Does
This n8n workflow creates a chatbot that remembers recent messages and finds fresh info online when answering questions.
It solves the problem of losing chat context and needing up-to-date data during conversations.
The result is faster, smarter replies that mix stored chat history with live search and Wikipedia facts.
Who Should Use This Workflow
This workflow suits customer support teams handling many questions daily.
It helps when answering long conversations and finding real-time info quickly.
Anyone who wants better chat responses without switching between many tools will find it useful.
Tools and Services Used
- n8n Webhook Trigger: Receives chat messages from users.
- Langchain – Simple Memory: Stores last 20 messages for context.
- Langchain – OpenAI GPT-4 Mini Model: Creates AI chat replies with context.
- Langchain – SerpAPI: Performs live internet searches for current info.
- Langchain – Wikipedia Node: Gets factual data from Wikipedia API.
- Langchain – AI Agent: Controls how all tools work together to answer chats.
Inputs, Processing, and Output
Inputs
- User chat messages sent to the webhook URL.
Processing Steps
- Webhook node catches incoming messages.
- Simple Memory node keeps last 20 messages to hold conversation context.
- OpenAI Chat Model uses memory to generate intelligent responses.
- SerpAPI node searches live internet for recent and relevant info.
- Wikipedia node fetches factual knowledge for reference.
- AI Agent node combines all data and tools to form final reply.
Output
- Context-aware, up-to-date answers sent back to users.
Beginner Step-by-Step: How to Use This Workflow in n8n
Step 1: Import the Workflow
- Click the Download button on this page to get the workflow file.
- Open the n8n editor and choose “Import from File”.
- Select the downloaded workflow file to import it.
Step 2: Add Credentials and Update Settings
- Go to each node that needs API keys and add your keys (OpenAI, SerpAPI).
- If needed, update any IDs, emails, or channel info in the nodes to fit your setup.
Step 3: Test the Workflow
- Send a sample chat message to the webhook URL.
- Check the response for correctness and context retention.
Step 4: Activate for Production
- When testing looks good, activate the workflow in n8n.
- Share the webhook with your chat platform or app so it can send messages.
- Monitor workflow runs from the n8n execution logs.
- Consider using self-host n8n if running on a personal server for better control.
Customization Ideas
- Increase the Simple Memory node window size above 20 to keep more messages in context.
- Add other Langchain-compatible tools for extra capabilities.
- Change OpenAI model to another supported one for balance between speed and reply quality.
- Adjust SerpAPI search settings to filter results better.
- Connect other n8n triggers for inputs from multiple platforms.
Common Problems and Fixes
OpenAI API authentication failed
Cause: Incorrect or expired OpenAI API Key.
Fix: Re-enter the correct API Key in n8n credentials and test connection.
SerpAPI returns empty results
Cause: Invalid SerpAPI Key or usage limits exceeded.
Fix: Check key validity and usage on SerpAPI dashboard.
AI Agent node does not respond
Cause: Missing connections or wrong credentials.
Fix: Verify all inputs to AI Agent node are connected correctly and credentials are valid.
Summary of Benefits
✓ Saves time by automating chat replies with memory and live data.
✓ Improves answer quality using both recent conversation and up-to-date info.
✓ Handles complex questions without manual switching between tools.
→ Results in higher customer satisfaction and quicker support.
