Quick overview
This workflow lets you upload PDF/CSV/TXT documents into an in-memory vector store and exposes a header-authenticated webhook that answers support questions using OpenAI chat models, optionally retrieving facts from the uploaded documents while keeping short session-based conversation memory.
How it works
- Receives uploaded PDF, CSV, or TXT files via an n8n form and replaces the current in-memory knowledge base with the new content.
- Splits the uploaded files into chunks, generates embeddings with OpenAI, and stores the vectors in an in-memory vector store.
- Receives a POST request on a header-authenticated webhook containing a user message and a session_id.
- Uses an OpenAI-based support agent with a system prompt and 15-message conversation memory to answer directly when possible.
- When needed, calls a retrieval agent that searches the in-memory vector store for relevant facts and returns only sourced information.
- Formats the agent’s final output as plain text and returns it in the webhook response.
Setup
- Add OpenAI credentials for the embeddings node and both OpenAI chat model nodes.
- Create an HTTP Header Auth credential for the webhook and configure your chat client to send the same header and secret.
- Update the support agent system prompt placeholders (company name, website, contact details, hours, services, and locations).
- Enable the document upload form, open its form URL, and upload your PDFs/CSVs/TXTs to populate the knowledge base.
- Send POST requests to the webhook path
/support-chat-bot with a JSON body containing message and session_id.