Skip to main content

Build a document-upload RAG chatbot with OpenAI, Pinecone and daily analytics

Workflow preview

Workflow preview
100%
Build a document-upload RAG chatbot with OpenAI, Pinecone and daily analytics preview
Open on n8n.io

1. Workflow Overview

Overview This workflow implements a complete Retrieval Augmented Generation (RAG) knowledge assistant with built in document ingestion, conversational AI, and automated analytics using n8n, OpenAI,...

Best for

  • Internal Wiki automation workflows
  • AI RAG automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.formtrigger, n8n-nodes-base.set, n8n-nodes-base.datatable, @n8n/n8n-nodes-langchain.textsplitterrecursivecharactertextsplitter, @n8n/n8n-nodes-langchain.documentdefaultdataloader, @n8n/n8n-nodes-langchain.embeddingsopenai, @n8n/n8n-nodes-langchain.vectorstorepinecone, @n8n/n8n-nodes-langchain.chattrigger

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by ResilNext.

Original n8n.io source

1.1 Workflow description

Title
Build a document-upload RAG chatbot with OpenAI, Pinecone and daily analytics
Workflow name
Build a document-upload RAG chatbot with OpenAI, Pinecone and daily analytics

Overview

This workflow implements a complete Retrieval-Augmented Generation (RAG) knowledge assistant with built-in document ingestion, conversational AI, and automated analytics using n8n, OpenAI, and Pinecone.

The system allows users to upload documents, automatically convert them into embeddings, query the knowledge base through a chat interface, and receive daily reports about chatbot performance and document usage.

Instead of manually searching through documentation, users can ask questions in natural language and receive answers grounded in the uploaded files. The workflow retrieves the most relevant document chunks from a vector database and provides them to the language model as context, ensuring accurate and source-based responses.

In addition to answering questions, the workflow records all chat interactions and generates daily usage analytics. These reports summarize chatbot activity, highlight the most referenced documents, and identify failed lookups where information could not be found.

This architecture is useful for teams building internal knowledge assistants, documentation chatbots, AI support tools, or searchable company knowledge bases powered by Retrieval-Augmented Generation.


How It Works

  1. Document Upload Interface
  • Users upload PDF, CSV, or JSON files through a form trigger.
  • These documents become part of the knowledge base used by the chatbot.
  1. Document Processing
  • Uploaded files are loaded and converted into text.
  • The text is split into smaller chunks to improve embedding quality and retrieval accuracy.
  1. Embedding Generation
  • Each text chunk is converted into vector embeddings using the OpenAI Embeddings node.
  1. Vector Database Storage
  • The embeddings are stored in a Pinecone vector database.
  • This creates a searchable semantic index of the uploaded documents.
  1. Chat Interface
  • Users interact with the knowledge base through a chat interface.
  • Each message becomes a query sent to the RAG system.
  1. RAG Retrieval
  • The workflow retrieves the most relevant document chunks from Pinecone.
  • These chunks are provided to the language model as context.
  1. AI Response Generation
  • The chatbot generates an answer using only the retrieved document information.
  • This ensures responses remain grounded in the knowledge base.
  1. Chat Logging
  • User questions, AI responses, timestamps, and referenced documents are logged.
  • This enables monitoring and analytics of chatbot usage.
  1. Daily Analytics Workflow
  • A scheduled trigger runs every morning.
  • The workflow retrieves chat logs from the previous 24 hours.
  1. Report Generation
  • Usage statistics are calculated, including:
  • total questions asked
  • failed document lookups
  • most referenced documents
  • overall success rate.
  1. Email Summary
  • A formatted HTML report is generated and sent via email to provide a daily overview of chatbot activity and knowledge base performance.

Setup Instructions

  1. Configure Pinecone
  • Create a Pinecone index for storing document embeddings.
  • Enter the index name in the Workflow Configuration node.
  1. Add OpenAI Credentials
  • Configure credentials for:
  • OpenAI Chat Model
  • OpenAI Embeddings node.
  1. Configure Data Tables
  • Create the following n8n Data Tables:
  • form_responses
  • chat_logs
  1. Set Workflow Parameters
  • In the Workflow Configuration node configure:
  • Pinecone namespace
  • chunk size
  • chunk overlap
  • retrieval depth (top-K).
  1. Configure Email Notifications
  • Add Gmail credentials to send daily summary reports.
  1. Deploy the Workflow
  • Share the document upload form with users.
  • Enable the chat interface for question answering.

Use Cases

Internal Knowledge Assistant

Allow employees to search internal documentation using natural language questions.

Customer Support Knowledge Base

Provide instant answers from support manuals, product documentation, or help center articles.

Documentation Search Engine

Turn large document collections into an AI-powered searchable knowledge system.

AI Helpdesk Assistant

Enable support teams to quickly retrieve answers from company knowledge repositories.

Knowledge Base Analytics

Monitor chatbot usage, identify missing documentation, and understand which files are most valuable to users.


Requirements

  • n8n with LangChain nodes enabled
  • OpenAI API credentials
  • Pinecone account and index
  • Gmail credentials for sending reports
  • n8n Data Tables:
  • form_responses
  • chat_logs

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Document Upload Form

Type / Role
n8n-nodes-base.formTrigger - formTrigger
Config choices
Version 2.3

Block 2 - Workflow Configuration

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 3 - Store Form Responses

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1

Block 4 - Text Splitter

Type / Role
@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter - textSplitterRecursiveCharacterTextSplitter
Config choices
Version 1

Block 5 - Document Loader

Type / Role
@n8n/n8n-nodes-langchain.documentDefaultDataLoader - documentDefaultDataLoader
Config choices
Version 1.1

Block 6 - OpenAI Embeddings

Type / Role
@n8n/n8n-nodes-langchain.embeddingsOpenAi - embeddingsOpenAi
Config choices
Version 1.2

Block 7 - Pinecone Insert Documents

Type / Role
@n8n/n8n-nodes-langchain.vectorStorePinecone - vectorStorePinecone
Config choices
Version 1.3

Block 8 - Chat Trigger

Type / Role
@n8n/n8n-nodes-langchain.chatTrigger - chatTrigger
Config choices
Version 1.4

Block 9 - Chat Memory

Type / Role
@n8n/n8n-nodes-langchain.memoryBufferWindow - memoryBufferWindow
Config choices
Version 1.3

Block 10 - OpenAI Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.3

Block 11 - RAG Chatbot Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 3

Block 12 - Prepare Chat Log

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 13 - Log Chat Interactions

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1

Block 14 - Daily Summary Schedule

Type / Role
n8n-nodes-base.scheduleTrigger - scheduleTrigger
Config choices
Version 1.3

Block 15 - Get Chat Logs

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1

Block 16 - Analyze Chat Data

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 17 - Send Daily Summary Email

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.2

Block 18 - Pinecone Vector Store

Type / Role
@n8n/n8n-nodes-langchain.vectorStorePinecone - vectorStorePinecone
Config choices
Version 1.3

Block 19 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 20 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 21 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 22 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 23 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 24 - Sticky Note5

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Showing the first 24 of 29 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Build a document-upload RAG chatbot with OpenAI, Pinecone and daily analytics
Complexity advanced
Nodes 29
Categories Internal Wiki, AI RAG
Author ResilNext
Published 14 Mar 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/14041/14041.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Build a document-upload RAG chatbot with OpenAI, Pinecone and daily analytics do?

Overview This workflow implements a complete Retrieval Augmented Generation (RAG) knowledge assistant with built in document ingestion, conversational AI, and automated analytics using n8n, OpenAI,...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Internal Wiki, AI RAG use case.