AI Sales Agent using WhatsApp, Google Drive, and Pinecone - n8n Workflow

Build a sophisticated RAG-powered WhatsApp bot with this n8n workflow. Automatically synchronize knowledge from Google Drive into Pinecone and respond instantly using GPT-4o-mini.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Small to Medium Businesses (SMBs): Who need an instant, 24/7 customer service or sales assistant without building a custom API.
Technical Developers: Seeking ready-made n8n templates for advanced RAG implementations.
Sales Teams: Wanting an automated assistant that can provide accurate, up-to-date product information based on internal documents.
n8n Users: Looking to integrate LangChain nodes and custom webhooks for real-time messaging automation.

Overview

This comprehensive n8n workflow solves the problem of keeping an AI agent's knowledge accurate and accessible in real-time, specifically within a high-volume messaging platform like WhatsApp. The automation is split into two critical parts: Knowledge Indexing and Live Chat Automation.

The first part uses an n8n trigger (Google Drive) to constantly monitor and update the Pinecone vector database when source documents change, ensuring the AI always has the latest information. The second part is a responsive WhatsApp chatbot built around an advanced RAG model (Retrieval-Augmented Generation). The custom configuration of the Agent n8n node ensures that the AI maintains a professional, goal-oriented sales persona, making this a highly effective business solution. This structure makes it one of the most powerful n8n templates available for real-time customer engagement.

How it Works

The n8n workflow operates in two distinct, interconnected pipelines:

Pipeline 1: Automated Knowledge Base Indexing (RAG Setup)


  1. Google Drive Trigger: The workflow starts with an n8n trigger that checks a specific Google Drive file every minute. If the file is updated, the pipeline proceeds.

  2. Download and Load: The document is downloaded from Google Drive and processed by the Default Data Loader n8n node.

  3. Chunking and Embedding: The Recursive Character Text Splitter breaks the large document into smaller, manageable chunks (3000 characters with 200 overlap). The Embeddings OpenAI n8n node then converts these text chunks into dense vector representations.

  4. Pinecone Indexing: Finally, the Index Pinecone Vector Store n8n node inserts these vectors into the designated Pinecone index, clearing the previous namespace to maintain data hygiene.

Pipeline 2: Real-Time WhatsApp Q&A


  1. WhatsApp Webhook Trigger: The Live Chat automation begins with a custom Listen to Whatsapp webhook n8n trigger, which activates upon receiving a new WhatsApp message.

  2. Filtering: An If n8n node checks if the message is an individual chat. (Note: The workflow is designed to support both individual and group chats, replying only when tagged in groups).

  3. Query Preparation: A Set n8n node defines the maximum number of chunks (4) to retrieve. The incoming user message is then embedded using a second Embeddings OpenAI n8n node.

  4. Vector Retrieval: The Get top chunks matching query Pinecone n8n node uses the embedded query to retrieve the 4 most relevant chunks of data from the knowledge base.

  5. Context Assembly: A Code n8n node (Prepare chunks) formats the retrieved vector context into a clean string, ready for the LLM.

  6. AI Response Generation: The Question & Answer Agent n8n node (using GPT-4o-mini via the OpenAI Chat Model n8n node) takes the user's question, the retrieved context, and conversation history (managed by the Simple Memory n8n node) and generates a detailed, sales-oriented response based on the extensive system prompt.

  7. Final Response: The Respond to Whatsapp Webhook n8n node sends the AI-generated answer back to the user instantly.

Installation Guide

To deploy this powerful n8n workflow, follow these steps:


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

  2. Google Drive Credentials: Set up your Google Drive Service Account credentials and link them to both the Google Drive Trigger n8n node and the Download file n8n node.

  3. OpenAI Credentials: Configure your OpenAI API Key and connect it to both Embeddings OpenAI n8n nodes and the OpenAI Chat Model n8n node.

  4. Pinecone Setup: Create a Pinecone index with 1536 dimensions. Set up your Pinecone API credentials and connect them to both Pinecone Vector Store n8n nodes, ensuring the correct index name (3vansales in this template) is selected.

  5. Custom WhatsApp Webhook: This n8n workflow requires a non-standard WhatsApp webhook service. Follow the instructions in the sticky note to request access and obtain the necessary Webhook URL and path.

  6. Configuration: Update the Google Drive Trigger n8n node with the ID of your specific knowledge document. Customize the detailed system message in the Question & Answer n8n node to define your AI agent's personality and goals.

  7. Activation: Once all credentials and configurations are set, activate the workflow. The Google Drive n8n trigger will begin monitoring your knowledge base, and the WhatsApp n8n trigger will be ready to receive messages.

Node Details

Every minute check if file is updated (Google Drive Trigger n8n trigger):
Function: The primary n8n trigger for the indexing pipeline. It continuously monitors a specific document ID in Google Drive for changes.
Key Configuration: triggerOn: 'specificFile'; pollTimes: 'everyMinute'. This ensures the RAG knowledge base is always fresh.
Index Pinecone Vector Store (n8n node):
Function: Handles data persistence, inserting embedded document chunks into the Pinecone index (3vansales).
Key Configuration: mode: 'insert'; options.clearNamespace: true (This flushes the old data before inserting new, crucial for consistency).
Listen to Whatsapp webhook (Webhook n8n trigger):
Function: The entry point for live interactions. It listens for POST requests containing incoming WhatsApp message data.
Key Configuration: responseMode: 'responseNode'; requires a specific custom webhook path.
Get top chunks matching query (Pinecone Vector Store n8n node):
Function: Performs the vector similarity search, retrieving the most relevant context chunks for the user's query.
Key Configuration: mode: 'load'; topK: 4; prompt: The embedded user message.
Question & Answer (LangChain Agent n8n node):
Function: The core decision-making and generation engine. It combines context, memory, and the LLM to generate the final response.
Key Configuration: Contains a highly detailed systemMessage defining the AI agent's identity, tone (friendly, professional sales agent for GrayBox), key behaviors (e.g., pricing starts at 3 million IDR/m²), and conversion links. It explicitly uses the context variable prepared by upstream n8n nodes.
Simple Memory (LangChain Memory n8n node):
Function: Stores conversation history to maintain conversational context.
Key Configuration: sessionKey: ={{ $json.fromNumber }}. Uses the sender's phone number to uniquely identify and track each user's conversation thread.

Related n8n Workflows

Free

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

Featured*