Imagine a customer calls your store on a Friday evening asking about their order status—but your team has already left for the weekend. The phone rings unanswered. The customer leaves frustrated and takes their business elsewhere. This scenario plays out thousands of times every day in e-commerce. Now imagine if your WooCommerce store had a tireless AI agent that could answer customer calls 24/7, look up orders, provide tracking information, and answer FAQs using your own knowledge base—all through a simple phone call.
Prefer to skip the setup? Grab the ready-made template → and be up and running in under 10 minutes.
In this guide, you’ll learn how to build exactly that: a voice AI customer support system that combines multiple cutting-edge AI technologies (VAPI for voice, GPT-4o-mini for intelligent conversations, Gemini for knowledge retrieval, and Qdrant for vector search) with n8n as the orchestration engine. By the end, you’ll have a fully functional voice assistant that handles post-sales support and product questions.
What You’ll Build
This n8n workflow creates a complete voice AI customer support solution with two primary flows:
- Post-Sales Agent Flow — A GPT-4o-mini powered conversational agent that customers can call to ask about their orders. It verifies identity using email and order number, retrieves real-time order information from WooCommerce, fetches tracking details via a sub-workflow, and speaks the results back to the caller through VAPI.
- RAG Q&A Flow — A Retrieval-Augmented Generation system using Google Gemini 1.5 Flash that searches a Qdrant vector database for product information, policies, and FAQs, delivering contextual answers directly to customers asking product questions.
- Tracking Sub-Workflow — A helper workflow that queries the WooCommerce REST API using the YITH tracking plugin to extract shipping carrier URLs, tracking codes, and pickup dates.
All three flows are triggered via webhooks from VAPI, your voice AI platform, and connected to Twilio phone numbers for inbound calling.
The Big Picture: How It All Works Together
Here’s a visual representation of the system architecture:
┌────────────────────────────────────────────────────────────────────┐
│ CUSTOMER CALLS TWILIO NUMBER │
└──────────────────────────────┬──────────────────────────────────────┘
│
▼
┌───────────────────────┐
│ VAPI Voice AI │
+ │ (Processes Speech) │
└───────┬───────┬───────┘
│ │
┌────────┘ └────────┐
▼ ▼
┌──────────────────────────┐ ┌──────────────────────┐
│ POST-SALES AGENT FLOW │ │ RAG Q&A FLOW │
│ (Order Lookups) │ │ (Product Questions) │
└────────┬─────────────────┘ └──────────┬───────────┘
│ │
▼ ▼
┌──────────────────────────┐ ┌──────────────────────┐
│ n8n Post-Sales Webhook │ │ n8n RAG Webhook │
│ │ │ │
│ 1. GPT-4o-mini Agent │ │ 1. Question & Answer │
│ 2. WooCommerce API Call │ │ 2. Gemini 1.5 Flash │
│ 3. Tracking Sub-Workflow │ │ 3. Qdrant Vector DB │
│ 4. Format Response │ │ 4. Return Response │
└────────┬─────────────────┘ └──────────┬───────────┘
│ │
└────────────┬──────────────────┘
▼
┌─────────────────────┐
│ VAPI Returns Audio │
│ to Caller │
└─────────────────────┘
Prerequisites
Before you start building, make sure you have access to these services and accounts:
- WooCommerce Store — A working WooCommerce installation with REST API enabled. We’ll authenticate using API keys (Consumer Key & Consumer Secret).
- VAPI Account — Sign up at vapi.ai to create voice assistants. You’ll need to create tools that point to your n8n webhooks.
- Twilio Account — Create a Twilio account to provision inbound phone numbers. VAPI integrates directly with Twilio.
- OpenAI API Key — For GPT-4o-mini and OpenAI embeddings. Ensure you have billing enabled.
- Google Gemini API Key — For the Gemini 1.5 Flash model used in the RAG flow.
- Qdrant Vector Database — Either a cloud Qdrant instance or self-hosted. You’ll need the API key and collection name with pre-populated embeddings.
- n8n Instance — Cloud or self-hosted n8n with execution enabled.
- YITH WooCommerce Order Tracking Plugin — Free plugin to store tracking metadata. Install it on your WordPress site.
Building Flow 1: Post-Sales Agent
The post-sales agent handles customer calls asking about their orders. Here’s how to build it step-by-step:
Step 1: Create the VAPI Post-Sales Webhook
Start with a webhook node that receives requests from VAPI. This node waits for incoming POST requests containing customer data (email address and order number) sent by VAPI when a customer calls the dedicated phone number.
In n8n, add a Webhook node and configure it as follows:
- Set HTTP Method to
POST - Set Response Mode to
responseNode(we’ll send the response later from a dedicated response node) - Copy the webhook URL to use in VAPI later
Tip: The webhook path is auto-generated. Note it down—you’ll paste this URL into VAPI’s tool configuration.
Step 2: Add the GPT-4o-mini Agent Node
The agent is the brain of your post-sales support system. It’s a GPT-4o-mini powered node with tools that can look up orders, retrieve customer information, and get tracking details.
Add an Agent node (type: @n8n/n8n-nodes-langchain.agent) and configure:
- Language Model: Connect your OpenAI credentials and select
gpt-4o-mini - Input Text: Set to
={{ $json.body.email }} and {{ $json.body.n_order }}to pass the customer email and order number from the webhook - System Message: Paste a detailed prompt telling the agent its role, how to verify customer identity, and which tools to use (see the workflow for the full prompt)
The system message is critical. It instructs the agent to:
- Always verify that the email matches the order number
- Refuse to share order details if the email is incorrect
- Use available tools (get_order, get_orders, get_user, get_tracking, Calculator) to answer questions
- Provide clear, professional responses suitable for voice output
Step 3: Connect Tool Nodes for Order Lookup
The agent needs tools to retrieve information. Add four WooCommerce tool nodes:
get_order Node: Retrieves a single order by ID.
- Resource:
order - Operation:
get - Order ID: Leave this for the agent to fill dynamically via
$fromAI() - Connect WooCommerce credentials with your store URL/li>
get_orders Node: Searches for multiple orders (e.g., by customer email).
- Resource:
order - Operation:
getAll - Search: Leave for agent to fill via
$fromAI()
get_user Node: Retrieves customer profile information by email.
- Resource:
customer - Operation:
getAll - Filter by Email:
={{ $fromAI('Email', '', 'string') }}
Calculator Node: Allows the agent to perform math (e.g., calculate shipping costs, discounts). Use the built-in calculator tool from LangChain.
Connect all four of these nodes to the agent’s ai_tool output.
Security Note: The agent’s system prompt includes strict identity verification logic. Always ensure that order details are only shared after email verification. Never allow the agent to bypass this check.
Step 4: Add the Tracking Sub-Workflow Tool
Instead of querying WooCommerce directly for tracking, we call a separate workflow using a tool workflow node. This keeps your main workflow clean and allows the tracking sub-workflow to be tested independently.
Add a Tool Workflow node (type: @n8n/n8n-nodes-langchain.toolWorkflow):
- Name:
get_tracking - Workflow ID: Select the tracking sub-workflow (you’ll create this in the next section)
- Description: “Get tracking number for a specific order by providing the order number. The tool retrieves the unique tracking code that allows customers to monitor their shipment’s current status and location.”
- Input Schema: Define one input parameter:
order_number(string)
Connect this to the agent’s ai_tool output as well.
Step 5: Format and Return the Response
After the agent generates an answer, format it and send it back to VAPI.
Add a Set node to extract the agent’s output message:
- Assignment: Set a field called
messageto={{ $json.output }}
Then add a Respond to Webhook node:
- This sends the JSON response back to VAPI with the agent’s message
- VAPI will convert this text to speech and play it to the caller
Building Flow 2: RAG Q&A System
The second flow handles customer questions about products, policies, and FAQs by searching your knowledge base. Here’s how to build it:
Step 1: Create the RAG Webhook
Add another Webhook node for the RAG flow:
- HTTP Method:
POST - Response Mode:
responseNode - Path: Give it a distinct path like
rag-webhook
This webhook will receive search queries from VAPI when customers ask product questions.
Step 2: Add the Question & Answer Chain
Add a Chain Retrieval QA node (type: @n8n/n8n-nodes-langchain.chainRetrievalQa):
- Input Text:
={{ $json.body.search }}to use the search query from VAPI - System Prompt Template: Set a prompt that instructs the model to use retrieved context to answer questions. Example: “You are an assistant for question-answering tasks. Use the following pieces of retrieved context to answer the question. If you don’t know the answer, just say that you don’t know.”
- Prompt Type:
define
This node will automatically search the vector store and synthesize an answer based on retrieved documents.
Step 3: Connect the Language Model (Gemini 1.5 Flash)
Add a Chat Google Gemini node (type: @n8n/n8n-nodes-langchain.lmChatGoogleGemini):
- Model:
models/gemini-1.5-flash(the fastest and most cost-effective Google model) - Add your Google Gemini API credentials
Connect this to the Question & Answer Chain’s ai_languageModel input.
Step 4: Set Up Vector Store Retrieval
Add a Vector Store Retriever node (type: @n8n/n8n-nodes-langchain.retrieverVectorStore):
- Top K:
5(retrieve the 5 most relevant documents)
Connect this to the Question & Answer Chain’s ai_retriever input.
Step 5: Connect Qdrant Vector Store
Add a Qdrant Vector Store node (type: @n8n/n8n-nodes-langchain.vectorStoreQdrant):
- Add your Qdrant API credentials
- Collection: Select the collection name containing your product embeddings (e.g., “product-knowledge”)
Connect this to the Vector Store Retriever’s ai_vectorStore input.
Step 6: Add OpenAI Embeddings
Add an Embeddings OpenAI node (type: @n8n/n8n-nodes-langchain.embeddingsOpenAi):
- Add your OpenAI API credentials
- This generates embeddings for the search query to match against your Qdrant collection
Connect this to the Qdrant Vector Store’s ai_embedding input.
Tip: Make sure your Qdrant collection was populated with embeddings from the same OpenAI model (text-embedding-3-small or similar). Mismatched embeddings will give poon search results.
Step 7: Return RAG Response
Add a Respond to Webhook node to send the RAG answer back to VAPI. The Question & Answer Chain’s output will automatically include the synthesized answer in $json.output.
Building the Tracking Sub-Workflow
The tracking sub-workflow is a separate workflow that the main workflow calls. This keeps your logic modular and testable. Here’s how to build it:
Step 1: Add Workflow Trigger
Create a new workflow and add an Execute Workflow Trigger node (type: n8n-nodes-base.executeWorkflowTrigger):
- Input Source:
jsonExample - JSON Example:
{ "order_number": "order number" }
This allows the main workflow to pass an order number to this sub-workflow.
Step 2: Query WooCommerce REST API
Add an HTTP Request node:
- Method:
GET - URL:
https://YOUR_STORE_URL/wp-json/wc/v3/orders/{{ $json.order_number }} - Authentication: Use HTTP Basic Auth with your WordPress credentials
This fetches the full order object from WooCommerce, including the meta_data field where YITH stores tracking information.
Step 3: Extract Tracking Details
Add a Set node to parse the tracking metadata:
Assignments: - tracking_code: $json["meta_data"].find(item => item.key === "ywot_tracking_code").value - carrier_url: $json["meta_data"].find(item => item.key === "ywot_carrier_url").value - pick_up: $json["meta_data"].find(item => item.key === "ywot_pick_up_date").value
These fields come from the YITH plugin’s meta data structure. The agent will use these fields to provide tracking links and pickup information to customers.
Important: Make sure the YITH plugin is installed and configured on your WooCommerce store. If the meta_data fields don’t exist, this node will error. Test with a real order that has tracking information.
VAPI Configuration: Connecting Voice to Your Workflows
Now that your n8n workflows are built, connect them to VAPI so that incoming phone calls trigger the workflows.
Step 1: Create API Request Tools in VAPI
Log in to your VAPI dashboard and navigate to the Tools section.
Create Tool 1: WooCommerce Order Lookup
- Tool Type:
API Request - Name:
Check Order Status - Request Method:
POST - Request URL: Paste the webhook URL from your VAPI Post-Sales Webhook node
- Request Body Format: JSON
- Parameters:
- Name:
email, Type:string, Description: “Customer’s email address” - Name:
n_order, Type:string, Description: “Order number to look up”
Create Tool 2: Product Knowledge RAG
- Tool Type:
API Request - Name:
Search Product Knowledge - Request Method:
POST - Request URL: Paste the webhook URL from your RAG Webhook node
- Request Body Format: JSON
- Parameters:
- Name:
search, Type:string, Description: “Search query for product information, policies, or FAQs”
Step 2: Create or Update Your Voice Assistant
In VAPI, go to the Assistants section and create a new assistant or edit an existing one:
- Name: “WooCommerce Support Agent”
- Model: Select your preferred model (GPT-4 Turbo, Claude, etc.)
- System Prompt: Craft a prompt that tells the voice assistant to greet customers, explain the available tools, and guide them to either check their order status or ask product questions. Example:
“You are a friendly customer support agent for an online store. When someone calls, greet them warmly and ask whether they want to (1) check on an existing order by providing their order number and email, or (2) ask a product question. Use the appropriate tool based on their request.”
- Voice: Choose a voice under the Voice tab (e.g., “Alloy” for a neutral tone, “Juniper” for friendliness)
- Tools: In the Tools tab, add the two tools you created above
Step 3: Set Up Twilio Phone Number
In your VAPI dashboard, go to Phone Numbers and either:
- Create a new phone number with VAPI (it provisions through Twilio), or
- Import an existing Twilio phone number into VAPI
Configure the phone number as “Inbound” and associate it with your WooCommerce Support Assistant.
Once configured, any call to this number will trigger your VAPI assistant, which will prompt the caller, and route requests to your n8n workflows via the webhooks.
Tip: Test the end-to-end flow by calling the Twilio number from your phone. Listen for the greeting, and try asking about an order or a product question. Check your n8n execution logs to debug any issues.
Testing and Debugging
Once everything is wired up, test thoroughly before going live:
Test the Post-Sales Agent
- Create a test order in WooCommerce with a known order number and email address
- Call your Twilio number and ask to check the order status
- Provide the correct email and order number when prompted
- Verify that the agent retrieves and reads the order information correctly
- Try with an incorrect email to verify the security check works (agent should refuse)
Test the RAG Q&A
- Call the Twilio number and ask a product question (e.g., “What are your return policies?” or “Do you ship internationally?”)
- Verify that the assistant searches your Qdrant collection and returns relevant answers
- Check the n8n execution logs to see which documents were retrieved
Check n8n Execution Logs
In your n8n dashboard, navigate to the execution history of your workflows. Look for:
- Successful webhook trigger (check the request body has the correct email and order number)
- Agent node executing without errors
- WooCommerce API calls returning data
- Correct JSON response sent back to VAPI
If any step fails, the agent will explain the error to the caller, so listen carefully and check the logs.
Frequently Asked Questions
Can I use a different LLM instead of GPT-4o-mini for the post-sales agent?
Yes, absolutely. The workflow uses GPT-4o-mini because it’s fast and cost-effective, but n8n supports many LLMs: Claude (Anthropic), Gemini Pro, Mistral, Llama, and others. You can swap it out by changing the language model node’s credentials and model selection. Just ensure the model supports function calling (tool use) for the agent to work properly.
How do I populate my Qdrant collection with product knowledge?
You need to create a separate n8n workflow or script that:
- Fetches your product data (from WooCommerce, a CSV, or a documentation site)
- Chunks the data into smaller pieces (e.g., 500-1000 characters per chunk)
- Generates embeddings using OpenAI’s embedding model
- Uploads the chunks and embeddings to your Qdrant collection
The n8n marketplace and documentation have templates for this. Once set up, you can keep your Qdrant collection updated with new products automatically using a scheduled workflow.
What happens if a customer doesn’t provide a valid order number or email?
The agent is instructed to ask the customer to provide the correct information. If the email doesn’t match the order, it politely refuses to share details and asks them to provide the correct email. The agent never reveals what email is associated with an order—this is a critical security feature to prevent unauthorized access.
Can I customize the voice assistant’s personality or tone?
Yes! Both in n8n and in VAPI. In the agent’s system prompt (the Post-Sales Agent node), you can adjust the tone and instructions. In VAPI, you can choose different voices and customize the opening greeting. Together, these let you create a brand-aligned assistant—friendly, professional, playful, or formal.
Will this workflow handle multiple customers calling at the same time?
Yes! Both VAPI and n8n scale horizontally. When multiple customers call, VAPI handles multiple concurrent conversations independently, and each call triggers a separate n8n workflow execution. As long as your n8n instance is configured for concurrent executions (it is by default), you can handle multiple simultaneous callers. If you reach scale limits, you can upgrade your n8n or VAPI plan.