This workflow corresponds to n8n.io template #16175 — we link there as the canonical source.
This workflow follows the Agent → Documentdefaultdataloader recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"id": "LwpmwheOuvcezFcj",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "WhatsApp AI Smart Order & Knowledge Assistant (n8n Automation)",
"tags": [],
"nodes": [
{
"id": "0a07650b-b99d-4434-aa1a-84fe3d4740c8",
"name": "WhatsApp Incoming Message Trigger",
"type": "n8n-nodes-base.whatsAppTrigger",
"position": [
-2128,
672
],
"parameters": {
"options": {},
"updates": [
"messages"
]
},
"typeVersion": 1
},
{
"id": "863c9a25-cee9-4a36-9819-1f9df990cd94",
"name": "Extract WhatsApp Message Details",
"type": "n8n-nodes-base.set",
"position": [
-1904,
672
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "e6f5613a-5bf5-4917-ac3c-609e8db7b637",
"name": "phone",
"type": "string",
"value": "={{ $json.body.entry[0].changes[0].value.messages[0].from }}"
},
{
"id": "50bb3528-4117-4b45-9452-b78845dc483c",
"name": "message",
"type": "string",
"value": "={{ $json.body.entry[0].changes[0].value.messages[0].text.body }}"
},
{
"id": "fcbdb994-b196-44d0-9e3e-01c420332510",
"name": "timestamp",
"type": "string",
"value": "={{ $now }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "6c3303fc-6539-4a14-82fb-d0be488fd6e7",
"name": "AI Intent Classification",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
-1680,
672
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o",
"cachedResultName": "GPT-4O"
},
"options": {},
"responses": {
"values": [
{
"role": "system",
"content": "=You are an intent classifier for a WhatsApp business assistant.\n\nClassify message into ONLY ONE category:\n\n- FAQ\n- ORDER\n- TRACK_ORDER\n- HUMAN_SUPPORT\n\nReturn ONLY valid JSON.\n\nNo markdown.\nNo explanation.\n\nFormat:\n{\n \"intent\": \"\",\n \"confidence\": 0.0\n}"
},
{
"content": "={{ $json.message }}"
}
]
},
"builtInTools": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "9993bbb3-3e8d-4a90-9a7e-bd7af8aad82a",
"name": "Parse Intent Classification Response",
"type": "n8n-nodes-base.code",
"position": [
-1328,
672
],
"parameters": {
"jsCode": "// Extract raw AI response text\nconst raw =\n $input.first().json.output?.[0]?.content?.[0]?.text || '{}';\n\n// Parse safely\nlet parsed;\n\ntry {\n parsed = JSON.parse(raw);\n} catch (e) {\n parsed = {\n intent: 'HUMAN_SUPPORT',\n confidence: 0\n };\n}\n\n// Return normalized object\nreturn [\n {\n json: {\n phone: $('Extract WhatsApp Message Details').first().json.phone,\n message: $('Extract WhatsApp Message Details').first().json.message,\n intent: parsed.intent,\n confidence: parsed.confidence\n }\n }\n];"
},
"typeVersion": 2
},
{
"id": "6c153409-f532-49af-84bc-dd205dd3dc98",
"name": "Intent-Based Request Router",
"type": "n8n-nodes-base.switch",
"position": [
-1104,
640
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "FAQ",
"conditions": {
"options": {
"version": 3,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "d11ec531-f20f-421b-b503-192496f253de",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{$json.intent}}",
"rightValue": "FAQ"
}
]
},
"renameOutput": true
},
{
"outputKey": "ORDER",
"conditions": {
"options": {
"version": 3,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "4885f2e9-e8e3-4a9e-ad50-98a85dc27cc3",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{$json.intent}}",
"rightValue": "ORDER"
}
]
},
"renameOutput": true
},
{
"outputKey": "TRACK_ORDER",
"conditions": {
"options": {
"version": 3,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "348e6093-c13b-4dca-9d3c-169d700c4869",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{$json.intent}}",
"rightValue": "TRACK_ORDER"
}
]
},
"renameOutput": true
}
]
},
"options": {
"fallbackOutput": "extra",
"renameFallbackOutput": "HUMAN_SUPPORT"
}
},
"typeVersion": 3.4
},
{
"id": "b0ca9574-6eb2-41a7-bfe9-fc52a4f54b92",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2272,
400
],
"parameters": {
"color": 7,
"width": 1552,
"height": 640,
"content": "## WhatsApp Message Intake\n\nThis section receives incoming WhatsApp messages from users and extracts important details like phone number, message content, and timestamp. It standardizes the raw webhook payload into a clean format so the remaining workflow can process requests consistently and reliably."
},
"typeVersion": 1
},
{
"id": "46671f03-24a2-4409-8d05-027a66b1c3cf",
"name": "WhatsApp FAQ AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-480,
-224
],
"parameters": {
"text": "=Question:\n{{ $json.message }}",
"options": {
"systemMessage": "You are a helpful WhatsApp support assistant.\n\nAnswer ONLY from provided context.\n\nKeep answers:\n- short\n- friendly\n- WhatsApp style"
},
"promptType": "define"
},
"typeVersion": 3.1
},
{
"id": "98de6294-a961-4ad5-9837-20a345cc9a26",
"name": "FAQ Response Language Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-592,
0
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o",
"cachedResultName": "gpt-4o"
},
"options": {},
"builtInTools": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.3
},
{
"id": "ce1b0e42-5f1b-4eca-a50d-9a9963f36b00",
"name": "Conversation Memory Manager",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
-384,
0
],
"parameters": {
"sessionKey": "whatsapp-sessionId",
"sessionIdType": "customKey"
},
"typeVersion": 1.3
},
{
"id": "2f3f9ca3-37f7-4f9a-8443-effa3e031fd9",
"name": "Knowledge Base Retrieval Tool",
"type": "@n8n/n8n-nodes-langchain.toolVectorStore",
"position": [
-192,
0
],
"parameters": {
"description": "Use this tool to answer users questions."
},
"typeVersion": 1.1
},
{
"id": "fbf9f74d-d42a-43f7-8765-9f0fd0f65ef6",
"name": "Pinecone FAQ Vector Store",
"type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
"position": [
-272,
192
],
"parameters": {
"options": {
"pineconeNamespace": "n8n-whatsapp-space"
},
"pineconeIndex": {
"__rl": true,
"mode": "list",
"value": "n8n-whatsapp",
"cachedResultName": "n8n-whatsapp"
}
},
"credentials": {
"pineconeApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.3
},
{
"id": "c78516ee-b5ac-4913-9936-f0d90941502d",
"name": "FAQ Embedding Generator",
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"position": [
-272,
368
],
"parameters": {
"options": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "8c5d3ce1-145b-45a9-b78f-1dc642898f01",
"name": "Knowledge Retrieval LLM",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
80,
208
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o",
"cachedResultName": "gpt-4o"
},
"options": {},
"builtInTools": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.3
},
{
"id": "27698fbf-594d-4a3f-82bc-8ce15ce221f1",
"name": "Send FAQ WhatsApp Reply",
"type": "n8n-nodes-base.whatsApp",
"position": [
160,
-224
],
"parameters": {
"operation": "send",
"additionalFields": {},
"recipientPhoneNumber": "={{ $('Parse Intent Classification Response').item.json.phone }}"
},
"typeVersion": 1.1
},
{
"id": "13910256-0274-41f4-ac3f-1c9cdbe983d2",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-704,
-352
],
"parameters": {
"color": 7,
"width": 1136,
"height": 896,
"content": "## FAQ & Knowledge Base Assistant\n\nThis section handles frequently asked questions using a RAG-based AI assistant powered by Pinecone vector search. It retrieves relevant business knowledge from embedded documents and generates short, friendly, WhatsApp-style responses using OpenAI."
},
"typeVersion": 1
},
{
"id": "fbfc321d-9839-4e97-b6ea-c84884d96bf2",
"name": "AI Order Information Extractor",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
-592,
768
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o",
"cachedResultName": "GPT-4O"
},
"options": {},
"responses": {
"values": [
{
"role": "system",
"content": "Extract order information.\n\nReturn ONLY valid JSON.\n\nFormat:\n{\n \"product\": \"\",\n \"quantity\": 0\n}"
},
{
"content": "={{ $json.message }}"
}
]
},
"builtInTools": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "beec1b27-29de-4fa6-9ae1-65085c610b41",
"name": "Parse Order Details JSON",
"type": "n8n-nodes-base.code",
"position": [
-256,
768
],
"parameters": {
"jsCode": "const raw =\n $input.first().json.output?.[0]?.content?.[0]?.text || '{}';\n\n// Remove markdown formatting\nconst cleaned = raw\n .replace(/```json/g, '')\n .replace(/```/g, '')\n .trim();\n\nlet parsed;\n\ntry {\n parsed = JSON.parse(cleaned);\n} catch (e) {\n parsed = {\n product: \"\",\n quantity: 1\n };\n}\n\n// Return normalized structure\nreturn [\n {\n json: {\n phone: $('Parse Intent Classification Response').first().json.phone,\n product: parsed.product,\n quantity: parsed.quantity\n }\n }\n];"
},
"typeVersion": 2
},
{
"id": "938801f7-f9bf-44ff-8467-463ad8fadd83",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-704,
560
],
"parameters": {
"color": 7,
"width": 736,
"height": 480,
"content": "## Order Extraction & Product Understanding\n\nThis section extracts structured order information from natural language WhatsApp messages. The AI identifies requested products and quantities, converts the response into clean JSON format, and prepares the data for product matching and inventory validation."
},
"typeVersion": 1
},
{
"id": "1e4834ec-ad55-4c09-8092-ba7aee26f5ff",
"name": "Fetch Product Catalog",
"type": "n8n-nodes-base.googleSheets",
"position": [
160,
768
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": 1314124287,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1b4XQG0yh1s3ZrnYTsKBlnSMNdlYzQt42zJ8DUneVTS8/edit#gid=1314124287",
"cachedResultName": "Products"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1b4XQG0yh1s3ZrnYTsKBlnSMNdlYzQt42zJ8DUneVTS8",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1b4XQG0yh1s3ZrnYTsKBlnSMNdlYzQt42zJ8DUneVTS8/edit?usp=drivesdk",
"cachedResultName": "LinkedIn Profile Monitor"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.7,
"alwaysOutputData": true
},
{
"id": "2e7ef3bf-6ba8-4b23-ac38-ccd27978a2da",
"name": "Prepare Product Catalog Context",
"type": "n8n-nodes-base.code",
"position": [
384,
768
],
"parameters": {
"jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nconst result = [];\nfor (const item of $input.all()) {\n result.push(item.json)\n}\n\nreturn [\n {\n allData : JSON.stringify(result)\n }\n];"
},
"typeVersion": 2
},
{
"id": "628047bb-aae2-41e8-8ba9-cc6cfdb0b03b",
"name": "AI Semantic Product Matcher",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
576,
768
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o",
"cachedResultName": "GPT-4O"
},
"options": {},
"responses": {
"values": [
{
"role": "system",
"content": "You are a product matching assistant.\n\nYour task:\nMatch the user requested product with the closest product from catalog.\n\nRules:\n- Return ONLY exact product from catalog\n- If no match found return NOT_FOUND\n- Consider spelling mistakes\n- Consider short names\n- Consider synonyms\n\nReturn ONLY JSON.\n\nFormat:\n{\n \"matched_product\": \"\"\n}"
},
{
"content": "=Customer Request:\n{{ $('Parse Order Details JSON').item.json.product }}\n\nProduct Catalog:{{ $json.allData }}"
}
]
},
"builtInTools": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "0e40fc36-c8d6-4140-8f1c-35013be81f39",
"name": "Parse & Validate Product Match",
"type": "n8n-nodes-base.code",
"position": [
928,
768
],
"parameters": {
"jsCode": "const raw =\n $input.first().json.output?.[0]?.content?.[0]?.text || '{}';\n\n// Remove markdown formatting\nconst cleaned = raw\n .replace(/```json/g, '')\n .replace(/```/g, '')\n .trim();\n\nlet parsed;\n\ntry {\n parsed = JSON.parse(cleaned);\n} catch (e) {\n parsed = {\n matched_product: 'NOT_FOUND'\n };\n}\n\nconst matchedProduct = parsed.matched_product;\n\n// Get all products from previous Google Sheets node\nconst products = $('Fetch Product Catalog').all();\n\n// Find matching product row\nconst matchedRow = products.find(item => {\n return (\n item.json.product_name?.toLowerCase() ===\n matchedProduct?.toLowerCase()\n );\n});\n\n// If no product found\nif (!matchedRow) {\n return [\n {\n json: {\n found: false,\n matched_product: 'NOT_FOUND'\n }\n }\n ];\n}\n\n// Return full product data\nreturn [\n {\n json: {\n found: true,\n matched_product: matchedProduct,\n\n product_id: matchedRow.json.product_id,\n product_name: matchedRow.json.product_name,\n category: matchedRow.json.category,\n price: matchedRow.json.price,\n stock: matchedRow.json.stock,\n min_stock_alert: matchedRow.json.min_stock_alert,\n status: matchedRow.json.status,\n description: matchedRow.json.description\n }\n }\n];"
},
"typeVersion": 2
},
{
"id": "d62d32f3-9a5f-45e3-a489-d6e3ef5aa25b",
"name": "Product Match Validation Check",
"type": "n8n-nodes-base.if",
"position": [
1168,
768
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 3,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "4f42c3b5-f362-4f9f-a092-d208f8193b6a",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json.found }}",
"rightValue": "NOT_FOUND"
}
]
}
},
"typeVersion": 2.3
},
{
"id": "c62e8db6-1566-462c-a175-2a3972131de4",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
48,
560
],
"parameters": {
"color": 7,
"width": 1344,
"height": 480,
"content": "## Product Catalog Matching & Semantic Search\n\nThis section performs intelligent product matching instead of exact keyword lookup. It fetches all product catalog records, sends them to AI for semantic matching, handles spelling mistakes and synonyms, and returns the best matching product with complete inventory details."
},
"typeVersion": 1
},
{
"id": "5ea898e1-f512-4a6d-86c3-6ae5d6de263b",
"name": "Inventory Availability Check",
"type": "n8n-nodes-base.if",
"position": [
1552,
672
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 3,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "0386806e-ecdc-4ebd-87e3-a0e45f575fac",
"operator": {
"type": "number",
"operation": "gte"
},
"leftValue": "={{ $json.stock }}",
"rightValue": "={{ $('Parse Order Details JSON').item.json.quantity }}"
}
]
}
},
"typeVersion": 2.3
},
{
"id": "7bf2836a-ee04-4026-a464-b1f899fe4986",
"name": "Create New Order Record",
"type": "n8n-nodes-base.googleSheets",
"position": [
1888,
512
],
"parameters": {
"columns": {
"value": {
"phone": "={{ $('Parse Order Details JSON').item.json.phone }}",
"status": "Pending",
"product": "={{ $('Parse Order Details JSON').item.json.product }}",
"order_id": "=ORD-{{$now.toUnixInteger()}}",
"quantity": "={{ $('Parse Order Details JSON').item.json.quantity }}"
},
"schema": [
{
"id": "order_id",
"type": "string",
"display": true,
"required": false,
"displayName": "order_id",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "phone",
"type": "string",
"display": true,
"required": false,
"displayName": "phone",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "product",
"type": "string",
"display": true,
"required": false,
"displayName": "product",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "quantity",
"type": "string",
"display": true,
"required": false,
"displayName": "quantity",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "status",
"type": "string",
"display": true,
"required": false,
"displayName": "status",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 1232411986,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1b4XQG0yh1s3ZrnYTsKBlnSMNdlYzQt42zJ8DUneVTS8/edit#gid=1232411986",
"cachedResultName": "Orders"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1b4XQG0yh1s3ZrnYTsKBlnSMNdlYzQt42zJ8DUneVTS8",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1b4XQG0yh1s3ZrnYTsKBlnSMNdlYzQt42zJ8DUneVTS8/edit?usp=drivesdk",
"cachedResultName": "LinkedIn Profile Monitor"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.7
},
{
"id": "13bcf832-10d4-4f35-a62c-7a0796263847",
"name": "Update Product Inventory",
"type": "n8n-nodes-base.googleSheets",
"position": [
2112,
512
],
"parameters": {
"columns": {
"value": {
"stock": "={{ Number($('Parse & Validate Product Match').item.json.stock ) - Number($('Parse Order Details JSON').item.json.quantity) }}",
"product_id": "={{ $('Parse & Validate Product Match').item.json.product_id }}"
},
"schema": [
{
"id": "product_id",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "product_id",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "product_name",
"type": "string",
"display": true,
"required": false,
"displayName": "product_name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "category",
"type": "string",
"display": true,
"required": false,
"displayName": "category",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "price",
"type": "string",
"display": true,
"required": false,
"displayName": "price",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "stock",
"type": "string",
"display": true,
"required": false,
"displayName": "stock",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "min_stock_alert",
"type": "string",
"display": true,
"required": false,
"displayName": "min_stock_alert",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "status",
"type": "string",
"display": true,
"required": false,
"displayName": "status",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "description",
"type": "string",
"display": true,
"required": false,
"displayName": "description",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "row_number",
"type": "number",
"display": true,
"removed": true,
"readOnly": true,
"required": false,
"displayName": "row_number",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"product_id"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "update",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 1314124287,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1b4XQG0yh1s3ZrnYTsKBlnSMNdlYzQt42zJ8DUneVTS8/edit#gid=1314124287",
"cachedResultName": "Products"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1b4XQG0yh1s3ZrnYTsKBlnSMNdlYzQt42zJ8DUneVTS8",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1b4XQG0yh1s3ZrnYTsKBlnSMNdlYzQt42zJ8DUneVTS8/edit?usp=drivesdk",
"cachedResultName": "LinkedIn Profile Monitor"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.7
},
{
"id": "32d89228-683f-4abc-a3b2-34432437ef4b",
"name": "Send Order Confirmation Message",
"type": "n8n-nodes-base.whatsApp",
"position": [
2336,
512
],
"parameters": {
"operation": "send",
"additionalFields": {},
"recipientPhoneNumber": "={{ $('Parse Intent Classification Response').item.json.phone }}"
},
"typeVersion": 1.1
},
{
"id": "61663b65-5642-4726-bf10-86a788f0b794",
"name": "Send Product Error / Stock Failure Message",
"type": "n8n-nodes-base.whatsApp",
"position": [
1888,
912
],
"parameters": {
"operation": "send",
"additionalFields": {},
"recipientPhoneNumber": "={{ $('Parse Intent Classification Response').item.json.phone }}"
},
"typeVersion": 1.1
},
{
"id": "9572dfcd-fe23-4c01-8ae2-abe35cbacbd3",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
1408,
288
],
"parameters": {
"color": 7,
"width": 1184,
"height": 848,
"content": "## Inventory Validation & Order Processing\n\nThis section validates product stock availability before confirming orders. If stock is sufficient, the workflow creates a new order entry, updates inventory levels, and sends a confirmation message. If stock is unavailable, users receive an out-of-stock notification."
},
"typeVersion": 1
},
{
"id": "3c703035-e04f-43c1-82ba-a5ec4a03098e",
"name": "AI Order ID Extractor",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
-576,
1264
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o",
"cachedResultName": "GPT-4O"
},
"options": {},
"responses": {
"values": [
{
"role": "system",
"content": "Extract order_id from message.\n\nReturn JSON:\n{\n \"order_id\":\"\"\n}"
},
{
"content": "={{ $json.message }}"
}
]
},
"builtInTools": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "591275de-a535-4f2e-98e5-c6d5102a7205",
"name": "Parse Order Tracking Request",
"type": "n8n-nodes-base.code",
"position": [
-176,
1264
],
"parameters": {
"jsCode": "// Extract raw AI response text\nconst raw =\n $input.first().json.output?.[0]?.content?.[0]?.text || '{}';\n\n// Remove markdown formatting\nconst cleaned = raw\n .replace(/```json/g, '')\n .replace(/```/g, '')\n .trim();\n\n// Parse JSON safely\nlet parsed;\n\ntry {\n parsed = JSON.parse(cleaned);\n} catch (e) {\n parsed = {\n order_id: ''\n };\n}\n\n// Return normalized structure\nreturn [\n {\n json: {\n phone: $('Parse Intent Classification Response').first().json.phone,\n message: $('Parse Intent Classification Response').first().json.message,\n order_id: parsed.order_id\n }\n }\n];"
},
"typeVersion": 2
},
{
"id": "f776668e-53a7-448a-b07f-5f44d5b7d65e",
"name": "Fetch Order Status",
"type": "n8n-nodes-base.googleSheets",
"position": [
64,
1264
],
"parameters": {
"options": {},
"filtersUI": {
"values": [
{
"lookupValue": "={{ $json.order_id }}",
"lookupColumn": "order_id"
}
]
},
"sheetName": {
"__rl": true,
"mode": "list",
"value": 1232411986,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1b4XQG0yh1s3ZrnYTsKBlnSMNdlYzQt42zJ8DUneVTS8/edit#gid=1232411986",
"cachedResultName": "Orders"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1b4XQG0yh1s3ZrnYTsKBlnSMNdlYzQt42zJ8DUneVTS8",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1b4XQG0yh1s3ZrnYTsKBlnSMNdlYzQt42zJ8DUneVTS8/edit?usp=drivesdk",
"cachedResultName": "LinkedIn Profile Monitor"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.7,
"alwaysOutputData": true
},
{
"id": "b1d9bc1f-6721-4873-add2-024241eb517b",
"name": "Send Order Status Reply",
"type": "n8n-nodes-base.whatsApp",
"position": [
336,
1264
],
"parameters": {
"operation": "send",
"additionalFields": {},
"recipientPhoneNumber": "={{ $('Parse Intent Classification Response').item.json.phone }}"
},
"typeVersion": 1.1
},
{
"id": "b5eee1ae-0f23-41e6-bdba-3887d08dfca2",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-704,
1072
],
"parameters": {
"color": 7,
"width": 1360,
"height": 448,
"content": "## Order Tracking System\n\nThis section allows customers to track existing orders directly through WhatsApp. The AI extracts the order ID from user messages, searches the orders database, and returns the latest order status information automatically."
},
"typeVersion": 1
},
{
"id": "6135be89-5995-4aef-a74f-8f969bd263ca",
"name": "Notify Human Support Team",
"type": "n8n-nodes-base.slack",
"position": [
-512,
1680
],
"parameters": {
"text": "=New Human Support Request\n\nPhone: {{ $('Extract WhatsApp Message Details').item.json.phone }}\nMessage: {{ $('Extract WhatsApp Message Details').item.json.message }}\nTime: {{ $('Extract WhatsApp Message Details').item.json.timestamp }}",
"select": "channel",
"channelId": {
"__rl": true,
"mode": "list",
"value": "C0ALTQD6L0H",
"cachedResultName": "feature-addition"
},
"otherOptions": {}
},
"credentials": {
"slackApi": {
"name": "<your credential>"
}
},
"typeVersion": 2.4
},
{
"id": "c926a88c-e56c-4f32-92ef-a15c46ceb1e9",
"name": "Send Human Support Acknowledgement",
"type": "n8n-nodes-base.whatsApp",
"position": [
-272,
1680
],
"parameters": {
"operation": "send",
"additionalFields": {},
"recipientPhoneNumber": "={{ $('Parse Intent Classification Response').item.json.phone }}"
},
"typeVersion": 1.1
},
{
"id": "882c6086-0171-4745-9870-5767d417fc8e",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-704,
1536
],
"parameters": {
"color": 7,
"width": 704,
"height": 400,
"content": "## Human Support Escalation\n\nThis section manages fallback and escalation scenarios when the AI cannot confidently answer user queries. It sends customer details and messages directly to Slack so human agents can manually continue the conversation and provide support."
},
"typeVersion": 1
},
{
"id": "bc51b876-aaff-45fd-bd66-78d1140013a0",
"name": "Knowledge Base File Change Trigger",
"type": "n8n-nodes-base.googleDriveTrigger",
"position": [
-2128,
-304
],
"parameters": {
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
},
"triggerOn": "specificFile",
"fileToWatch": {
"__rl": true,
"mode": "list",
"value": "15PC6geBuEighB-V__iqL0ZXAQH41qWKJ",
"cachedResultUrl": "https://drive.google.com/file/d/15PC6geBuEighB-V__iqL0ZXAQH41qWKJ/view?usp=drivesdk",
"cachedResultName": "Whatsapp Ai Business Knowledge Base Document"
}
},
"credentials": {
"googleDriveOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "d7327048-9523-482f-b8d3-3008586b5169",
"name": "Download Knowledge Base File",
"type": "n8n-nodes-base.googleDrive",
"position": [
-1872,
-304
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "list",
"value": "15PC6geBuEighB-V__iqL0ZXAQH41qWKJ",
"cachedResultUrl": "https://drive.google.com/file/d/15PC6geBuEighB-V__iqL0ZXAQH41qWKJ/view?usp=drivesdk",
"cachedResultName": "Whatsapp Ai Business Knowledge Base Document"
},
"options": {},
"operation": "download"
},
"credentials": {
"googleDriveOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 3
},
{
"id": "3fae1884-b654-4540-83d0-da638668efa4",
"name": "Split Knowledge Base Into Chunks",
"type": "@n8n/n8n-nodes-langchain.textSplitterCharacterTextSplitter",
"position": [
-1376,
128
],
"parameters": {
"chunkOverlap": 200
},
"typeVersion": 1
},
{
"id": "6f52edb7-f115-43e6-87f1-b7c4c20eece8",
"name": "Load Knowledge Base Document",
"type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
"position": [
-1376,
-64
],
"parameters": {
"options": {
"splitPages": true
},
"dataType": "binary",
"textSplittingMode": "custom"
},
"typeVersion": 1.1
},
{
"id": "e0ae70fb-ca89-4b37-ad6d-a2bb28d81b1a",
"name": "Generate Knowledge Embeddings",
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"position": [
-1696,
-64
],
"parameters": {
"options": {
"dimensions": 1536
}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "1b46265a-b0f2-47ae-bc57-19d35c7d6a9f",
"name": "Store Knowledge Embeddings In Pinecone",
"type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
"position": [
-1568,
-304
],
"parameters": {
"mode": "insert",
"options": {
"pineconeNamespace": "n8n-whatsapp-space"
},
"pineconeIndex": {
"__rl": true,
"mode": "list",
"value": "n8n-whatsapp",
"cachedResultName": "n8n-whatsapp"
}
},
"credentials": {
"pineconeApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.3
},
{
"id": "178c12fa-28e7-45b7-b2b1-dfccbd8fa626",
"name": "Sticky Note7",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2272,
-544
],
"parameters": {
"color": 7,
"width": 1360,
"height": 928,
"content": "## Knowledge Base Embedding Pipeline\nThis background pipeline automatically updates the AI knowledge base whenever business documents change in Google Drive. Documents are downloaded, split into chunks, converted into embeddings, and stored inside Pinecone for semantic retrieval during FAQ conversations."
},
"typeVersion": 1
},
{
"id": "eaa75124-fef0-4d94-88a5-3e3efeba56ff",
"name": "Sticky Note8",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2992,
176
],
"parameters": {
"width": 704,
"height": 448,
"content": "## Workflow Working & Setup Guide\n**Description**\n\nThis workflow is a complete AI-powered WhatsApp business assistant built in n8n. It automatically receives WhatsApp messages, classifies user intent using OpenAI, and routes requests into FAQ support, product ordering, order tracking, or human escalation flows. FAQ queries use a RAG-based Pinecone knowledge base to generate accurate AI responses from uploaded business documents. Order requests are processed using AI extraction, semantic product matching, inventory validation, Google Sheets order management, and automatic stock updates. If the AI cannot handle a request, the workflow escalates the conversation to Slack for human assistance.\n\n**Setup Steps**\n**1.** Configure WhatsApp Cloud API credentials in n8n.\n**2.** Connect OpenAI API credentials for intent classification and AI processing.\n**3.** Configure Google Sheets credentials for Products and Orders sheets.\n**4.** Create and connect a Pinecone index for vector storage.\n**5.** Connect Google Drive credentials for knowledge base synchronization.\n**6.** Configure Slack credentials for human support escalation.\n**7.** Upload business knowledge documents into Google Drive.\n**8.** Activate the workflow and test FAQ, order, and tracking scenarios end-to-end."
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"binaryMode": "separate",
"executionOrder": "v1"
},
"versionId": "fb3f1981-9847-4cfc-bfe2-fd6bab2e26c3",
"connections": {
"Fetch Order Status": {
"main": [
[
{
"node": "Send Order Status Reply",
"type": "main",
"index": 0
}
]
]
},
"AI Order ID Extractor": {
"main": [
[
{
"node": "Parse Order Tracking Request",
"type": "main",
"index": 0
}
]
]
},
"Fetch Product Catalog": {
"main": [
[
{
"node": "Prepare Product Catalog Context",
"type": "main",
"index": 0
}
]
]
},
"WhatsApp FAQ AI Agent": {
"main": [
[
{
"node": "Send FAQ WhatsApp Reply",
"type": "main",
"index": 0
}
]
]
},
"Create New Order Record": {
"main": [
[
{
"node": "Update Product Inventory",
"type": "main",
"index": 0
}
]
]
},
"FAQ Embedding Generator": {
"ai_embedding": [
[
{
"node": "Pinecone FAQ Vector Store",
"type": "ai_embedding",
"index": 0
}
]
]
},
"Knowledge Retrieval LLM": {
"ai_languageModel": [
[
{
"node": "Knowledge Base Retrieval Tool",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"AI Intent Classification": {
"main": [
[
{
"node": "Parse Intent Classification Response",
"type": "main",
"index": 0
}
]
]
},
"Parse Order Details JSON": {
"main": [
[
{
"node": "Fetch Product Catalog",
"type": "main",
"index": 0
}
]
]
},
"Update Product Inventory": {
"main": [
[
{
"node": "Send Order Confirmation Message",
"type": "main",
"index": 0
}
]
]
},
"Notify Human Support Team": {
"main": [
[
{
"node": "Send Human Support Acknowledgement",
"type": "main",
"index": 0
}
]
]
},
"Pinecone FAQ Vector Store": {
"ai_vectorStore": [
[
{
"node": "Knowledge Base Retrieval Tool",
"type": "ai_vectorStore",
"index": 0
}
]
]
},
"AI Semantic Product Matcher": {
"main": [
[
{
"node": "Parse & Validate Product Match",
"type": "main",
"index": 0
}
]
]
},
"Conversation Memory Manager": {
"ai_memory": [
[
{
"node": "WhatsApp FAQ AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"FAQ Response Language Model": {
"ai_languageModel": [
[
{
"node": "WhatsApp FAQ AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Intent-Based Request Router": {
"main": [
[
{
"node": "WhatsApp FAQ AI Agent",
"type": "main",
"index": 0
}
],
[
{
"node": "AI Order Information Extractor",
"type": "main",
"index": 0
}
],
[
{
"node": "AI Order ID Extractor",
"type": "main",
"index": 0
}
],
[
{
"node": "Notify Human Support Team",
"type": "main",
"index": 0
}
]
]
},
"Download Knowledge Base File": {
"main": [
[
{
"node": "Store Knowledge Embeddings In Pinecone",
"type": "main",
"index": 0
}
]
]
},
"Inventory Availability Check": {
"main": [
[
{
"node": "Create New Order Record",
"type": "main",
"index": 0
}
],
[
{
"node": "Send Product Error / Stock Failure Message",
"type": "main",
"index": 0
}
]
]
},
"Load Knowledge Base Document": {
"ai_document": [
[
{
"node": "Store Knowledge Embeddings In Pinecone",
"type": "ai_document",
"index": 0
}
]
]
},
"Parse Order Tracking Request": {
"main": [
[
{
"node": "Fetch Order Status",
"type": "main",
"index": 0
}
]
]
},
"Generate Knowledge Embeddings": {
"ai_embedding": [
[
{
"node": "Store Knowledge Embeddings In Pinecone",
"type": "ai_embedding",
"index": 0
}
]
]
},
"Knowledge Base Retrieval Tool": {
"ai_tool": [
[
{
"node": "WhatsApp FAQ AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"AI Order Information Extractor": {
"main": [
[
{
"node": "Parse Order Details JSON",
"type": "main",
"index": 0
}
]
]
},
"Parse & Validate Product Match": {
"main": [
[
{
"node": "Product Match Validation Check",
"type": "main",
"index": 0
}
]
]
},
"Product Match Validation Check": {
"main": [
[
{
"node": "Inventory Availability Check",
"type": "main",
"index": 0
}
],
[
{
"node": "Send Product Error / Stock Failure Message",
"type": "main",
"index": 0
}
]
]
},
"Prepare Product Catalog Context": {
"main": [
[
{
"node": "AI Semantic Product Matcher",
"type": "main",
"index": 0
}
]
]
},
"Extract WhatsApp Message Details": {
"main": [
[
{
"node": "AI Intent Classification",
"type": "main",
"index": 0
}
]
]
},
"Split Knowledge Base Into Chunks": {
"ai_textSplitter": [
[
{
"node": "Load Knowledge Base Document",
"type": "ai_textSplitter",
"index": 0
}
]
]
},
"WhatsApp Incoming Message Trigger": {
"main": [
[
{
"node": "Extract WhatsApp Message Details",
"type": "main",
"index": 0
}
]
]
},
"Knowledge Base File Change Trigger": {
"main": [
[
{
"node": "Download Knowledge Base File",
"type": "main",
"index": 0
}
]
]
},
"Parse Intent Classification Response": {
"main": [
[
{
"node": "Intent-Based Request Router",
"type": "main",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
googleDriveOAuth2ApigoogleSheetsOAuth2ApiopenAiApipineconeApislackApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow builds a WhatsApp business assistant that uses OpenAI to classify incoming messages and route them to FAQ answers via Pinecone RAG, order placement and inventory updates in Google Sheets, order-status lookups, or Slack escalation for human support, with a Google…
Source: https://n8n.io/workflows/16175/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
📌 Overview
Alfred (funcional). Uses gmailTool, googleCalendarTool, gmail, embeddingsOpenAi. Event-driven trigger; 83 nodes.
Your AI workforce is ready. Are you?
This comprehensive workflow bundle is designed as a powerful starter kit, enabling you to build a multi-functional AI assistant on Telegram. It seamlessly integrates AI-powered voice interactions, an
Agent IA Projet Client. Uses executeWorkflowTrigger, lmChatOpenAi, toolWorkflow, vectorStoreQdrant. Event-driven trigger; 79 nodes.