AI WhatsApp Customer Support System using Gemini and Google Docs - n8n Workflow

Deploy a powerful n8n workflow to automate WhatsApp customer support. Uses Google Docs as a RAG knowledge base and Gemini AI for instant, context-aware replies, ensuring compliance with the 24-hour rule.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Companies seeking to automate first-line WhatsApp customer support.
Users looking for high-quality n8n templates integrating AI and communication platforms.
Businesses needing a reliable AI solution that adheres strictly to the 24-hour WhatsApp response window, using a conditional n8n node.
Automation specialists deploying complex RAG systems using the n8n node suite.

Overview

This sophisticated n8n workflow solves the crucial problem of providing instant, accurate customer support over WhatsApp while adhering to Meta's strict 24-hour window policy. This system leverages a live Google Doc as a dynamic knowledge base (RAG implementation), ensuring the AI responses are always based on the latest company information. By utilizing the n8n Langchain integration for the AI Agent and the Gemini model, users receive intelligent, personalized answers. This specific n8n workflow template uses WhapAround to simplify the connection process, bypassing the complex setup of the WhatsApp Business Cloud API. This robust automation ensures every incoming message is processed, context is maintained via session memory using an n8n node, and appropriate responses (message or template) are chosen depending on the timing, making this a highly valuable, production-ready n8n solution.

How it Works


  1. Incoming Message (n8n trigger): The process begins with the WhapAround - Listeing n8n node, acting as a webhook n8n trigger for new WhatsApp messages.

  2. Knowledge Retrieval: The company's knowledge Google Docs n8n node fetches the current content of the designated support document.

  3. Prompt Construction: The Prepare Prompt AI Transform n8n node formats the user's question, the current date, and the knowledge document into a highly structured finalPrompt for the AI.

  4. AI Generation: The AI Agent n8n node uses the input prompt, the Google Gemini Chat Model, and the Simple Memory n8n node (maintaining context via the user's wa_id) to generate the support response. This is the core logic of the n8n workflow.

  5. Timing Check: The 24-hour window check code n8n node analyzes the message timestamp to verify if the response is still within the mandated 24-hour service window.

  6. Conditional Response: The If n8n node branches the n8n workflow execution based on the timing check.

  7. Final Reply: If within the window, the cleanAnswer code n8n node sanitizes the text, and the WhapAround - Respond Message n8n node sends the direct reply. If outside the window, the n8n workflow routes the execution to the WhapAround - Respond Template n8n node for compliance.

Installation Guide


  1. Import the n8n workflow: Copy the provided JSON data and paste it directly into your n8n instance. This provides the foundational n8n templates logic.

  2. Set up WhapAround: Configure your webhook URL in your WhapAround account to point to the address generated by the WhapAround - Listeing n8n trigger node.

  3. Google Docs Credentials: Update the company's knowledge Google Docs n8n node with the correct Document ID for your knowledge base. Ensure necessary Google OAuth credentials are set up for this n8n node.

  4. AI Credentials: Connect your Gemini API key to the Google Gemini Chat Model n8n node connection.

  5. Testing: Execute the n8n workflow manually or send a test WhatsApp message to verify the complete automation loop.

Node Details

WhapAround - Listeing (Webhook n8n trigger): Initiates the n8n workflow upon receiving a WhatsApp message payload. This is the starting n8n trigger.
company's knowledge (Google Docs n8n node): Fetches the latest content from a specific Google Document ID, which acts as the dynamic knowledge base for the RAG system.
Prepare Prompt (AI Transform n8n node): Uses JavaScript to merge the user's question, the current date, and the large text body from the Google Doc into a single, cohesive prompt (finalPrompt).
Google Gemini Chat Model (Langchain n8n node): Configures the AI language model (Gemini 2.5 Flash), which powers the reasoning within the n8n workflow.
Simple Memory (Langchain n8n node): Maintains conversational history using the WhatsApp user ID (wa_id) as the session key, crucial for conversational AI within this n8n workflow.
AI Agent (Langchain n8n node): The core intelligence module. It processes the prompt, applies system instructions (acting as support staff), and generates the final answer.
24-hour window check (Code n8n node): A custom code n8n node that calculates the time elapsed since the user message to ensure WhatsApp compliance.
If (n8n node): A crucial flow control n8n node that routes the execution based on the withinWindow boolean.


  • cleanAnswer (Code n8n node): Cleans up the AI's output, removing markdown markers and unwanted introductory phrases to optimize the final WhatsApp message sent by this n8n workflow.

Related n8n Workflows

Free

Nodes: 12 Nodes
Updated: December 26 2025
View all
Created by

Elevating Human Well-being Through Accessible AI Technologies.

Featured*