8
n8n 中文网amn8n.com

基于 GPT-4、Stripe 和 CRM 集成的 WooCommerce 对话式销售代理

高级

这是一个AI Chatbot, Multimodal AI领域的自动化工作流,包含 27 个节点。主要使用 Set, GoogleDrive, HttpRequest, TelegramTool, ManualTrigger 等节点。 基于 GPT-4、Stripe 和 CRM 集成的 WooCommerce 对话式销售代理

前置要求
  • Google Drive API 凭证
  • 可能需要目标 API 的认证凭证
  • Telegram Bot Token
  • OpenAI API Key
  • Qdrant 服务器连接信息
  • Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "783d2046f405cc6ecb20ef185376ed1023323a3da628b9d8156b1fb75c75e037",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "6ba11958-a915-44d5-828d-5502e020848f",
      "name": "当收到聊天消息时",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        240,
        -496
      ],
      "webhookId": "SALES-CHAT-TRIGGER",
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "b4c04258-79b5-4c46-94c7-969d837a6857",
      "name": "当点击“执行工作流”时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        224,
        -1216
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "b9a981fb-41eb-455a-9078-f91bdbed110d",
      "name": "编辑字段 1",
      "type": "n8n-nodes-base.set",
      "position": [
        448,
        -496
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "s1",
              "name": "sessionId",
              "type": "string",
              "value": "={{ $json.sessionId }}"
            },
            {
              "id": "s2",
              "name": "chatInput",
              "type": "string",
              "value": "={{ $json.chatInput }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "f94da395-1334-4466-8d5a-d300a70f5119",
      "name": "Window Buffer Memory1",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        1168,
        -224
      ],
      "parameters": {
        "sessionKey": "={{ $('Edit Fields1').item.json.sessionId }}",
        "sessionIdType": "customKey",
        "contextWindowLength": 12
      },
      "typeVersion": 1.3
    },
    {
      "id": "f4c91458-29e6-4814-a64d-e512ac5da230",
      "name": "Sales Info Extractor1",
      "type": "@n8n/n8n-nodes-langchain.informationExtractor",
      "position": [
        672,
        -496
      ],
      "parameters": {
        "text": "={{ $json.chatInput }}",
        "options": {
          "systemPromptTemplate": "You extract buyer intent (product|faq|payment|lead) and fields (keyword, sku, min_price, max_price, name, email). Prices are numbers only. Do not hallucinate."
        },
        "schemaType": "manual",
        "inputSchema": "{\n  \"intents\": { \"product\": true, \"faq\": true, \"payment\": true, \"lead\": true },\n  \"fields\": {\n    \"keyword\": \"\",\n    \"sku\": \"\",\n    \"min_price\": \"\",\n    \"max_price\": \"\",\n    \"name\": \"\",\n    \"email\": \"\"\n  }\n}"
      },
      "typeVersion": 1
    },
    {
      "id": "e102585a-a1a8-48b6-afdb-ed4eb69a638e",
      "name": "OpenAI Chat Model (Extractor)1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        768,
        -336
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "TmPSRVY5JCpWCR5d",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "562d9402-9902-4eb3-a6ca-a87f388b45e7",
      "name": "Sales AI Agent1",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1200,
        -496
      ],
      "parameters": {
        "options": {
          "systemMessage": "=## Role\nYou are Sales AI Agent. Use tools only.\n\n## Routing\n- If extractor.intents.faq = true => use RAG_FAQ.\n- If extractor.intents.product = true => PRODUCT_SEARCH_WOO, then INVENTORY_DETAIL_WOO for shortlisted SKU.\n- If extractor.intents.payment = true => PAYMENT_LINK.\n- If name+email present => CRM_LEAD.\n- If blocked/unsure => HUMAN_ESCALATION.\n\n## Output\n- List products as: Title | Price | In stock | URL/Handle | SKU.\n- Always propose next actions: (1) Xem thêm lựa chọn, (2) Lấy link thanh toán, (3) Nói chuyện với tư vấn viên.\n\nToday is {{$now}}."
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "2ab2d2c1-5182-49d0-911f-85b6f2349070",
      "name": "OpenAI Chat Model (Agent)1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1040,
        -224
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "TmPSRVY5JCpWCR5d",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "5469d03d-4a0f-410f-afc8-09083f697395",
      "name": "Qdrant Vector Store (runtime)1",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
      "position": [
        1248,
        -64
      ],
      "parameters": {
        "options": {},
        "qdrantCollection": {
          "__rl": true,
          "mode": "list",
          "value": "sales_docs",
          "cachedResultName": "sales_docs"
        }
      },
      "credentials": {
        "qdrantApi": {
          "id": "WuffyG4RFaqOwLb4",
          "name": "QdrantApi account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "c3d1075f-e019-4e47-92ca-0efc5d937c3f",
      "name": "RAG_FAQ1",
      "type": "@n8n/n8n-nodes-langchain.toolVectorStore",
      "position": [
        1328,
        -256
      ],
      "parameters": {
        "name": "RAG_FAQ",
        "description": "Answer FAQs/policies/specs from vector store"
      },
      "typeVersion": 1
    },
    {
      "id": "4cbfa8de-aae7-4d9e-bc76-42e002b92a27",
      "name": "Embeddings OpenAI (runtime)1",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        1248,
        80
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "TmPSRVY5JCpWCR5d",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "eb21abb7-76c0-4353-874c-0138a6581b84",
      "name": "PRODUCT_SEARCH_WOO1",
      "type": "n8n-nodes-base.wooCommerceTool",
      "position": [
        1728,
        -208
      ],
      "parameters": {
        "options": {
          "sku": "={{ $('Sales Info Extractor1').item.json.fields.sku }}",
          "search": "={{ $('Sales Info Extractor1').item.json.fields.keyword }}",
          "maxPrice": "={{ $('Sales Info Extractor1').item.json.fields.max_price }}",
          "minPrice": "={{ $('Sales Info Extractor1').item.json.fields.min_price }}",
          "stockStatus": "instock"
        },
        "operation": "getAll"
      },
      "credentials": {
        "wooCommerceApi": {
          "id": "xEyvCU5Qw9lQh7WS",
          "name": "WooCommerce account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "c608958f-cda9-42f2-9ce4-86a02a8e1f0b",
      "name": "INVENTORY_DETAIL_WOO1",
      "type": "n8n-nodes-base.wooCommerceTool",
      "position": [
        1904,
        -208
      ],
      "parameters": {
        "operation": "get",
        "productId": "={{ $fromAI('product_id', '', 'string') }}"
      },
      "credentials": {
        "wooCommerceApi": {
          "id": "xEyvCU5Qw9lQh7WS",
          "name": "WooCommerce account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "68eb6073-8be1-4f3b-88fc-9c28fa7b8a63",
      "name": "PAYMENT_LINK1",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        1712,
        -384
      ],
      "parameters": {
        "name": "paymentLinkAgent",
        "workflowId": {
          "__rl": true,
          "mode": "list",
          "value": "PAYLINK-AGENT-ID",
          "cachedResultName": "Payment Link Agent"
        },
        "description": "Create a Stripe payment link for chosen items",
        "workflowInputs": {
          "value": {},
          "schema": [],
          "mappingMode": "defineBelow",
          "matchingColumns": []
        }
      },
      "typeVersion": 2
    },
    {
      "id": "965d4268-2fd0-4d8b-9957-38001836ee21",
      "name": "CRM_LEAD1",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        1888,
        -384
      ],
      "parameters": {
        "name": "crmAgent",
        "workflowId": {
          "__rl": true,
          "mode": "list",
          "value": "CRM-AGENT-ID",
          "cachedResultName": "CRM Agent"
        },
        "description": "Create/Update lead in CRM (HubSpot/Pipedrive)",
        "workflowInputs": {
          "value": {},
          "schema": [],
          "mappingMode": "defineBelow",
          "matchingColumns": []
        }
      },
      "typeVersion": 2
    },
    {
      "id": "d1f0bbeb-4fa0-48a6-907f-33ca8aed1a32",
      "name": "HUMAN_ESCALATION1",
      "type": "n8n-nodes-base.telegramTool",
      "position": [
        2096,
        -208
      ],
      "webhookId": "ESCALATE-TELEGRAM",
      "parameters": {
        "text": "={{ $fromAI('Text', '', 'string') }}",
        "chatId": "SALES-ESCALATION-CHAT",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "uxQixTID04QTjn2f",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "c3ee1206-bc01-499d-a687-fb044d0996e8",
      "name": "Qdrant Wipe1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        432,
        -1216
      ],
      "parameters": {
        "url": "=https://xxxxxxxxxx.qdrant.io:6333/collections/sales_docs/points/delete",
        "method": "POST",
        "options": {},
        "jsonBody": "{\n  \"filter\": {}\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "NnFliEyH7K6sFnlI",
          "name": "Header Auth account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "d901677d-46d4-4891-a289-a626b19f419c",
      "name": "Google Drive: List1",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        624,
        -1216
      ],
      "parameters": {
        "filter": {
          "driveId": {
            "__rl": true,
            "mode": "list",
            "value": "My Drive",
            "cachedResultName": "My Drive"
          },
          "folderId": {
            "__rl": true,
            "mode": "list",
            "value": "DRIVE_FOLDER_ID",
            "cachedResultName": "Sales Docs"
          }
        },
        "options": {},
        "resource": "fileFolder"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "7ksMk3zwMvT2CToN",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "ac729d26-43f7-46db-ad7c-81523ebaa0a8",
      "name": "Google Drive: Download1",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        832,
        -1216
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "options": {
          "googleFileConversion": {
            "conversion": {
              "docsToFormat": "text/plain"
            }
          }
        },
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "7ksMk3zwMvT2CToN",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "936e6bf5-06f3-469d-82e6-04b4e6f5d9fe",
      "name": "Default Data Loader1",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        1120,
        -1024
      ],
      "parameters": {
        "options": {},
        "dataType": "binary"
      },
      "typeVersion": 1
    },
    {
      "id": "12b5d80d-3c78-47e4-960c-93396dc6a252",
      "name": "Token Splitter1",
      "type": "@n8n/n8n-nodes-langchain.textSplitterTokenSplitter",
      "position": [
        1120,
        -880
      ],
      "parameters": {
        "chunkSize": 300,
        "chunkOverlap": 30
      },
      "typeVersion": 1
    },
    {
      "id": "aedd2f0f-fd7b-4f44-b8c7-fa497e9b8485",
      "name": "Embeddings OpenAI (build)1",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        992,
        -1008
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "TmPSRVY5JCpWCR5d",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "db9980d3-176b-4236-b002-ec552c023118",
      "name": "Qdrant Vector Store (insert)1",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreQdrant",
      "position": [
        1040,
        -1216
      ],
      "parameters": {
        "mode": "insert",
        "options": {},
        "qdrantCollection": {
          "__rl": true,
          "mode": "list",
          "value": "sales_docs",
          "cachedResultName": "sales_docs"
        }
      },
      "credentials": {
        "qdrantApi": {
          "id": "WuffyG4RFaqOwLb4",
          "name": "QdrantApi account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "6ce8870c-9150-44cb-86e2-ef55a2f0931f",
      "name": "Google Gemini 聊天模型1",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        1536,
        -64
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "id": "Atcc45Iqep6u15qs",
          "name": "Google Gemini(PaLM) Api account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "7d78df3f-98d7-4d53-af20-ad6dd1ca1d3c",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        208,
        -320
      ],
      "parameters": {
        "color": 5,
        "width": 528,
        "height": 320,
        "content": "🛒 **WooCommerce AI Sales Agent – Overview**\n\nThis workflow turns n8n into an **AI-powered sales assistant** for WooCommerce.  \nIt can:  \n- Detect customer intent (FAQ, product search, payment, lead capture).  \n- Search products directly in WooCommerce and show stock details.  \n- Answer FAQs using RAG with Qdrant + Google Drive documents.  \n- Generate Stripe payment links for checkout.  \n- Capture leads into CRM (HubSpot/Pipedrive).  \n- Escalate unclear cases to human agents via Telegram.  \n\nResult: A **24/7 automated sales agent** that helps customers from discovery → payment → lead capture.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "6462a494-08bc-43ef-ac60-405f1a5861bb",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -496,
        -720
      ],
      "parameters": {
        "color": 3,
        "width": 528,
        "height": 256,
        "content": "⚙️ **Setup & Customization Notes**\n\nBefore using this workflow:  \n1. 🔑 Connect credentials: WooCommerce API, Stripe, CRM, Google Drive, OpenAI/Gemini, Qdrant, Telegram.  \n2. 🌍 Adjust language/localization (`hl`, `gl`) if needed for your market.  \n3. 📂 Update Google Drive folder ID where your sales docs are stored.  \n4. 🗑️ Use “Qdrant Wipe” if you want to re-index fresh documents.  \n5. ✏️ Customize agent’s response style (formal, casual, short/long) in the `Sales AI Agent` system prompt.  \n"
      },
      "typeVersion": 1
    },
    {
      "id": "e2641b81-60fb-48c2-b763-a3b55864fa44",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        208,
        -1056
      ],
      "parameters": {
        "color": 5,
        "width": 528,
        "height": 352,
        "content": "📂 **Knowledge Base Update Flow**\n\nPurpose: Keeps the AI’s FAQ knowledge accurate and up to date.  \n\nHow it works:  \n1. **Trigger (Manual Execute)** → Run when you want to refresh the knowledge base.  \n2. **Qdrant Wipe** → Clears all old vectors.  \n3. **Google Drive List & Download** → Loads all sales/policy documents from the configured folder.  \n4. **Splitter + Embeddings** → Splits text into chunks and creates embeddings.  \n5. **Qdrant Insert** → Stores embeddings in vector DB for retrieval (RAG).  \n\n💡 Use this flow whenever sales policies, product docs, or FAQs are updated.  \n"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "RAG_FAQ1": {
      "ai_tool": [
        [
          {
            "node": "Sales AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "CRM_LEAD1": {
      "ai_tool": [
        [
          {
            "node": "Sales AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields1": {
      "main": [
        [
          {
            "node": "Sales Info Extractor1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Qdrant Wipe1": {
      "main": [
        [
          {
            "node": "Google Drive: List1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "PAYMENT_LINK1": {
      "ai_tool": [
        [
          {
            "node": "Sales AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Token Splitter1": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader1",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "HUMAN_ESCALATION1": {
      "ai_tool": [
        [
          {
            "node": "Sales AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive: List1": {
      "main": [
        [
          {
            "node": "Google Drive: Download1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "PRODUCT_SEARCH_WOO1": {
      "ai_tool": [
        [
          {
            "node": "Sales AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader1": {
      "ai_document": [
        [
          {
            "node": "Qdrant Vector Store (insert)1",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "INVENTORY_DETAIL_WOO1": {
      "ai_tool": [
        [
          {
            "node": "Sales AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Sales Info Extractor1": {
      "main": [
        [
          {
            "node": "Sales AI Agent1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Window Buffer Memory1": {
      "ai_memory": [
        [
          {
            "node": "Sales AI Agent1",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive: Download1": {
      "main": [
        [
          {
            "node": "Qdrant Vector Store (insert)1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "RAG_FAQ1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI (build)1": {
      "ai_embedding": [
        [
          {
            "node": "Qdrant Vector Store (insert)1",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model (Agent)1": {
      "ai_languageModel": [
        [
          {
            "node": "Sales AI Agent1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "Edit Fields1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI (runtime)1": {
      "ai_embedding": [
        [
          {
            "node": "Qdrant Vector Store (runtime)1",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model (Extractor)1": {
      "ai_languageModel": [
        [
          {
            "node": "Sales Info Extractor1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Qdrant Vector Store (runtime)1": {
      "ai_vectorStore": [
        [
          {
            "node": "RAG_FAQ1",
            "type": "ai_vectorStore",
            "index": 0
          }
        ]
      ]
    },
    "When clicking 'Execute workflow'": {
      "main": [
        [
          {
            "node": "Qdrant Wipe1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级 - AI 聊天机器人, 多模态 AI

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量27
分类2
节点类型19
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
Cong Nguyen

Cong Nguyen

@cong-nguyen

I’m a developer specialized in building web and mobile applications with AI integration and intelligent automation. With a solid background in data science, I help businesses build smarter digital solutions using cutting-edge technologies.

外部链接
在 n8n.io 查看

分享此工作流