8
n8n 中文网amn8n.com

基于 Gemini 2.0 Flash AI 和 Google Sheets 的对话式线索捕获

中级

这是一个Lead Generation, AI Chatbot领域的自动化工作流,包含 10 个节点。主要使用 Webhook, Agent, GoogleSheetsTool, RespondToWebhook, LmChatGoogleGemini 等节点。 基于 Gemini 2.0 Flash AI 和 Google Sheets 的对话式线索捕获

前置要求
  • HTTP Webhook 端点(n8n 会自动生成)
  • Google Sheets API 凭证
  • Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "2000c64071c20843606b95c63795bb0797c41036047055a6586498e855b96efc"
  },
  "nodes": [
    {
      "id": "f4127c9c-ac82-435c-b9ab-919b767680fa",
      "name": "响应 Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "notes": "💬 REAL-TIME RESPONSE DELIVERY - INSTANT GRATIFICATION\n\nDelivers the AI's response back to your chat interface in milliseconds. Creates the illusion of instant human interaction that keeps prospects engaged.\n\n✅ RESPONSE OPTIMIZATION:\n• Sub-2-second response time (faster than human typing)\n• Formats responses for your specific chat platform\n• Maintains conversation state across multiple exchanges\n• Handles error states gracefully (AI failures, rate limits)\n• Supports rich media responses (links, images, documents)\n• Mobile-optimized formatting for all screen sizes\n\n📤 RESPONSE STRUCTURE:\n{\n  \"message\": \"Thanks for your interest! What type of project are you working on?\",\n  \"action\": \"continue\", // or \"complete\" when qualified\n  \"metadata\": {\n    \"leadScore\": 85,\n    \"nextSteps\": \"schedule-demo\",\n    \"priority\": \"high\"\n  }\n}\n\n🎯 CONVERSION OPTIMIZATION:\n• Fast responses prevent prospect abandonment\n• Consistent messaging reduces confusion\n• Smart routing based on conversation stage\n• Automatic escalation triggers for high-value leads\n• Integration with calendar booking for demos\n\n⚙️ ADVANCED FEATURES:\n• Typing indicators for human-like experience\n• Message read receipts and delivery confirmation\n• Fallback responses for API failures\n• Rate limiting protection and queue management\n• Multi-language support based on prospect location\n\n🔧 CUSTOMIZATION OPTIONS:\n• Adjust response format for your chat platform\n• Add custom metadata for your CRM integration\n• Configure error handling and retry logic\n• Set up A/B testing for different response styles\n\n💡 PRO TIP: Monitor response times in your analytics. Any delay over 3 seconds significantly reduces conversion rates.",
      "position": [
        240,
        -120
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "8bec2419-1971-47f1-8959-4e71a51f8799",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "notes": "🌐 UNIVERSAL CHAT CONNECTOR - YOUR WEBSITE'S FRONT DOOR\n\nThe entry point that connects ANY chat platform to your AI agent. This webhook makes your lead capture system platform-agnostic and future-proof.\n\n✅ UNIVERSAL INTEGRATION:\n• Works with ANY chat widget (Intercom, Crisp, Tidio, custom)\n• Connects to WhatsApp Business API for messaging\n• Integrates with Facebook Messenger and Instagram DM\n• Handles contact forms, popup modals, and embedded chat\n• Processes email inquiries and social media messages\n• Mobile app integration ready\n\n📝 EXPECTED DATA FORMAT:\n{\n  \"message\": \"Hi, I need help with AI automation\",\n  \"sessionId\": \"visitor-12345-timestamp\",\n  \"source\": \"website-chat\" // optional for tracking\n}\n\n🔧 INTEGRATION EXAMPLES:\n• WordPress: Simple JavaScript fetch() call\n• Shopify: Webhook to this endpoint from chat apps\n• React/Vue: Axios POST with conversation state\n• Zapier: Connect 2000+ platforms instantly\n• Make.com: Visual integration builder\n\n🎯 BUSINESS SCALING:\n• One workflow handles all customer touchpoints\n• Consistent lead qualification across all channels\n• Centralized conversation analytics and reporting\n• A/B test different conversation flows easily\n• Scale from 10 to 10,000 conversations seamlessly\n\n⚡ QUICK SETUP:\n1. Copy this webhook URL\n2. Add to your chat widget's webhook settings\n3. Send test message with proper JSON format\n4. Verify response appears in your chat interface\n\n💡 PRO TIP: Include 'source' field in requests to track which channels generate the highest-quality leads.",
      "position": [
        -280,
        -120
      ],
      "webhookId": "b7d8aa99-594d-46f8-b928-f68571fee00c",
      "parameters": {
        "path": "4777b330-6bf9-460e-aaf0-52d6263d17d7",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2
    },
    {
      "id": "69a763e3-0d4d-4c86-90d6-498c65e1fcb8",
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheetsTool",
      "notes": "📊 INTELLIGENT LEAD DATA STORAGE - STRUCTURED DATA FROM CHAOS\n\nAutomatically extracts and organizes lead information from natural conversation into your CRM. No more manual data entry or missed details!\n\n✅ AI-POWERED DATA EXTRACTION:\n• $fromAI() functions intelligently parse conversation text\n• Extracts contact info, project details, budget, timeline\n• Handles partial data (fills in gaps as conversation progresses)\n• Validates and formats data automatically (emails, phone numbers)\n• Appends new leads as rows in real-time\n• Never loses a lead due to human error\n\n🎯 BUSINESS VALUE:\n• Saves 15-20 minutes per lead on manual data entry\n• 100% accurate lead capture (no typos or missed fields)\n• Instant CRM integration for your sales team\n• Real-time lead notifications and follow-up triggers\n• Complete conversation history stored for context\n• Lead scoring based on budget, timeline, and project scope\n\n🔧 SETUP CHECKLIST:\n1. Create Google Sheet with headers matching schema\n2. Connect Google Sheets OAuth in n8n credentials\n3. Update documentId to your sheet URL\n4. Test with sample conversation data\n5. Set up conditional formatting for lead prioritization\n\n📈 ADVANCED FEATURES TO ADD:\n• Timestamp for lead velocity tracking\n• Lead source attribution for marketing ROI\n• Automatic lead scoring (A/B/C priority)\n• Integration with Zapier for multi-platform sync\n• Duplicate detection and merge functionality\n\n💡 PRO TIP: Add conditional formatting in Google Sheets to highlight high-value leads (budget >$10k, timeline <30 days) for immediate follow-up.",
      "position": [
        220,
        160
      ],
      "parameters": {
        "columns": {
          "value": {
            "Full Name": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Full_Name', ``, 'string') }}",
            "Budget Range": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Budget_Range', ``, 'string') }}",
            "Company Name": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Company_Name', ``, 'string') }}",
            "Phone Number": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Phone_Number', ``, 'string') }}",
            "Email Address": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Email_Address', ``, 'string') }}",
            "Project Timeline": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Project_Timeline', ``, 'string') }}",
            "Project Intent/Needs": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Project_Intent_Needs', ``, 'string') }}",
            "How they heard about DAEX AI": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('How_they_heard_about_DAEX_AI', ``, 'string') }}",
            "Preferred Communication Channel": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Preferred_Communication_Channel', ``, 'string') }}"
          },
          "schema": [
            {
              "id": "Full Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Full Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Company Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Company Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email Address",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Email Address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Phone Number",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Phone Number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Project Intent/Needs",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Project Intent/Needs",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Project Timeline",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Project Timeline",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Budget Range",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Budget Range",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Preferred Communication Channel",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Preferred Communication Channel",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "How they heard about DAEX AI",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "How they heard about DAEX AI",
              "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/1OBxt6TX3edgxiSYnsULCuSM5OL7GYlA6W3DjNYBEpfo/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1OBxt6TX3edgxiSYnsULCuSM5OL7GYlA6W3DjNYBEpfo",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1OBxt6TX3edgxiSYnsULCuSM5OL7GYlA6W3DjNYBEpfo/edit?usp=drivesdk",
          "cachedResultName": "client intake form"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "b0RUCwZZREhRN85o",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "d2679c41-cd73-480c-8066-6c14c388a528",
      "name": "简单记忆",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "notes": "💭 CONVERSATION MEMORY - NO MORE \"WHAT'S YOUR NAME AGAIN?\"\n\nKeeps track of conversation history so your AI doesn't ask the same questions twice or lose context mid-conversation. Essential for natural, human-like interactions.\n\n✅ WHAT IT REMEMBERS:\n• Customer's name and company details\n• Previously discussed project requirements\n• Budget range and timeline preferences\n• Questions already asked and answered\n• Context from earlier in the conversation\n• Emotional tone and customer preferences\n\n🔧 MEMORY CONFIGURATION:\n• sessionId: Separates different website visitors (never mix conversations!)\n• 9 messages = ~4-5 back-and-forth exchanges\n• Includes both customer messages AND AI responses\n• Automatically expires after session ends\n\n🎯 BUSINESS VALUE:\n• Creates seamless conversation experience\n• Reduces customer frustration from repeated questions\n• Enables complex, multi-topic discussions\n• Allows for intelligent follow-up questions\n• Maintains context even if customer refreshes page\n\n⚙️ TUNING OPTIONS:\n• Increase contextWindowLength (10-20) for longer sales conversations\n• Decrease (5-7) for simple lead capture to save memory/costs\n• Use persistent memory for returning customers (requires database)\n\n💡 PRO TIP: Monitor memory usage in logs to optimize for your conversation patterns. Longer memory = better context but higher costs.",
      "position": [
        -40,
        80
      ],
      "parameters": {
        "sessionKey": "={{ $json.body.sessionId }}",
        "sessionIdType": "customKey",
        "contextWindowLength": 9
      },
      "typeVersion": 1.3
    },
    {
      "id": "22983be8-6b3f-47bb-a9ab-85cc4bc24172",
      "name": "Google Gemini 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "notes": "🧠 AI LANGUAGE MODEL - THE BRAIN BEHIND THE CONVERSATION\n\nPowers the conversational intelligence with Google's latest multimodal AI. This is what makes your chatbot sound human and handle complex customer inquiries.\n\n✅ WHY GEMINI 2.0 FLASH:\n• Lightning-fast responses (under 2 seconds) = no awkward waiting\n• Excellent at maintaining natural conversation flow\n• Cost-effective for high-volume lead capture ($0.000075 per 1K tokens)\n• Strong reasoning for complex customer questions and objections\n• Multimodal capabilities (can handle text, images, and more)\n• Built-in safety filters and brand-appropriate responses\n\n💰 COST BREAKDOWN:\n• ~1,000 conversations per month = $15-25 in API costs\n• Compare to: One sales rep salary = $4,000-8,000/month\n• ROI is immediate and scales infinitely\n\n🔧 SETUP OPTIONS:\n• Get Google AI Studio API key (free tier: 15 requests/minute)\n• Alternative models: GPT-4, Claude, or local Ollama models\n• Adjust temperature for more/less creative responses\n• Set max tokens to control response length and costs\n\n🎯 BUSINESS IMPACT:\n• Handles multiple conversations simultaneously\n• Never gets tired, frustrated, or has bad days\n• Consistent quality regardless of volume\n• Can be trained on your specific industry knowledge",
      "position": [
        -220,
        180
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.0-flash-exp"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "JIcO9tQRn5DgQtBN",
          "name": "Google Gemini(PaLM) Api account 2"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f1e4f258-7527-4c6d-84c4-c5b1da74df9a",
      "name": "AI 代理",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "notes": "🤖 CONVERSATIONAL AI BRAIN - THE SALES REP THAT NEVER SLEEPS\n\nThis is your automated sales assistant that handles lead qualification 24/7. Think of it as your best sales rep working around the clock.\n\n✅ WHAT IT DOES:\n• Welcomes visitors with human-like warmth and personality\n• Asks qualifying questions naturally (no robotic forms!)\n• Remembers context throughout the entire conversation\n• Handles objections and answers FAQs about your services\n• Extracts and saves complete lead data automatically\n• Maintains conversation flow even with complex customer questions\n\n🎯 BUSINESS VALUE:\n• Captures leads while you sleep (24/7 availability)\n• Qualifies prospects before they hit your calendar\n• Saves 2-3 hours daily on manual lead intake\n• Converts 30-40% more website visitors into qualified leads\n• Consistent messaging that matches your brand voice\n\n🔧 CUSTOMIZATION POINTS:\n• Update company name/description in system message\n• Modify qualifying questions for your specific business\n• Adjust conversation tone for your brand personality\n• Add your unique service offerings and FAQs\n• Set lead scoring criteria based on responses\n\n💡 PRO TIP: The more specific you make the system message about your services and ideal customers, the better it qualifies leads and handles objections.",
      "position": [
        -100,
        -120
      ],
      "parameters": {
        "text": "={{ $json.body.message }} ",
        "options": {
          "systemMessage": "=You are a Welcome Agent for a company specializing in building custom AI assistants to suit client needs, including sales bots, data extraction tools, and automated customer service systems. Your role is to collect client information through a natural, conversational approach, answer FAQs, and save information to Google Sheets.\n\nCRITICAL INSTRUCTIONS:\n1. Begin with ONE friendly, warm welcome message introducing yourself and the company as a custom AI assistant developer.\n2. LISTEN CAREFULLY to what clients say and respond conversationally:\n  - Use natural language with occasional filler words like \"actually\" or \"you know\"\n  - Vary your sentence structure and length to sound more human\n  - Ask follow-up questions about interesting points they mention\n  - If they ask questions about services, answer them as a knowledgeable team member would\n  - Acknowledge their emotions and respond empathetically\n\n3. Collect all required information naturally, weaving questions into conversation:\n  a. Full Name\n  b. Company Name\n  c. Email Address\n  d. Phone Number (mention this is optional)\n  e. Project Intent/Needs\n  f. Project Timeline\n  g. Budget Range\n  h. Preferred Communication Channel\n  i. How they heard about the company\n\n4. Remember what they've told you and reference it later in conversation\n5. Be conversational when acknowledging responses: \"That's great to hear\" instead of \"Information acknowledged\"\n6. Use their name occasionally and mirror their communication style\n7. After collecting ALL information, provide a friendly summary of the conversation\n8. Then use the saveToGoogleSheets function to save the data\n\nCONVERSATION APPROACH:\n- Welcome them like a real person would: \"Hi there! I'm [Name] from [Company]. What brings you to our site today?\"\n- Have genuine-sounding reactions: \"That's exactly the kind of challenge we help with!\"\n- If they ask questions, answer conversationally, not like a knowledge base\n- Transition naturally: \"By the way, I didn't catch your name?\" rather than \"Please provide your full name\"\n- Add occasional personal touches: \"I worked with a similar project last month, actually\"\n- Express enthusiasm about their project specifically\n\nKEY FAQ KNOWLEDGE:\n- Explain all company services conversationally, like you're excited about them\n- Emphasize specialty in customizing AI assistants with real examples\n- Give approximate timelines based on past projects, not generic ranges\n- Discuss pricing honestly but tactfully\n- Talk about integration capabilities from personal experience\n- Discuss AI capabilities with nuance, not marketing speak\n\nAfter collecting all information, CALL THE SAVE FUNCTION:\nsaveToGoogleSheets([\n new Date().toISOString(),\n fullName,\n companyName,\n emailAddress,\n phoneNumber,\n projectIntent,\n projectTimeline,\n budgetRange,\n preferredCommunicationChannel,\n referralSource\n]);\n\nThen say something friendly and specific to their situation: \"Thanks so much, [Name]! I've passed your information to our team. Given your interest in [specific need they mentioned], I think you'll really enjoy talking with our specialists. Someone will reach out to you [timeframe based on their urgency].\"\n\nHUMAN-LIKE BEHAVIORS:\n- Occasionally start sentences with conjunctions (And, But, So)\n- Use contractions (I'm, we're, you'll) consistently\n- React to surprising or interesting information they share\n- Admit when you don't know something instead of giving generic answers\n- Use humor appropriately when the conversation allows for it\n- Show genuine interest in their business challenges\n- Don't sound overly scripted or perfectly structured in responses"
        },
        "promptType": "define"
      },
      "typeVersion": 1.8
    },
    {
      "id": "4371b7e4-4635-434e-b206-29d56f673eef",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        -160
      ],
      "parameters": {
        "height": 240,
        "content": "## Webhook 入口点"
      },
      "typeVersion": 1
    },
    {
      "id": "9714adba-d2ab-4633-9a30-4a65e8a0fac8",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        380,
        -160
      ],
      "parameters": {
        "height": 340,
        "content": "## 响应输出"
      },
      "typeVersion": 1
    },
    {
      "id": "58365a2a-41df-49ea-9872-9a355deef92e",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -520,
        160
      ],
      "parameters": {
        "width": 400,
        "height": 220,
        "content": "## AI 处理核心"
      },
      "typeVersion": 1
    },
    {
      "id": "9cb625cd-a34a-4195-9828-550642f70659",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        60,
        200
      ],
      "parameters": {
        "width": 360,
        "height": 280,
        "content": "## 数据存储到电子表格"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 潜在客户开发, AI 聊天机器人

需要付费吗?

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

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

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

作者
David Olusola

David Olusola

@dae221

AI automation consultant working with ambitious businesses on their most complex operational challenges. For project inquiries, reach me at david@daexai.com

外部链接
在 n8n.io 查看

分享此工作流