8
n8n 中文网amn8n.com

AI网站聊天机器人 - GPT与Google表格CRM线索收集

中级

这是一个Lead Generation, Multimodal AI领域的自动化工作流,包含 14 个节点。主要使用 Code, GoogleSheets, Agent, ChatTrigger, LmChatOpenAi 等节点。 集成GPT和Google表格的AI网站聊天机器人 - CRM线索收集系统

前置要求
  • Google Sheets API 凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "ad0113c344ee237399e44e9f11798b05baeb83a6196d514a9ae9d2ad71c3b5c9",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "a917cc6d-ac5b-425b-877f-e40347b49c4c",
      "name": "当收到聊天消息时",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        1360,
        2016
      ],
      "webhookId": "3768e882-2c41-4d64-a68a-5bdfb4adab43",
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.3
    },
    {
      "id": "71c6b7dc-23fd-4a5f-a4f2-58cde14f2f9f",
      "name": "当由另一个工作流执行时",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        208,
        1872
      ],
      "parameters": {
        "inputSource": "passthrough"
      },
      "typeVersion": 1.1
    },
    {
      "id": "df400ef3-17dd-48f0-9f19-d3d43e3f1eb9",
      "name": "OpenAI Chat Model3",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1520,
        2176
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "4l6TDfLZVFS24g3X",
          "name": "OpenAi account 4"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "59356e4b-8b1f-4187-b727-17a792392bb6",
      "name": "Simple Memory3",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        1680,
        2176
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "c96fcd55-592a-461b-991f-8f403f3a472d",
      "name": "OpenAI Chat Model4",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        448,
        2176
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "4l6TDfLZVFS24g3X",
          "name": "OpenAi account 4"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "30ba5186-a271-4d6e-a219-6a0262ef20d7",
      "name": "网站聊天机器人",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1632,
        1984
      ],
      "parameters": {
        "options": {
          "systemMessage": "You are the first point of contact for visitors on our website. We are a consulting firm that helps companies automate their internal processes using n8n, an open-source workflow automation platform.\n\nKeep answers brief. \n\nOur services include:\n\nDesigning and implementing automations using n8n\n\nReplacing manual work with fully automated workflows\n\nTraining teams to manage and scale automations in-house\n\nYour primary goals are:\n\nBriefly explain what we do in a helpful, conversational tone.\n\nAsk the visitor what kinds of processes they’re hoping to automate or what challenges they’re facing.\n\nCollect their name and email address so someone from our team can follow up.\n\nBe friendly, curious, and professional. If the visitor shares their contact information, confirm it and thank them — and pass the details to our CRM workflow.\n\n\nAfter you have the email address, and what the user needs. send all the info all together to the crm tool. "
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "bc45a7ff-b74f-4901-96f0-2a818358ffaf",
      "name": "转换对话",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        464,
        1936
      ],
      "parameters": {
        "text": "=query {{ $json.query }}",
        "options": {
          "systemMessage": "You are a formatting assistant. Format the incoming query. Your only job is to extract and convert the input into clean, valid JSON.\n\nOnly return a JSON object like this:\n\noutput email in json like this. \n\n{\n  \"email\": \"jane.doe@example.com\",\n  \"description\": \"Wants help automating lead intake and sending Slack notifications.\"\n}\n\n\n"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "81a753e0-4198-4841-ac41-e9efb4b69ad9",
      "name": "结构化输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        640,
        2176
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"email\": \"jane.doe@example.com\",\n  \"description\": \"Wants help automating lead intake and sending Slack notifications.\"\n}\n"
      },
      "typeVersion": 1.3
    },
    {
      "id": "7ef56380-f69f-4e48-8c42-bc5706fdcfe1",
      "name": "在表格中追加行",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        816,
        1952
      ],
      "parameters": {
        "columns": {
          "value": {
            "email": "={{ $json.output.email }}",
            "description": "={{ $json.output.description }}"
          },
          "schema": [
            {
              "id": "email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "description",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Lr54_U6khrE8jjU-rocf0N1Phe7ZIovLppTjBzIraZk/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1Lr54_U6khrE8jjU-rocf0N1Phe7ZIovLppTjBzIraZk",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Lr54_U6khrE8jjU-rocf0N1Phe7ZIovLppTjBzIraZk/edit?usp=drivesdk",
          "cachedResultName": "Sample Leads"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "HlBW2puZbuCCq8jJ",
          "name": "Google Sheets account 3"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "a1b29f7c-efd0-46cc-989a-b72c01adb970",
      "name": "代码",
      "type": "n8n-nodes-base.code",
      "position": [
        1040,
        1936
      ],
      "parameters": {
        "jsCode": "return [\n  {\n    json: {\n      text: \"Thanks for the info, we will be in touch soon\"\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "e5a327d0-cfae-484e-8468-ef92d161b3b8",
      "name": "CRM工具",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        1840,
        2176
      ],
      "parameters": {
        "source": "parameter",
        "description": "用于存储潜在客户信息的CRM工具",
        "workflowJson": "{\n  \"nodes\": [\n    {\n      \"parameters\": {\n        \"inputSource\": \"passthrough\"\n      },\n      \"type\": \"n8n-nodes-base.executeWorkflowTrigger\",\n      \"typeVersion\": 1.1,\n      \"position\": [\n        176,\n        1248\n      ],\n      \"id\": \"71c6b7dc-23fd-4a5f-a4f2-58cde14f2f9f\",\n      \"name\": \"When Executed by Another Workflow\"\n    },\n    {\n      \"parameters\": {\n        \"model\": {\n          \"__rl\": true,\n          \"value\": \"gpt-4o-mini\",\n          \"mode\": \"list\",\n          \"cachedResultName\": \"gpt-4o-mini\"\n        },\n        \"options\": {}\n      },\n      \"type\": \"@n8n/n8n-nodes-langchain.lmChatOpenAi\",\n      \"typeVersion\": 1.2,\n      \"position\": [\n        400,\n        1472\n      ],\n      \"id\": \"c96fcd55-592a-461b-991f-8f403f3a472d\",\n      \"name\": \"OpenAI Chat Model4\",\n      \"credentials\": {\n        \"openAiApi\": {\n          \"id\": \"4l6TDfLZVFS24g3X\",\n          \"name\": \"OpenAi account 4\"\n        }\n      }\n    },\n    {\n      \"parameters\": {\n        \"promptType\": \"define\",\n        \"text\": \"=query {{ $json.query }}\",\n        \"hasOutputParser\": true,\n        \"options\": {\n          \"systemMessage\": \"You are a formatting assistant. Format the incoming query. Your only job is to extract and convert the input into clean, valid JSON.\\n\\nOnly return a JSON object like this:\\n\\noutput email in json like this. \\n\\n{\\n  \\\"email\\\": \\\"jane.doe@example.com\\\",\\n  \\\"description\\\": \\\"Wants help automating lead intake and sending Slack notifications.\\\"\\n}\\n\\n\\n\"\n        }\n      },\n      \"type\": \"@n8n/n8n-nodes-langchain.agent\",\n      \"typeVersion\": 2.2,\n      \"position\": [\n        400,\n        1248\n      ],\n      \"id\": \"bc45a7ff-b74f-4901-96f0-2a818358ffaf\",\n      \"name\": \"Convert Conversation\"\n    },\n    {\n      \"parameters\": {\n        \"jsonSchemaExample\": \"{\\n  \\\"email\\\": \\\"jane.doe@example.com\\\",\\n  \\\"description\\\": \\\"Wants help automating lead intake and sending Slack notifications.\\\"\\n}\\n\"\n      },\n      \"type\": \"@n8n/n8n-nodes-langchain.outputParserStructured\",\n      \"typeVersion\": 1.3,\n      \"position\": [\n        576,\n        1456\n      ],\n      \"id\": \"81a753e0-4198-4841-ac41-e9efb4b69ad9\",\n      \"name\": \"Structured Output Parser\"\n    },\n    {\n      \"parameters\": {\n        \"operation\": \"append\",\n        \"documentId\": {\n          \"__rl\": true,\n          \"value\": \"1Lr54_U6khrE8jjU-rocf0N1Phe7ZIovLppTjBzIraZk\",\n          \"mode\": \"list\",\n          \"cachedResultName\": \"Sample Leads\",\n          \"cachedResultUrl\": \"https://docs.google.com/spreadsheets/d/1Lr54_U6khrE8jjU-rocf0N1Phe7ZIovLppTjBzIraZk/edit?usp=drivesdk\"\n        },\n        \"sheetName\": {\n          \"__rl\": true,\n          \"value\": \"gid=0\",\n          \"mode\": \"list\",\n          \"cachedResultName\": \"Sheet1\",\n          \"cachedResultUrl\": \"https://docs.google.com/spreadsheets/d/1Lr54_U6khrE8jjU-rocf0N1Phe7ZIovLppTjBzIraZk/edit#gid=0\"\n        },\n        \"columns\": {\n          \"mappingMode\": \"defineBelow\",\n          \"value\": {\n            \"email\": \"={{ $json.output.email }}\",\n            \"description\": \"={{ $json.output.description }}\"\n          },\n          \"matchingColumns\": [],\n          \"schema\": [\n            {\n              \"id\": \"email\",\n              \"displayName\": \"email\",\n              \"required\": false,\n              \"defaultMatch\": false,\n              \"display\": true,\n              \"type\": \"string\",\n              \"canBeUsedToMatch\": true,\n              \"removed\": false\n            },\n            {\n              \"id\": \"description\",\n              \"displayName\": \"description\",\n              \"required\": false,\n              \"defaultMatch\": false,\n              \"display\": true,\n              \"type\": \"string\",\n              \"canBeUsedToMatch\": true,\n              \"removed\": false\n            }\n          ],\n          \"attemptToConvertTypes\": false,\n          \"convertFieldsToString\": false\n        },\n        \"options\": {}\n      },\n      \"type\": \"n8n-nodes-base.googleSheets\",\n      \"typeVersion\": 4.6,\n      \"position\": [\n        752,\n        1248\n      ],\n      \"id\": \"7ef56380-f69f-4e48-8c42-bc5706fdcfe1\",\n      \"name\": \"Append row in sheet\",\n      \"credentials\": {\n        \"googleSheetsOAuth2Api\": {\n          \"id\": \"HlBW2puZbuCCq8jJ\",\n          \"name\": \"Google Sheets account 3\"\n        }\n      }\n    },\n    {\n      \"parameters\": {\n        \"jsCode\": \"return [\\n  {\\n    json: {\\n      text: \\\"Thanks for the info, we will be in touch soon\\\"\\n    }\\n  }\\n];\\n\"\n      },\n      \"type\": \"n8n-nodes-base.code\",\n      \"typeVersion\": 2,\n      \"position\": [\n        960,\n        1248\n      ],\n      \"id\": \"a1b29f7c-efd0-46cc-989a-b72c01adb970\",\n      \"name\": \"Code\"\n    }\n  ],\n  \"connections\": {\n    \"When Executed by Another Workflow\": {\n      \"main\": [\n        [\n          {\n            \"node\": \"Convert Conversation\",\n            \"type\": \"main\",\n            \"index\": 0\n          }\n        ]\n      ]\n    },\n    \"OpenAI Chat Model4\": {\n      \"ai_languageModel\": [\n        [\n          {\n            \"node\": \"Convert Conversation\",\n            \"type\": \"ai_languageModel\",\n            \"index\": 0\n          }\n        ]\n      ]\n    },\n    \"Convert Conversation\": {\n      \"main\": [\n        [\n          {\n            \"node\": \"Append row in sheet\",\n            \"type\": \"main\",\n            \"index\": 0\n          }\n        ]\n      ]\n    },\n    \"Structured Output Parser\": {\n      \"ai_outputParser\": [\n        [\n          {\n            \"node\": \"Convert Conversation\",\n            \"type\": \"ai_outputParser\",\n            \"index\": 0\n          }\n        ]\n      ]\n    },\n    \"Append row in sheet\": {\n      \"main\": [\n        [\n          {\n            \"node\": \"Code\",\n            \"type\": \"main\",\n            \"index\": 0\n          }\n        ]\n      ]\n    }\n  },\n  \"pinData\": {\n    \"When Executed by Another Workflow\": [\n      {\n        \"query\": \"New inquiry for n8n training from rbreen@ynteractive.com\"\n      }\n    ]\n  },\n  \"meta\": {\n    \"templateCredsSetupCompleted\": true,\n    \"instanceId\": \"ad0113c344ee237399e44e9f11798b05baeb83a6196d514a9ae9d2ad71c3b5c9\"\n  }\n}"
      },
      "typeVersion": 2.2
    },
    {
      "id": "d0ad32e5-013c-4da4-b0a0-f2884873157f",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1264,
        1312
      ],
      "parameters": {
        "color": 5,
        "width": 744,
        "height": 1036,
        "content": "## 2. 创建主工作流(网站聊天机器人)"
      },
      "typeVersion": 1
    },
    {
      "id": "7d06b640-726e-4cdf-80f1-a10c80675c10",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        1312
      ],
      "parameters": {
        "color": 6,
        "width": 1080,
        "height": 1036,
        "content": "## 分步设置说明"
      },
      "typeVersion": 1
    },
    {
      "id": "e08ba3af-eafd-43be-b23b-86baef135272",
      "name": "Sticky Note17",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        1152
      ],
      "parameters": {
        "width": 1840,
        "height": 128,
        "content": "## 📬 需要帮助或想要自定义此内容?"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {
    "When Executed by Another Workflow": [
      {
        "query": "New inquiry for n8n training from rbreen@ynteractive.com"
      }
    ]
  },
  "connections": {
    "crm tool": {
      "ai_tool": [
        [
          {
            "node": "Website Chatbot",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory3": {
      "ai_memory": [
        [
          {
            "node": "Website Chatbot",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model3": {
      "ai_languageModel": [
        [
          {
            "node": "Website Chatbot",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model4": {
      "ai_languageModel": [
        [
          {
            "node": "Convert Conversation",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Append row in sheet": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert Conversation": {
      "main": [
        [
          {
            "node": "Append row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Convert Conversation",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "Website Chatbot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "Convert Conversation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 潜在客户开发, 多模态 AI

需要付费吗?

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

工作流信息
难度等级
中级
节点数量14
分类2
节点类型10
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
Robert Breen

Robert Breen

@rbreen

Professional services consultant with over 10 years of experience solving complex business problems across industries. I specialize in n8n and process automation—designing custom workflows that integrate tools like Google Calendar, Airtable, GPT, and internal systems. Whether you need to automate scheduling, sync data, or streamline operations, I build solutions that save time and drive results.

外部链接
在 n8n.io 查看

分享此工作流