RAG-Powered Sales Chatbot for WhatsApp - n8n Workflow

Deploy a powerful sales agent on WhatsApp using n8n. This advanced n8n workflow integrates OpenAI RAG capabilities with a PDF product catalog, leveraging the WhatsApp n8n trigger and AI Agent n8n node for real-time customer support.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Businesses looking to automate first-line customer service via WhatsApp.

  • Technical teams requiring an easy-to-deploy RAG system without dedicated backend coding.

  • Users searching for practical n8n templates utilizing the LangChain agent nodes.

  • Developers needing a reliable n8n workflow for processing PDF documents and integrating AI memory.

Overview

Providing instant, accurate answers to product inquiries is critical for modern sales teams. This n8n workflow solves the challenge of turning static marketing materials (like PDFs) into an interactive knowledge base accessible through a familiar channel: WhatsApp. By building a vector store from a product brochure, the AI Sales Agent can pull factual information and contextually relevant details, ensuring high-quality responses. This comprehensive n8n solution is split into two phases: first, creating the product catalog knowledge base, and second, deploying the live chatbot powered by the WhatsApp n8n trigger. This structure ensures your AI is always knowledgeable and your customer interactions are seamless.

How it Works

This robust n8n workflow operates in two distinct phases: Knowledge Base Creation and Live Chat Response.

Phase 1: Knowledge Base Creation (Run Once)


  1. Manual Start: The process begins with the 'When clicking ‘Test workflow’' n8n trigger, initiating the KB setup.

  2. Data Acquisition: The 'get Product Brochure' HTTP Request n8n node downloads the marketing PDF (e.g., Yamaha Loudspeaker brochure).

  3. Text Extraction: The 'Extract from File' n8n node extracts all raw text content from the binary PDF data.

  4. Preprocessing: The text is segmented into chunks using the 'Recursive Character Text Splitter' and loaded by the 'Default Data Loader'.

  5. Vectorization: The 'Embeddings OpenAI1' n8n node converts these text chunks into vectors.

  6. Storage: The 'Create Product Catalogue' In-Memory Vector Store n8n node inserts these vectors, establishing the knowledge base available to the AI Agent.

Phase 2: Live Chat Response (Active Workflow)


  1. Incoming Message: The 'WhatsApp Trigger' n8n trigger listens for new messages from customers.

  2. Message Filtering: The 'Handle Message Types' Switch n8n node checks the message type. If it's not a standard text message, it routes to a generic 'Reply To User1' WhatsApp n8n node.

  3. AI Processing: If the message is text, it passes to the 'AI Sales Agent' n8n node.

The Agent uses the 'OpenAI Chat Model' (GPT-4o) for reasoning.
'Window Buffer Memory' maintains the conversation history specific to the user, identified by the WhatsApp phone number session key.
* The 'Vector Store Tool' gives the Agent access to the pre-built 'Product Catalogue' vector store, enabling RAG.

  1. Final Reply: The Agent’s detailed, factual output is captured and sent back to the customer using the 'Reply To User' WhatsApp n8n node.

Installation Guide

To utilize this complex n8n workflow template, follow these steps:


  1. Import the n8n Workflow: Copy the provided JSON data and import it directly into your n8n instance.

  2. Set Up Credentials: You will need credentials for:

WhatsApp Trigger: Requires a Meta Developers account configured for the WhatsApp Cloud API webhook. This is essential for the n8n trigger.
WhatsApp Node: Requires separate API credentials for sending messages back to users.
* OpenAI: Requires an OpenAI API Key for both the Chat Models (GPT-4o) and the Embeddings Models (text-embedding-3-small).

  1. Initialize Knowledge Base: Locate the starting 'When clicking ‘Test workflow’' n8n node. Run the workflow once (using 'Test workflow') to execute Phase 1, downloading the PDF, creating the embeddings, and populating the 'Product Catalogue' vector store.

  2. Activate: Once the vector store is populated and all credentials are set, activate the entire n8n workflow to enable the 'WhatsApp Trigger' to start listening for live customer messages.

Node Details

This n8n workflow makes heavy use of LangChain nodes for advanced AI functionality:

WhatsApp Trigger: The starting n8n trigger, configured to listen specifically for messages updates. It passes the incoming message and sender details to the flow.
HTTP Request (get Product Brochure): Used to programmatically fetch the external PDF document containing the product catalog data. This flexible n8n node handles the initial data retrieval.
Extract from File: Essential for RAG, this n8n node parses the binary PDF data to extract the readable text, preparing it for vectorization.
Recursive Character Text Splitter: Splits the large text document into manageable chunks (configured for 2000 characters) to ensure efficient embedding and retrieval.
Create Product Catalogue (Vector Store In-Memory): This n8n node inserts the vector data. Key setting: memoryKey: whatsapp-75 and mode: insert with clearStore: true on initialization.
Handle Message Types (Switch): A core logic n8n node that routes the execution based on the incoming message type from the n8n trigger payload. It only allows 'text' type messages to proceed to the AI Agent.
AI Sales Agent (Agent): The brain of the operation. It uses GPT-4o and is configured with a detailed system message defining its advisory role. It ties together the memory and tool systems.
Window Buffer Memory: Maintains stateful conversations by using the recipient's phone number to create a unique sessionKey, allowing the AI Agent n8n node to remember previous dialogue.
Vector Store Tool (queryproductbrochure): This tool allows the AI Agent to access the 'Product Catalogue' vector store, retrieving relevant snippets to answer specific product questions factually.
WhatsApp Node (Reply To User): The final action n8n node, responsible for sending the Agent's generated response back to the customer using the extracted recipient phone number.

Related n8n Workflows

Free

Nodes: 15 Nodes
Updated: December 26 2025
View all
Created by
Jimleuk
Jimleuk

Freelance consultant based in the UK specialising in AI-powered automations. I work with select clients tackling their most challenging projects. For business enquiries, send me an email at [email protected] LinkedIn: https://www.linkedin.com/in/jimleuk/ X/Twitter: https://x.com/jimle_uk

Featured*