N
n8n Store
Workflow Market
Build AI Voice Assistent with VAPI

Build AI Voice Assistent with VAPI

by n3witalia0 views

Description

Categories

🤖 AI & Machine Learning

Nodes Used

n8n-nodes-base.setn8n-nodes-base.setn8n-nodes-base.webhookn8n-nodes-base.webhookn8n-nodes-base.stickyNoten8n-nodes-base.stickyNoten8n-nodes-base.stickyNoten8n-nodes-base.stickyNoten8n-nodes-base.stickyNoten8n-nodes-base.httpRequest
PriceFree
Views0
Last Updated11/28/2025
workflow.json
{
  "id": "EMOh4weW7QKklbyb",
  "meta": {
    "instanceId": "a4bfc93e975ca233ac45ed7c9227d84cf5a2329310525917adaf3312e10d5462",
    "templateCredsSetupCompleted": true
  },
  "name": "Build AI Voice Assistent with VAPI",
  "tags": [],
  "nodes": [
    {
      "id": "784ae812-b3e9-4768-a108-ac3f5fd0e965",
      "name": "Question and Answer Chain",
      "type": "@n8n/n8n-nodes-langchain.chainRetrievalQa",
      "position": [
        736,
        3728
      ],
      "parameters": {
        "text": "={{ $json.body.search }}",
        "options": {
          "systemPromptTemplate": "=You are an assistant for question-answering tasks. Use the following pieces of retrieved context to answer the question.\nIf you don't know the answer, just say that you don't know, don't try to make up an answer.\n\nToday is {{ $now }}\n\n----------------\nContext: {context}"
        },
        "promptType": "define"
      },
      "typeVersion": 1.5
    },
    {
      "id": "1a051d79-3738-4e64-b97f-ac581e724d95",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        624,
        3952
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-1.5-flash"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "AaNPKXAphyMzRgfA",
          "name": "Google Gemini(PaLM) (Eure)"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "31c0a7f1-45a2-4ed2-adbd-423f1fcc7bb7",
      "name": "Vector Store Retriever",
      "type": "@n8n/n8n-nodes-langchain.retrieverVectorStore",
      "position": [
        832,
        3936
      ],
      "parameters": {
        "topK": 5
      },
      "typeVersion": 1
    },
    {
      "id": "bb55684d-6c5b-4518-ae49-206f5f163c3c",
      "name": "Qdrant Vector Store1",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
      "position": [
        752,
        4128
      ],
      "parameters": {
        "options": {},
        "qdrantCollection": {
          "__rl": true,
          "mode": "list",
          "value": "negozio-emporio-verde",
          "cachedResultName": "negozio-emporio-verde"
        }
      },
      "credentials": {
        "qdrantApi": {
          "id": "iyQ6MQiVaF3VMBmt",
          "name": "QdrantApi account (Hetzner)"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "f530e2ad-645d-4b89-94f0-44f62522917a",
      "name": "Embeddings OpenAI",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        736,
        4304
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "4zwP0MSr8zkNvvV9",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "5b11f5d5-78f6-4095-b5a8-88630fce649e",
      "name": "rag",
      "type": "n8n-nodes-base.webhook",
      "position": [
        352,
        3728
      ],
      "webhookId": "5ca93cd6-7f7b-4c91-acff-c324e594cca7",
      "parameters": {
        "path": "5ca93cd6-7f7b-4c91-acff-c324e594cca7",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2.1
    },
    {
      "id": "07ab5e01-4fff-414e-9843-cf9382aac4df",
      "name": "get_order",
      "type": "n8n-nodes-base.wooCommerceTool",
      "position": [
        1072,
        3408
      ],
      "parameters": {
        "orderId": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Order_ID', `Order Details Retrieval Process:\n1. Request Order Number\n   - Explicitly ask customer for the complete order number\n\n2. Identity Verification\n   - Ask for the email address associated with the order\n   - Strictly verify that the provided email matches the order record\n   - If email does NOT match the order:\n     * Immediately halt the process\n     * Inform customer that the email is incorrect\n     * Do NOT provide the correct email\n     * Prevent access to order details\n\n3. Verification Criteria\n   - Exact match of email to order record is mandatory\n   - No exceptions or workarounds\n   - Customer must provide the precise, correct email`, 'string') }}",
        "resource": "order",
        "operation": "get"
      },
      "credentials": {
        "wooCommerceApi": {
          "id": "nCgFKMfBO95v38Mp",
          "name": "WooCommerce (magnanigioielli.com)"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b83afd81-7e3e-43bb-8581-ee82d76b9330",
      "name": "get_orders",
      "type": "n8n-nodes-base.wooCommerceTool",
      "position": [
        1184,
        3408
      ],
      "parameters": {
        "options": {
          "search": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Search', ``, 'string') }}"
        },
        "resource": "order",
        "operation": "getAll",
        "returnAll": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Return_All', ``, 'boolean') }}"
      },
      "credentials": {
        "wooCommerceApi": {
          "id": "nCgFKMfBO95v38Mp",
          "name": "WooCommerce (magnanigioielli.com)"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "22d61db2-97b4-40da-852d-676b50ef7d26",
      "name": "get_user",
      "type": "n8n-nodes-base.wooCommerceTool",
      "position": [
        1280,
        3408
      ],
      "parameters": {
        "filters": {
          "email": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Email', ``, 'string') }}"
        },
        "resource": "customer",
        "operation": "getAll",
        "returnAll": true
      },
      "credentials": {
        "wooCommerceApi": {
          "id": "nCgFKMfBO95v38Mp",
          "name": "WooCommerce (magnanigioielli.com)"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "7026a8d5-43a7-48db-a337-1b3a9f457ddb",
      "name": "Calculator",
      "type": "@n8n/n8n-nodes-langchain.toolCalculator",
      "position": [
        768,
        3408
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "fb4d1894-4d09-4f3c-af85-de2fe67d5967",
      "name": "get_tracking",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        928,
        3408
      ],
      "parameters": {
        "name": "get_tracking",
        "workflowId": {
          "__rl": true,
          "mode": "id",
          "value": "EMOh4weW7QKklbyb"
        },
        "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.",
        "workflowInputs": {
          "value": {
            "order_number": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('order_number', ``, 'string') }}"
          },
          "schema": [
            {
              "id": "order_number",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "order_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "order_number"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "caacd925-11eb-4f11-a3bb-6381f74b5fc8",
      "name": "When Executed by Another Workflow",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        1472,
        3392
      ],
      "parameters": {
        "inputSource": "jsonExample",
        "jsonExample": "{\n  \"order_number\": \"order number\"\n}"
      },
      "typeVersion": 1.1
    },
    {
      "id": "11504f43-0dce-4eef-a461-a0fd080b94e3",
      "name": "Post-Sales Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        624,
        3120
      ],
      "parameters": {
        "text": "=Order Information:\nEmail: {{ $json.body.email }}\nOrder number: {{ $json.body.n_order }}",
        "options": {
          "systemMessage": "=## Role and Primary Objective\nYou are a customer support AI agent for an online clothing store, specializing in post-sales assistance. Your primary goals are to:\n- Help customers track their orders\n- Provide information about past and current orders\n- Offer clear and concise support\n\n## Communication Guidelines\n1. Always be professional, helpful, and precise\n2. Use available tools to retrieve accurate information\n3. Verify customer identity before sharing order details\n4. Protect customer privacy and data confidentiality\n\n## Tool Usage Instructions\n\n### Order Information Retrieval\n- Use `get_order` to fetch details for a single order\n  - REQUIRED: Complete user information including request, email, and order number\n- Use `get_orders` to retrieve multiple orders for a single customer\n- Use `get_user` to obtain customer profile information\n\n### Tracking and Support\n- Use `get_tracking` to obtain tracking information for an order using the order number\n- If a customer cannot find what they need, use `human*assistance`\n  - Synthesize the request clearly\n  - Include associated user email\n  - Provide concise, relevant details\n\n### General Information\n- Use `ToS` tool to answer questions about:\n  - Terms and Conditions\n  - Shipping information\n  - General store policies\n\n## Critical Verification Rules\n- ALWAYS verify that the email provided matches the order number\n- If the email does not match the order:\n  - DO NOT provide the correct email\n  - Inform the customer that the email address is incorrect\n  - Request the correct email associated with the order\n\n## Prohibited Actions\n- Never disclose sensitive customer information\n- Do not share full order details without proper verification\n- Avoid providing speculative or unconfirmed information\n\n## Communication Style\n- Be direct and helpful\n- Use clear, professional language\n- Focus on solving the customer's specific query\n- Provide step-by-step guidance when necessary\n\nToday is {{$now}}"
        },
        "promptType": "define"
      },
      "typeVersion": 1.8
    },
    {
      "id": "571a225d-edc8-499e-a48d-5d8253d38b64",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1456,
        3216
      ],
      "parameters": {
        "color": 5,
        "width": 532,
        "height": 136,
        "content": "The tracking code request is made through the most popular WooCommerce tracking plugin: \"YITH WooCommerce Order & Shipment Tracking\". The free version can be [downloaded here](https://wordpress.org/plugins/yith-woocommerce-order-tracking/)\n- Create a new workflow and change URL in the node \"Http Request\" with your WooCommerce shop url"
      },
      "typeVersion": 1
    },
    {
      "id": "c0d82557-5f90-4115-8673-216e2274f25d",
      "name": "Get tracking",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1648,
        3392
      ],
      "parameters": {
        "url": "=https://URL/wp-json/wc/v3/orders/{{ $json.order_number }}",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBasicAuth"
      },
      "credentials": {
        "httpBasicAuth": {
          "id": "nIitKwSJa9EpgG8K",
          "name": "WP (magnanigioielli.com)"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "85450f4c-7329-4876-af32-792764d1c726",
      "name": "Set tracking code",
      "type": "n8n-nodes-base.set",
      "position": [
        1824,
        3392
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "19b33abc-5191-4449-b682-4466f1975ff2",
              "name": "tracking_code",
              "type": "string",
              "value": "={{ $json[\"meta_data\"].find(item => item.key === \"ywot_tracking_code\").value }}"
            },
            {
              "id": "2e18b337-e3e8-4669-a902-ecc2ba027a1a",
              "name": "carrier_url",
              "type": "string",
              "value": "={{ $json[\"meta_data\"].find(item => item.key === \"ywot_carrier_url\").value }}"
            },
            {
              "id": "ae834f65-67b2-4e95-9a49-5172e36fc5b9",
              "name": "pick_up",
              "type": "string",
              "value": "={{ $json[\"meta_data\"].find(item => item.key === \"ywot_pick_up_date\").value }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "1153e7e1-269a-472f-8dc5-df3b59a48705",
      "name": "GPT 4o-mini",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        464,
        3408
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "4zwP0MSr8zkNvvV9",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "5a29fd84-fb55-4f89-98a4-a7ba0c5f3889",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        352,
        3120
      ],
      "webhookId": "f265a558-2787-4f8c-96a1-7b1068e45d3c",
      "parameters": {
        "path": "f265a558-2787-4f8c-96a1-7b1068e45d3c",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2.1
    },
    {
      "id": "a5aef818-952a-401e-bfa4-a6e2ec1b52de",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        3136
      ],
      "parameters": {
        "color": 4,
        "width": 384,
        "height": 112,
        "content": "## Post-sale Agent\nGet a WooCommerce user's orders and shipping tracking"
      },
      "typeVersion": 1
    },
    {
      "id": "2d963ce1-5a68-4f59-9162-8e256349f056",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -96,
        3728
      ],
      "parameters": {
        "color": 4,
        "width": 400,
        "height": 144,
        "content": "## General info\n\nExtract information saved in the vector database\n\nTo build the RAG system please view [this Workflow](https://n8n.io/workflows/7647-build-a-self-updating-rag-system-with-openai-google-gemini-qdrant-and-google-drive/)"
      },
      "typeVersion": 1
    },
    {
      "id": "8b837fa9-8c26-4454-97a6-0a0d7e0cd0e2",
      "name": "Set response",
      "type": "n8n-nodes-base.set",
      "position": [
        976,
        3120
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "d6a208ab-3fb3-4b4a-9615-b29183bbce39",
              "name": "message",
              "type": "string",
              "value": "={{ $json.output }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "1ef5425b-d66b-44b6-985b-5cc5adcb3ca6",
      "name": "Send response to VAPI",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1216,
        3120
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.4
    },
    {
      "id": "7a91965a-bf65-404d-86b8-69990f687e9e",
      "name": "Send RAG response to VAPI",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1216,
        3728
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.4
    },
    {
      "id": "cbebeb82-f172-45d6-afa6-9f8409a8432d",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -96,
        2624
      ],
      "parameters": {
        "width": 1072,
        "height": 368,
        "content": "## STEP 1\nCreate two \"API Request\" tools in VAPI:\n- WooCommerce tool: connect the n8n webhook and set two parameters as the request body: 'email' and 'n_order'\n- Rag tool: connect the n8n webhook and set the 'search' parameter as the request body\n\n## STEP 2\n- Create a wizard by generating a system prompt that includes the functionality of the two tools created in STEP 1.\n- Set the voice in the Voice tab.\n- Include the two tools created in STEP 1 in the 'Tools' tab.\n\n## STEP 3\n- Create or import a phone number from Twilio, setting it as \"Inbound.\"\n- Associate the phone number with the wizard."
      },
      "typeVersion": 1
    },
    {
      "id": "dbd67324-fb3e-4559-a013-33e37216900c",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -96,
        2384
      ],
      "parameters": {
        "color": 3,
        "width": 1072,
        "height": 208,
        "content": "## Build AI Voice Assistent with VAPI & Twilio for WooCommerce Post-Sales & RAG\nThis workflow integrates a **Retrieval-Augmented Generation (RAG) system** with a **post-sales AI agent for WooCommerce**. It combines vector-based search (Qdrant + OpenAI embeddings) with LLMs (Google Gemini and GPT-4o-mini) to provide accurate and contextual responses.\n\nBoth systems are connected to **VAPI webhooks**, making the workflow usable in a **voice AI assistant** via **Twilio** phone numbers.\n\nThe workflow receives JSON payloads from VAPI via webhooks, processes the request through the appropriate chain (Agent or RAG), and sends a structured response back to VAPI to be read out to the user."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "abceb79d-e0c7-4d43-b622-7f24d92563b0",
  "connections": {
    "rag": {
      "main": [
        [
          {
            "node": "Question and Answer Chain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "Post-Sales Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "get_user": {
      "ai_tool": [
        [
          {
            "node": "Post-Sales Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "get_order": {
      "ai_tool": [
        [
          {
            "node": "Post-Sales Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Calculator": {
      "ai_tool": [
        [
          {
            "node": "Post-Sales Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "get_orders": {
      "ai_tool": [
        [
          {
            "node": "Post-Sales Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "GPT 4o-mini": {
      "ai_languageModel": [
        [
          {
            "node": "Post-Sales Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Get tracking": {
      "main": [
        [
          {
            "node": "Set tracking code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set response": {
      "main": [
        [
          {
            "node": "Send response to VAPI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "get_tracking": {
      "ai_tool": [
        [
          {
            "node": "Post-Sales Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Post-Sales Agent": {
      "main": [
        [
          {
            "node": "Set response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Qdrant Vector Store1",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Qdrant Vector Store1": {
      "ai_vectorStore": [
        [
          {
            "node": "Vector Store Retriever",
            "type": "ai_vectorStore",
            "index": 0
          }
        ]
      ]
    },
    "Vector Store Retriever": {
      "ai_retriever": [
        [
          {
            "node": "Question and Answer Chain",
            "type": "ai_retriever",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Question and Answer Chain",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Question and Answer Chain": {
      "main": [
        [
          {
            "node": "Send RAG response to VAPI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "Get tracking",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

相关工作流