自动化潜在客户捕获:AI个性化WhatsApp消息通过Unipile和Google Sheets CRM
这是一个Lead Nurturing、Multimodal AI领域的自动化工作流,包含 9 个节点。主要使用 If、FormTrigger、GoogleSheets、HttpRequestTool、OpenAi 等节点。 自动化潜在客户捕获:AI个性化WhatsApp消息通过Unipile和Google Sheets CRM
- •Google Sheets API 凭证
- •可能需要目标 API 的认证凭证
- •OpenAI API Key
{
"meta": {
"instanceId": "28099d2544433ae0f39c65315a4d4c531947fcb0f060a94d6047d7be5df31063",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "a5bab74c-c9ec-44cb-9103-4180ac1ddaa3",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
300,
-60
],
"parameters": {
"width": 1080,
"height": 540,
"content": "## 潜在客户捕获代理"
},
"typeVersion": 1
},
{
"id": "1fadce0b-758c-4030-a7cc-d79718097bad",
"name": "Google Sheets",
"type": "n8n-nodes-base.googleSheets",
"position": [
1180,
-40
],
"parameters": {
"columns": {
"value": {
"Name": "={{ $('Enquiry Form').item.json['Full Name'] }}",
"Email": "={{ $('Enquiry Form').item.json.Email }}",
"Error": "={{ $json.message.content.Reason }}",
"Notes": "={{ $('Enquiry Form').item.json['How can we help you?'] }}",
"Phone": "={{ $('Enquiry Form').item.json.Whatsapp }}",
"Company": "={{ $('Enquiry Form').item.json['Company Name'] }}",
"Message": "={{ $('OpenAI').item.json.message.content.Message }}",
"Submitted_at": "={{ $('Enquiry Form').first().json.submittedAt }}"
},
"schema": [
{
"id": "Submitted_at",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Submitted_at",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Error",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Error",
"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": "Company",
"type": "string",
"display": true,
"required": false,
"displayName": "Company",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Notes",
"type": "string",
"display": true,
"required": false,
"displayName": "Notes",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Message",
"type": "string",
"display": true,
"required": false,
"displayName": "Message",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Chat_id",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Chat_id",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Message_id",
"type": "string",
"display": true,
"required": false,
"displayName": "Message_id",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"Submitted_at"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "appendOrUpdate",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 352770436,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1JeAwOvYurzX54kGpktXAmQS54owHp7W_2HMbS5i4ghk/edit#gid=352770436",
"cachedResultName": "Failed"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1JeAwOvYurzX54kGpktXAmQS54owHp7W_2HMbS5i4ghk",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1JeAwOvYurzX54kGpktXAmQS54owHp7W_2HMbS5i4ghk/edit?usp=drivesdk",
"cachedResultName": "Sales Agent"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "NdBpgqV7UHdZ3CZc",
"name": "Google Sheets account"
}
},
"typeVersion": 4.6
},
{
"id": "d7c49d33-65f7-4c30-bfb5-5ebcd5ac7200",
"name": "OpenAI",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
560,
60
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini",
"cachedResultName": "GPT-4.1-MINI"
},
"options": {},
"messages": {
"values": [
{
"content": "=You are Alex, a friendly, approachable, and slightly humorous human assistant. Your primary role is to personally connect with individuals who have submitted a contact form, gather more details efficiently, and be their main point of contact.\n\nContext of this interaction:\nYou have just reviewed a new Inquiry Form submission.\n\nThe user's full name is {{ $json['Full Name'] }}.\nCheck if they provided context in {{ $json['How can we help you?'] }}\nYour Task:\nCraft a short, to-the-point, and positive opening message to the user. Your message should be from you, Alex. It needs to be personalized and engaging, getting straight to how you can help.\n\nStart your message with \"Hey {{ $('Enquiry Form').item.json['Full Name'].split(\" \")[0] }}\nUse if they provided context in {{ $json['How can we help you?'] }}\nEnd with a clear and concise open-ended question that encourages them to share key details about what they are hoping to achieve or their specific needs.\nCrucially, you are the direct point of contact. Maintain a helpful, enthusiastic, and efficient tone. Do NOT mention that someone else will get back to them or that you are just passing along information.\n\nUSE THE WHATSAPP API TOOL TO ACTUALLY SEND THE MESSAGE\nthe attendees-ids is {{ $json.Whatsapp }}\nAnd if theres WHATSAPP API TOOL SENDS AN ERROR then \n\n#Output \n\n1. IF the Whatsapp API tool Send an error Output:\n{\n \"Status\": \"Fail\",\n \"Message\": \"the personalised message\",\n \"Reason\": \"reason why it failed\"\n}\n\n2. IF the Whatsapp API tool succeeds then output:\n{\n \"Status\": \"Success\",\n \"Message\": \"the personalised message\",\n \"chat_id\": \"the chat id\"\n \"message_id\": \"the message id\"\n}"
}
]
},
"jsonOutput": true
},
"credentials": {
"openAiApi": {
"id": "uWBH2cCJc8959CiP",
"name": "OpenAi GainFlow"
}
},
"typeVersion": 1.8
},
{
"id": "dc8feaeb-0f0a-4b25-9f31-871c451c02fa",
"name": "条件判断",
"type": "n8n-nodes-base.if",
"position": [
940,
60
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "5852aeb9-926d-4aac-9835-77e210f4b38e",
"operator": {
"type": "string",
"operation": "contains"
},
"leftValue": "={{ $json.message.content.Status }}",
"rightValue": "Fail"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "ca0ad300-8589-40df-bbe9-7c1fb60bc5fe",
"name": "Whatsapp API",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
860,
320
],
"parameters": {
"url": "https://<YOUR_DSN>/api/v1/chats",
"method": "POST",
"options": {},
"sendBody": true,
"contentType": "multipart-form-data",
"sendHeaders": true,
"bodyParameters": {
"parameters": [
{
"name": "attendees_ids",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters0_Value', ``, 'string') }}"
},
{
"name": "text",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters1_Value', ``, 'string') }}"
},
{
"name": "account_id",
"value": "<YOUR_ACCOUNT_ID>"
}
]
},
"toolDescription": "It Access the whatsapp api and sends the message",
"headerParameters": {
"parameters": [
{
"name": "X-API-KEY",
"value": "<YOUR_API_KEY>"
},
{
"name": "accept",
"value": "application/json"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "dfed3abe-95b3-4fff-b383-cbab92eb5c53",
"name": "Google Sheets3",
"type": "n8n-nodes-base.googleSheets",
"position": [
1180,
160
],
"parameters": {
"columns": {
"value": {
"Name": "={{ $('Enquiry Form').first().json['Full Name'] }}",
"Email": "={{ $('Enquiry Form').first().json.Email }}",
"Notes": "={{ $('Enquiry Form').first().json['How can we help you?'] }}",
"Phone": "={{ $('Enquiry Form').first().json.Whatsapp }}",
"Chat_id": "={{ $('OpenAI').first().json.message.content.chat_id }}",
"Company": "={{ $('Enquiry Form').first().json['Company Name'] }}",
"Message": "={{ $('OpenAI').first().json.message.content.Message }}",
"Message_id": "={{ $('OpenAI').first().json.message.content.message_id }}",
"Submitted_at": "={{ $('Enquiry Form').first().json.submittedAt }}"
},
"schema": [
{
"id": "Submitted_at",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Submitted_at",
"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": "Company",
"type": "string",
"display": true,
"required": false,
"displayName": "Company",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Notes",
"type": "string",
"display": true,
"required": false,
"displayName": "Notes",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Message",
"type": "string",
"display": true,
"required": false,
"displayName": "Message",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Chat_id",
"type": "string",
"display": true,
"required": false,
"displayName": "Chat_id",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Message_id",
"type": "string",
"display": true,
"required": false,
"displayName": "Message_id",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"Submitted_at"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "appendOrUpdate",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1JeAwOvYurzX54kGpktXAmQS54owHp7W_2HMbS5i4ghk/edit#gid=0",
"cachedResultName": "Successful"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1JeAwOvYurzX54kGpktXAmQS54owHp7W_2HMbS5i4ghk",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1JeAwOvYurzX54kGpktXAmQS54owHp7W_2HMbS5i4ghk/edit?usp=drivesdk",
"cachedResultName": "Sales Agent"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "NdBpgqV7UHdZ3CZc",
"name": "Google Sheets account"
}
},
"typeVersion": 4.6
},
{
"id": "e41f6b86-90ed-4831-adb3-7acc3f6cf0c9",
"name": "便签 2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-200,
-60
],
"parameters": {
"width": 500,
"height": 540,
"content": "## 1. 资源"
},
"typeVersion": 1
},
{
"id": "1f39b8a1-a42d-424c-b6b1-b14e1d1a50e9",
"name": "咨询表单",
"type": "n8n-nodes-base.formTrigger",
"position": [
360,
60
],
"webhookId": "a34f7372-b42d-4176-ac9b-2518d85c125d",
"parameters": {
"options": {},
"formTitle": "Inquiry Form",
"formFields": {
"values": [
{
"fieldLabel": "Full Name",
"requiredField": true
},
{
"fieldLabel": "Email",
"requiredField": true
},
{
"fieldLabel": "Whatsapp"
},
{
"fieldLabel": "Company Name"
},
{
"fieldLabel": "How can we help you?"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "63ad7169-79c1-471a-82f1-191d0281bcbd",
"name": "便签 1",
"type": "n8n-nodes-base.stickyNote",
"position": [
420,
240
],
"parameters": {
"color": 4,
"width": 600,
"height": 220,
"content": "## 为什么选择 Unipile?因为它允许您发送消息而无需任何先前的聊天历史记录,并且还允许您连接您的个人 whatsapp。"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"If": {
"main": [
[
{
"node": "Google Sheets",
"type": "main",
"index": 0
}
],
[
{
"node": "Google Sheets3",
"type": "main",
"index": 0
}
]
]
},
"OpenAI": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"Enquiry Form": {
"main": [
[
{
"node": "OpenAI",
"type": "main",
"index": 0
}
]
]
},
"Whatsapp API": {
"ai_tool": [
[
{
"node": "OpenAI",
"type": "ai_tool",
"index": 0
}
]
]
}
}
}如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
这是一个中级难度的工作流,适用于Lead Nurturing、Multimodal AI等场景。适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
Gain FLow AI
@gain-flowGainFlow AI is your go-to AI automation agency, specializing in Python and no-code solutions to eliminate repetitive tasks for individuals and businesses. Free up your time and boost efficiency. For inquiries, Fill this [form](https://docs.google.com/forms/d/e/1FAIpQLSfIiXdw4HMcI2HM-Obng13j_RFiKv7X-mjOVm_mcy2ucRA8EA/viewform) reach out to us at info.gainflow@gmail.com.
分享此工作流