8
n8n 中文网amn8n.com

用于潜在客户捕获和业务问答的 AI Chatbot

高级

这是一个Lead Nurturing, AI Chatbot领域的自动化工作流,包含 17 个节点。主要使用 GoogleDrive, Agent, GoogleSheetsTool, GoogleDriveTrigger, ChatTrigger 等节点。 基于 GPT-4o、Pinecone 和 Google Sheets 的自动化线索捕获与业务问答

前置要求
  • Google Drive API 凭证
  • Google Sheets API 凭证
  • OpenAI API Key
  • Pinecone API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "R07KTq4pioC2A0oL",
  "meta": {
    "instanceId": "82cad572864ecfae931ea0fa4a2122d5ad401b8f2cb25fb3ff144b553e0d676d"
  },
  "name": "用于潜在客户捕获和业务问答的 AI Chatbot",
  "tags": [],
  "nodes": [
    {
      "id": "083c6eeb-bc14-43a9-ae83-3545ba49444c",
      "name": "Google Drive 触发器",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        -100,
        60
      ],
      "parameters": {
        "event": "fileCreated",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "mode": "list",
          "value": "1UDedbXYGMpviGjiHLbYpTXmERrnQYvy4",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1UDedbXYGMpviGjiHLbYpTXmERrnQYvy4",
          "cachedResultName": "Rag App"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "ba298cb7-50de-4aa3-a87c-1e826724ffa8",
      "name": "Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        120,
        60
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "options": {},
        "operation": "download"
      },
      "typeVersion": 3
    },
    {
      "id": "525e9fdb-b424-49a2-8d47-1fd6dfad5e7f",
      "name": "Pinecone Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        340,
        60
      ],
      "parameters": {
        "mode": "insert",
        "options": {
          "pineconeNamespace": "Q&A"
        },
        "pineconeIndex": {
          "__rl": true,
          "mode": "id",
          "value": "pineconeIndex"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "05dfceca-03ec-48ca-97a1-c8a03df55bf4",
      "name": "OpenAI 嵌入",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        240,
        260
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "0ef50e4c-19c1-468d-83b7-d108297b57cb",
      "name": "默认数据加载器",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        440,
        240
      ],
      "parameters": {
        "options": {},
        "dataType": "binary"
      },
      "typeVersion": 1
    },
    {
      "id": "819b7187-fdc3-4b66-8658-c9b9e029157f",
      "name": "递归字符文本分割器",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        400,
        420
      ],
      "parameters": {
        "options": {},
        "chunkSize": 500,
        "chunkOverlap": 20
      },
      "typeVersion": 1
    },
    {
      "id": "fb6b0698-8ac7-41bb-b3b3-9f0ab56903f0",
      "name": "当收到聊天消息时",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -100,
        680
      ],
      "webhookId": "854c829c-2ce6-426f-89e2-ed44d33182f3",
      "parameters": {
        "mode": "webhook",
        "public": true,
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "0a6f0695-a028-4e26-9648-0c8b66b15627",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        320,
        680
      ],
      "parameters": {
        "options": {
          "systemMessage": "=## Role:\nYou are a friendly assistant for a Company named *New Company**.\n\n## Task:\nYou answer questions about the business.\n\n## Details:\nYou have access to various tools, which you use correctly.\n\n## Tools:\n- **newCompany_q**  \n  Use this tool to answer questions with knowledge about the company.\n\n- **sheets**  \n  Use this tool to store contact information such as name, email, interestet in and phone number.\n\nAfter a customer asks about opening hours, products, location, or business information, ask them for their name, email, specific interests and phone number.\n"
        }
      },
      "typeVersion": 1.7
    },
    {
      "id": "2f6f4f3c-fa64-40be-97e6-db66a65f21ae",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        80,
        900
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "gpt-4o"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "ac7eff3d-de14-4921-b980-0bccd327492e",
      "name": "窗口缓冲内存",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        240,
        900
      ],
      "parameters": {
        "contextWindowLength": 12
      },
      "typeVersion": 1.3
    },
    {
      "id": "562d791b-c360-4fdb-b238-3518d4c39a04",
      "name": "OpenAI 聊天模型1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        720,
        1140
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "gpt-4o"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "553af7e0-7f68-4d90-992a-b998b30952af",
      "name": "Pinecone 向量存储1",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        380,
        1120
      ],
      "parameters": {
        "options": {
          "pineconeNamespace": "Q&A"
        },
        "pineconeIndex": {
          "__rl": true,
          "mode": "id",
          "value": "=pineconeIndex"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "0ea4f43e-3e55-4da4-a43e-dfbdf1e435ef",
      "name": "Embeddings OpenAI1",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        340,
        1280
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "dac4e2e6-23a3-4afa-a0a3-ef5b1f296219",
      "name": "newCompany_q",
      "type": "@n8n/n8n-nodes-langchain.toolVectorStore",
      "position": [
        480,
        900
      ],
      "parameters": {
        "description": "提供与 newCompany 公司相关的答案"
      },
      "typeVersion": 1.1
    },
    {
      "id": "d05ee3f4-a112-4221-810c-49a717bb0720",
      "name": "在Google Sheets中添加行",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        800,
        920
      ],
      "parameters": {
        "columns": {
          "value": {
            "Name": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Name', ``, 'string') }}",
            "Email": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Email', ``, 'string') }}",
            "Phone": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Phone', ``, 'string') }}",
            "Interestet in": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Interestet_in', ``, 'string') }}"
          },
          "schema": [
            {
              "id": "Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Phone",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Phone",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Interestet in",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Interestet in",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "id",
          "value": "="
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": ""
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "08fb98b6-74b3-466b-a529-012996f7ebac",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1320,
        0
      ],
      "parameters": {
        "color": 2,
        "width": 1060,
        "height": 540,
        "content": "## 第一部分 – 公司信息存储到 Pinecone Vector Store"
      },
      "typeVersion": 1
    },
    {
      "id": "a5b192a3-e660-4492-a312-4d409dbd954b",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1320,
        680
      ],
      "parameters": {
        "color": 5,
        "width": 1060,
        "height": 740,
        "content": "## 第二部分 – 用于潜在客户捕获和业务问答的 AI Chatbot"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "cd9bd04e-8114-474b-a8a7-3802a869811f",
  "connections": {
    "Google Drive": {
      "main": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "newCompany_q": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI1": {
      "ai_embedding": [
        [
          {
            "node": "Pinecone Vector Store1",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "newCompany_q",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive Trigger": {
      "main": [
        [
          {
            "node": "Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Window Buffer Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Pinecone Vector Store1": {
      "ai_vectorStore": [
        [
          {
            "node": "newCompany_q",
            "type": "ai_vectorStore",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Recursive Character Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "Append row in sheet in Google Sheets": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 客户培育, AI 聊天机器人

需要付费吗?

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

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

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

作者
外部链接
在 n8n.io 查看

分享此工作流