Activate this automation on N8nPort with one click
We have completed the workflow installation, node configuration, and setup for you, so the automation is ready to activate without a manual import or node-by-node configuration.
Quick answers
What does this workflow do?
Automate WhatsApp customer service with AI. This n8n workflow handles FAQs, processes orders, tracks shipments, and escalates to human support using GPT-4o, Pinecone, and Google Sheets.
Which apps does this workflow use?
It uses Agent, Document Default Data Loader, Embeddings Open Ai, Google Drive, Google Drive Trigger, Google Sheets, Lm Chat Open Ai, Open Ai, Slack, Text Splitter Character Text Splitter, Tool Vector Store, Vector Store Pinecone, Whats App, and Whats App Trigger. Review each connected app before activation.
What credentials do you need?
You need Google Drive OAuth2, Google Sheets OAuth2, Open Ai API, OpenAI API key, Pinecone API, Slack API, and Slack OAuth2. Add them in your workspace without placing secrets in the workflow JSON.
This n8n workflow creates an AI-powered WhatsApp business assistant. It automatically responds to customer messages, classifies their intent, and routes requests to handle frequently asked questions, process product orders, provide order tracking updates, or escalate to a human support team.
Quick Overview
The workflow uses AI to understand WhatsApp messages, then directs them to the right process. For FAQs, it taps into a knowledge base. For orders, it extracts details, checks stock, and records the order. It can also find and share order status. If a request is complex, it notifies a human support team via Slack.
Key Questions
What kind of WhatsApp messages can this AI assistant handle?
This AI assistant can handle customer inquiries related to frequently asked questions (FAQs), new product orders, and requests for order tracking information.How does the workflow manage product orders and inventory?
The workflow extracts product and quantity details from messages, matches them against a product catalog in Google Sheets, checks inventory availability, creates new order records, and updates stock levels.What happens if the AI cannot answer a customer's question?
If the AI cannot confidently address a customer's query, the workflow escalates the conversation by sending the customer's details and message to a human support team via Slack.How does the AI assistant access its knowledge for FAQs?
The AI assistant uses a Retrieval-Augmented Generation (RAG) system with a Pinecone vector database, which stores embeddings of business documents from Google Drive to answer FAQs.
What This Workflow Does
This workflow acts as a detailed AI-driven WhatsApp business assistant. It starts by receiving incoming WhatsApp messages from users. It then uses AI to classify the user's intent into categories like FAQ, ORDER, TRACK_ORDER, or HUMAN_SUPPORT. Based on this classification, the workflow directs the message to the appropriate processing path.
For FAQs, it retrieves answers from a knowledge base. For order requests, it extracts product details, checks inventory, and manages the order process. For tracking requests, it fetches order status. If the AI cannot handle a request, it routes the message to a human support team.
How It Works
The workflow operates through several interconnected stages, each handling a specific aspect of customer interaction:
WhatsApp Message Intake
The process begins with a WhatsApp Incoming Message Trigger, which listens for new messages. Once a message arrives, the workflow extracts key details such as the sender's phone number, the message content, and a timestamp. This standardizes the incoming data for consistent processing.
AI Intent Classification
An OpenAI node, specifically using GPT-4o, classifies the user's intent. It determines if the message is an FAQ, an ORDER, a TRACK_ORDER request, or if it requires HUMAN_SUPPORT. A subsequent code node parses this AI response, ensuring the intent and a confidence score are clearly identified.
Intent-Based Request Routing
A Switch node then acts as a router, directing the message to one of four main branches based on the classified intent:
FAQ: For general questions.
ORDER: For requests to purchase products.
TRACK_ORDER: For inquiries about existing orders.
HUMAN_SUPPORT: For complex or unclassifiable requests.
FAQ & Knowledge Base Assistant
When an FAQ intent is detected, an AI Agent node uses an OpenAI language model (GPT-4o) and a Pinecone vector store to answer questions. This system, known as Retrieval-Augmented Generation (RAG), retrieves relevant information from a stored knowledge base. The knowledge base itself is updated automatically: a Google Drive Trigger monitors a specific document for changes. When a change occurs, the document is downloaded, split into smaller chunks by a Text Splitter, and then converted into numerical embeddings by an OpenAI Embeddings node. These embeddings are stored in Pinecone, making the knowledge searchable by the AI.
The AI Agent uses a Conversation Memory Manager to maintain context during the chat. Finally, a WhatsApp node sends the AI-generated, short, and friendly response back to the user.
Order Extraction & Product Understanding
If the intent is ORDER, another OpenAI node (GPT-4o) extracts product and quantity information from the message. A code node then parses this into a structured JSON format. The workflow fetches the product catalog from a Google Sheets document. An AI Semantic Product Matcher (OpenAI GPT-4o) compares the customer's requested product with the catalog, accounting for spelling mistakes and synonyms, to find the closest match. A code node validates this match and retrieves full product details, including stock levels.
Inventory Validation & Order Processing
An If node checks if the requested quantity is available in stock. If there's enough stock, the workflow creates a new order record in a Google Sheets 'Orders' tab and updates the product's stock level in the 'Products' tab. A WhatsApp node then sends an order confirmation message to the customer. If stock is insufficient or the product isn't found, a different WhatsApp message informs the customer about the issue.
Order Tracking System
For a TRACK_ORDER intent, an OpenAI node (GPT-4o) extracts the order ID from the user's message. A code node parses this ID. The workflow then queries the Google Sheets 'Orders' tab to fetch the status of that specific order. A WhatsApp node sends the order status back to the customer.
Human Support Escalation
If the AI classifies the intent as HUMAN_SUPPORT, or if the AI's confidence is low, the workflow escalates the request. It sends a notification to a designated Slack channel, including the customer's phone number, original message, and timestamp. Simultaneously, a WhatsApp node sends an acknowledgment message to the customer, letting them know a human agent will assist them.
Ready to automate?
The complete installation and configuration are already prepared for your workspace. Activate the preconfigured workflow on N8nPort with one click.
Prerequisites
To set up and use this workflow, you will need access to and credentials for the following services:
WhatsApp: For sending and receiving messages.
OpenAI: For various AI tasks like intent classification, data extraction, semantic matching, and generating responses.
Pinecone: To store and retrieve knowledge base embeddings for FAQ responses.
Google Sheets: To manage your product catalog and customer orders.
Google Drive: To host your business knowledge documents for the AI's FAQ system.
Slack: For human support team notifications.
Required Credentials
You will need to configure the following credentials within your n8n instance:
Google Drive OAuth2: To allow n8n to access and download documents from Google Drive.
Google Sheets OAuth2: To enable n8n to read from and write to your Google Sheets documents for product and order management.
Open Ai API: For connecting to OpenAI's services for AI processing.
OpenAI API key: Another credential type for OpenAI services, used across multiple AI nodes.
Pinecone API: To connect to your Pinecone vector database for knowledge retrieval.
Slack API: For sending messages and notifications to your Slack workspace.
Slack OAuth2: An alternative or additional method for Slack integration.
How Do You Set It Up?
Setting up this workflow involves configuring each service and connecting them within n8n. Here are the general steps:
Configure WhatsApp: Set up your WhatsApp Cloud API credentials in n8n to enable message sending and receiving.
Connect OpenAI: Provide your OpenAI API credentials for all AI processing nodes, including intent classification, order extraction, and response generation.
Configure Google Sheets: Set up Google Sheets credentials. You will need two specific sheets: one for your 'Products' catalog and another for 'Orders'. Ensure these sheets are correctly structured with relevant columns (e.g., product_name, stock, order_id, status).
Create and Connect Pinecone: Create a Pinecone index and configure its API credentials in n8n. This index will store your knowledge base embeddings.
Connect Google Drive: Set up Google Drive credentials. Designate a specific Google Drive document to serve as your AI knowledge base. The workflow will monitor this document for changes.
Configure Slack: Set up Slack credentials. Identify the Slack channel where human support requests should be sent.
Upload Business Knowledge: Place your business knowledge documents (e.g., FAQs, product details) into the designated Google Drive file. The workflow's background pipeline will automatically process and embed this information into Pinecone.
Activate and Test: Once all credentials and configurations are in place, activate the workflow. Test various scenarios, including asking FAQs, placing orders, tracking orders, and sending messages that should trigger human support escalation, to ensure everything works as expected.
What Can You Customize?
You can tailor several aspects of this workflow to fit your specific business needs:
AI Prompts: Adjust the system messages and prompts within the OpenAI nodes to refine intent classification, order extraction, product matching, and FAQ responses.
Knowledge Base Content: Update your Google Drive knowledge document with new FAQs, product information, or business policies. The workflow will automatically re-embed this data.
Google Sheets Structure: Modify the columns in your 'Products' and 'Orders' Google Sheets to include additional data relevant to your business.
Order Confirmation Messages: Customize the WhatsApp messages sent for order confirmations, out-of-stock notifications, and order status updates.
Slack Notifications: Change the content and target channel for human support escalation messages in Slack.
AI Model: While GPT-4o is used, you might explore other compatible OpenAI models if available and suitable for specific tasks.
Limitations and Troubleshooting
This workflow relies on external services, and their availability and performance can affect its operation. Ensure all API keys and OAuth connections are current and correctly configured. Issues with AI responses might stem from prompt design or the quality of the knowledge base documents. If the workflow isn't responding as expected, check the execution logs in n8n for specific error messages. Verify that your Google Sheets are accessible and correctly formatted, and that your Pinecone index is active and populated with embeddings.
Frequently Asked Questions
Can this workflow handle multiple languages?
The workflow is designed for English content. Adapting it for other languages would require adjusting AI prompts and potentially the knowledge base content.How often does the knowledge base update from Google Drive?
The Google Drive Trigger is configured to check for file changes every minute, ensuring the knowledge base stays relatively current.Is there a way to add more product categories to the order system?
Yes, you can expand your product catalog in Google Sheets to include more categories and product details. The AI's semantic matching can adapt to new product information.What if a customer asks for a product that isn't in the catalog?
The AI Semantic Product Matcher is designed to return 'NOT_FOUND' if it cannot identify a close match. The workflow then sends an appropriate message to the customer, indicating the product was not found.
How does the AI classify user intent?
The workflow uses an OpenAI node with GPT-4o to analyze incoming WhatsApp messages and categorize them into specific intents like FAQ, ORDER, TRACK_ORDER, or HUMAN_SUPPORT based on the message content.
What kind of information should be in the Google Sheets for products and orders?
The 'Products' sheet should include details like product name, ID, price, and stock. The 'Orders' sheet should track order ID, customer phone number, product, quantity, and status.
Can I use a different AI model instead of GPT-4o?
The workflow is configured to use GPT-4o. While n8n supports various AI models, changing it would require modifying the specific OpenAI nodes within the workflow.
How does the workflow handle low stock situations?
Before confirming an order, the workflow checks the product's stock level in Google Sheets. If the requested quantity exceeds available stock, it sends an out-of-stock message to the customer instead of processing the order.
What is the purpose of Pinecone in this workflow?
Pinecone serves as a vector database to store numerical representations (embeddings) of your business knowledge documents. This allows the AI to perform semantic searches and retrieve relevant information quickly for FAQ responses.
What should you check before activation?
Confirm the node settings and connect Google Drive OAuth2, Google Sheets OAuth2, Open Ai API, OpenAI API key, Pinecone API, Slack API, and Slack OAuth2 in your workspace. Keep secrets out of the workflow JSON.
Can you customize this workflow?
Yes. You can change its triggers, field mappings, conditions, and destination settings to match your process. Review every affected node after a change.
Where can you review the original workflow?
Review the source workflow on n8n.io at https://n8n.io/workflows/16175.
Source and Next Steps
This workflow was originally published by n8n.io. You can find the source workflow and learn more about its design and capabilities here: n8n.io/workflows/16175.
To implement this solution, review the setup steps, gather your credentials, and begin configuring each node within your n8n instance.
Activate this workflow on N8nPort
Choose your workspace and activate the fully prepared automation with one click.