网站线索管理:联系表单提交至WhatsApp和Google Sheets
这是一个Lead Generation、Multimodal AI领域的自动化工作流,包含 5 个节点。主要使用 Code、Webhook、WhatsApp、GoogleSheets 等节点。 网站线索管理:联系表单提交至WhatsApp和Google Sheets
- •HTTP Webhook 端点(n8n 会自动生成)
- •Google Sheets API 凭证
使用的节点 (5 个)
{
"meta": {
"instanceId": "",
"templateCredsSetupCompleted": false
},
"nodes": [
{
"id": "5b107486-adfa-4430-be2d-2df453153abe",
"name": "联系表单触发器",
"type": "n8n-nodes-base.webhook",
"position": [
0,
96
],
"webhookId": "",
"parameters": {
"path": "get_data",
"options": {},
"httpMethod": "POST"
},
"typeVersion": 2.1
},
{
"id": "dc65e52c-41f6-4335-8b76-2cfb72406a1b",
"name": "格式化潜在客户数据",
"type": "n8n-nodes-base.code",
"position": [
224,
96
],
"parameters": {
"jsCode": "// Process all incoming webhook items\nconst items = $input.all().map(item => {\n const data = item.json.body || item.json || {};\n\n // Helper function to clean and format values\n const clean = (val) => (val || \"\").toString().trim() || \"N/A\";\n\n const name = clean(data.name);\n const email = clean(data.email);\n const phone = clean(data.phone);\n const service = clean(data.service);\n const message = clean(data.message);\n\n // Add timestamp for context\n const receivedAt = new Date().toLocaleString(\"en-IN\", {\n timeZone: \"Asia/Kolkata\"\n });\n\n // Format the WhatsApp message\n const formattedText =\n `📩 *New Contact Form Submission*\\n` +\n `━━━━━━━━━━━━━━\\n` +\n `👤 *Name:* ${name}\\n` +\n `📧 *Email:* ${email}\\n` +\n `📱 *Phone:* ${phone}\\n` +\n `🛠 *Service:* ${service}\\n` +\n `💬 *Message:* ${message}\\n` +\n `🕒 *Received At:* ${receivedAt}`;\n\n return {\n json: {\n name,\n email,\n phone,\n service,\n message,\n receivedAt,\n formattedText\n }\n };\n});\n\nreturn items;\n"
},
"typeVersion": 2
},
{
"id": "c4bc9fb0-897d-4945-abfa-01d48aa0c593",
"name": "WhatsApp 提醒",
"type": "n8n-nodes-base.whatsApp",
"position": [
448,
0
],
"webhookId": "",
"parameters": {
"textBody": "={{ $json.formattedText }}",
"operation": "send",
"phoneNumberId": "YOUR_PHONE_NUMBER_ID",
"additionalFields": {},
"recipientPhoneNumber": "YOUR_MOBILE_NUMBER"
},
"credentials": {
"whatsAppApi": {
"id": "",
"name": "WhatsApp Business API"
}
},
"typeVersion": 1
},
{
"id": "a5f08d80-3448-4f2f-b811-4f2e01c6e2aa",
"name": "记录到数据库",
"type": "n8n-nodes-base.googleSheets",
"position": [
448,
192
],
"parameters": {
"columns": {
"value": {
"date": "={{ $json.receivedAt }}",
"name": "={{ $json.name }}",
"email": "={{ $json.email }}",
"phone": "={{ $json.phone }}",
"message": "={{ $json.message }}",
"service": "={{ $json.service }}"
},
"schema": [
{
"id": "date",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "date",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "name",
"type": "string",
"display": true,
"required": false,
"displayName": "name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "email",
"type": "string",
"display": true,
"required": false,
"displayName": "email",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "phone",
"type": "string",
"display": true,
"required": false,
"displayName": "phone",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "service",
"type": "string",
"display": true,
"required": false,
"displayName": "service",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "message",
"type": "string",
"display": true,
"required": false,
"displayName": "message",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"date"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "appendOrUpdate",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_SPREADSHEET_ID/edit#gid=0",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "YOUR_SPREADSHEET_ID",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_SPREADSHEET_ID/edit",
"cachedResultName": "Lead Database"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "",
"name": "Google Sheets OAuth2 API"
}
},
"typeVersion": 4.7
},
{
"id": "939dac5d-3cd0-4716-8185-f0bfd125e9ea",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-624,
-336
],
"parameters": {
"width": 1392,
"height": 864,
"content": "## 🎯 网站潜在客户管理:将联系表单提交发送到 WhatsApp 和 Google Sheets"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"Format Lead Data": {
"main": [
[
{
"node": "WhatsApp Alert",
"type": "main",
"index": 0
},
{
"node": "Log to Database",
"type": "main",
"index": 0
}
]
]
},
"Contact Form Trigger": {
"main": [
[
{
"node": "Format Lead Data",
"type": "main",
"index": 0
}
]
]
}
}
}如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
这是一个初级难度的工作流,适用于Lead Generation、Multimodal AI等场景。适合 n8n 新手,包含 1-5 个节点的简单工作流
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
Roshan Ramani
@rawsun007I love building smart n8n automations that actually work reliably. My focus is on making everyday tasks like email, social media, and CRM workflows simpler using AI. I've shared templates in the n8n community, including a WhatsApp Expense Tracker that people really enjoy. What keeps me excited is constantly trying new things - testing fresh nodes, playing with AI tools like LangChain, and discovering creative ways to connect systems!
分享此工作流