π¬ Chatbot that Knows Your Documents (OpenRouter + Product Management Agent)
π Workflow: Chatbot that Knows Your Documents
This blog contains the Webhook + Retrieval-Augmented Generation (RAG) workflow for n8n, powered by OpenRouterβs deepseek-chat model. It demonstrates how prompt wording and topic specificity change the AIβs response β while adding a RAG tool for Product Management insights.
β¨ Overview
This workflow expands the 201-basic pattern by introducing memory, OpenRouter free-tier LLM, and a RAG API tool for contextual answers. It creates a Product Management AI Agent that:
- π§ Uses RAG for Product Management questions
- π¬ Uses the LLM (deepseek-chat) for general or AWS-related questions
- π Politely declines out-of-scope or non-relevant questions
- π§ Keeps short, simple replies (2β3 sentences), emphasizing clarity and prompt impact
π How It Works
graph LR
A["π Webhook (POST)"] --> B["π§ AI Agent"]
B --> C["π€ OpenRouter Chat Model (deepseek-chat)"]
B --> D["π οΈ RAG Tool (Product Management API)"]
B <--> E["ποΈ Memory (sessionKey = username)"]
B --> F["β©οΈ Respond to Webhook"]
- Webhook receives JSON (
query,username). -
AI Agent decides how to respond:
-
If the topic involves Product Management β call the RAG Tool.
- Otherwise β use the deepseek-chat model directly.
-
For vague questions β respond generally and guide users to be more specific.
-
Memory Buffer (Window) stores short-term conversation context by username.
- Response Node returns the generated reply to the client.
ποΈ Architecture

π Inputs (JSON Body)
| Field | Type | Required | Description |
|---|---|---|---|
query |
string | β | Userβs input message |
username |
string | π’ Recommended | Session key for conversational memory |
Example
{
"query": "What are best practices for Product Managers when prioritizing features?",
"username": "demo-user-1"
}
π€ Output
- HTTP 200 OK with a short AI reply.
-
Reply style examples:
-
β(Answer from Product Management knowledge base)β β via RAG Tool
- β(General or AWS-based answer)β β via model
- β(Out-of-scope polite refusal)β β for unrelated queries
βοΈ Setup
- Import
301-webhook-rag.jsoninto your n8n Cloud workspace. -
Credentials β Configure:
-
π OpenRouter API (create a free account at openrouter.ai)
-
π Optional: API key for the Traversaal Product Docs API (used by the RAG Tool)
-
In the βRAG Toolβ node, replace:
bash
Authorization: your_traversaal_api_auth_brearer_token_here
with your actual bearer token.
- Activate the workflow and copy the Production Webhook URL (from the Webhook node).
- Optionally adjust the
systemMessageinside the AI Agent node to modify tone or domain focus.
π§ͺ Try It
Option A β Google Colab (Recommended)
- Open the instructorβs Colab notebook: 301 Webhook + RAG β Client (Colab)
- Click File β Save a copy in Drive.
- Replace
WEBHOOK_URLwith your Production Webhook URL from n8n. -
Run all cells and test:
-
π§ βWhat are best practices for Product Managers?β
- βοΈ βTell me about AWS S3 buckets.β
- ποΈ βWhat is the capital of France?β
π‘ Use the same
usernameto maintain context; new names start fresh sessions.
Option B β cURL
WEBHOOK_URL="https://<your-n8n>/webhook/<id>" # Use Production URL
curl -X POST "$WEBHOOK_URL" \
-H "Content-Type: application/json" \
-d '{"query":"List key principles of Product Management","username":"demo-user-1"}'
Option C β Postman
- Create a POST request β
Production Webhook URL - Body β Raw β JSON:
json
{
"query": "How can I improve sprint planning as a Product Manager?",
"username": "demo-user-1"
}
- Click Send β view AI reply.
π§ What to Notice (Teaching Points)
- Demonstrates how prompt wording changes the modelβs specificity.
- Shows AI tool routing (LLM vs RAG) within a single workflow.
- Highlights the benefit of contextual memory via
sessionKey. - Provides a budget-friendly OpenRouter setup (deepseek-chat is free tier).
- Encourages experimentation with tone and system instructions.
π References
- π Traversaal Product Management Docs API
- π OpenRouter β deepseek-chat model
- π n8n β AI Agent node
- π n8n β HTTP Request Tool
- π n8n β Memory Buffer Window
πͺ Learn how to chain OpenRouter, RAG, and custom APIs in your own workflows β the same pattern used here.
Donβt forget to check out my Agentic AI System Design for PMs course on Maven if you are interested to be a part of something bigger.
