使用 Rapiwa API 通过 WhatsApp 向客户发送 WooCommerce 交叉销售优惠
高级
这是一个Social Media领域的自动化工作流,包含 23 个节点。主要使用 If, Code, Wait, HttpRequest, WooCommerce 等节点。 使用 Rapiwa API 通过 WhatsApp 向客户发送 WooCommerce 交叉销售优惠
前置要求
- •可能需要目标 API 的认证凭证
- •Google Sheets API 凭证
分类
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "4E5TwaHxpZXOkqr9",
"meta": {
"instanceId": "cb9a1e5321767b6316634728341237e564b2587ab15b74ca0a89eb02a53484d6",
"templateCredsSetupCompleted": true
},
"name": "使用Rapiwa API通过WhatsApp向客户发送WooCommerce交叉销售优惠",
"tags": [],
"nodes": [
{
"id": "3aa7faa0-03bf-4c72-a367-814e04c7364b",
"name": "获取多个客户",
"type": "n8n-nodes-base.wooCommerce",
"position": [
224,
624
],
"parameters": {
"filters": {},
"resource": "customer",
"operation": "getAll",
"returnAll": true
},
"credentials": {
"wooCommerceApi": {
"id": "BZ5Lp9IB4Phney4R",
"name": "WooCommerce (get customer)"
}
},
"typeVersion": 1
},
{
"id": "c6727ef0-e304-4dfb-a5e4-8ce05b0c0292",
"name": "由 Github 模型提供支持",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-64,
624
],
"parameters": {
"rule": {
"interval": [
{}
]
}
},
"typeVersion": 1.2
},
{
"id": "b7688e2b-954b-4aa0-839c-16a6ae6242bc",
"name": "遍历项目",
"type": "n8n-nodes-base.splitInBatches",
"position": [
720,
624
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "574cdebf-bedc-40c3-9bf1-fe63777703fa",
"name": "如果",
"type": "n8n-nodes-base.if",
"position": [
3280,
640
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "3ab8725a-9268-45fd-b91c-0e055fe6fa7c",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json.data.exists }}",
"rightValue": "=\"true\""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "8c573bbd-192d-4db0-a59a-27bcd642d45f",
"name": "代码(获取付费客户)",
"type": "n8n-nodes-base.code",
"position": [
464,
624
],
"parameters": {
"jsCode": "const buyingCustomers = [];\n\nfor (const item of $input.all()) {\n const spent = parseFloat(item.json.total_spent || '0');\n \n if (item.json.is_paying_customer === true || spent > 0) {\n buyingCustomers.push(item);\n }\n}\n\nreturn buyingCustomers;"
},
"typeVersion": 2
},
{
"id": "06fb86fe-e45e-4037-aa2c-988b6c181e0d",
"name": "代码(清理数据)",
"type": "n8n-nodes-base.code",
"position": [
2048,
640
],
"parameters": {
"jsCode": "const products = $input.all();\n\nconst output = [];\n\nfor (const item of products) {\n const categories = item.json.categories || [];\n\n output.push({\n json: {\n product_id: item.json.id,\n product_name: item.json.name,\n categories\n }\n });\n}\n\nreturn output;\n"
},
"typeVersion": 2
},
{
"id": "b37e5fb1-8359-419a-a8d9-0030ec6ba007",
"name": "等待",
"type": "n8n-nodes-base.wait",
"position": [
3728,
736
],
"webhookId": "6c474e54-eb3c-4fcd-b455-948322cd0121",
"parameters": {},
"typeVersion": 1.1
},
{
"id": "e0add6a7-717e-4ea3-b5cb-a151aa3d8ff4",
"name": "使用Rapiwa检查有效的WhatsApp号码",
"type": "n8n-nodes-base.httpRequest",
"position": [
2800,
640
],
"parameters": {
"url": "=https://app.rapiwa.com/api/verify-whatsapp",
"method": "POST",
"options": {},
"sendBody": true,
"authentication": "genericCredentialType",
"bodyParameters": {
"parameters": [
{
"name": "number",
"value": "={{ $('get most buy product id & Clear Number').item.json.phone }}"
}
]
},
"genericAuthType": "httpBearerAuth"
},
"credentials": {
"httpBearerAuth": {
"id": "jnaHCyYia9OAFozh",
"name": "Rapiwa Bearer YOUR_TOKEN_HERE"
}
},
"typeVersion": 4.2
},
{
"id": "66f15998-30e3-4469-9850-17479d133d14",
"name": "获取客户数据",
"type": "n8n-nodes-base.httpRequest",
"position": [
1024,
640
],
"parameters": {
"url": "=https://your_shop_domain/wp-json/wc/v3/orders?customer={{ $json.id }}",
"options": {},
"authentication": "predefinedCredentialType",
"nodeCredentialType": "wooCommerceApi"
},
"credentials": {
"wooCommerceApi": {
"id": "wCSD3jy3Zr3RsXpF",
"name": "WooCommerce (get customer data)"
}
},
"typeVersion": 4.2
},
{
"id": "12bbeaa6-64c2-45dc-a964-cb10763c0952",
"name": "获取特定产品数据",
"type": "n8n-nodes-base.httpRequest",
"position": [
1760,
640
],
"parameters": {
"url": "=https://your_shop_domain/wp-json/wc/v3/products/{{ $json.product_id }}",
"options": {},
"authentication": "predefinedCredentialType",
"nodeCredentialType": "wooCommerceApi"
},
"credentials": {
"wooCommerceApi": {
"id": "wCSD3jy3Zr3RsXpF",
"name": "WooCommerce (get customer data)"
}
},
"typeVersion": 4.2
},
{
"id": "346fb83b-2e7c-4d4c-a20c-e03225f367e7",
"name": "获取特定产品推荐最新产品",
"type": "n8n-nodes-base.httpRequest",
"position": [
2416,
640
],
"parameters": {
"url": "=https://your_shop_domain/wp-json/wc/v3/products?category={{ $json.categories[0].id }}&orderby=date&order=desc&per_page=1",
"options": {},
"authentication": "predefinedCredentialType",
"nodeCredentialType": "wooCommerceApi"
},
"credentials": {
"wooCommerceApi": {
"id": "wCSD3jy3Zr3RsXpF",
"name": "WooCommerce (get customer data)"
}
},
"typeVersion": 4.2
},
{
"id": "335b6260-c039-4e9e-b8f2-5a25d954972a",
"name": "获取最常购买产品ID和清理号码",
"type": "n8n-nodes-base.code",
"position": [
1296,
640
],
"parameters": {
"jsCode": "const items = $input.all();\n\n// First, clean the \"phone\" field in billing of all orders\nconst cleanedItems = items.map(item => {\n const billing = item?.json?.billing;\n if (billing && billing.phone) {\n const rawPhone = String(billing.phone);\n const cleanedPhone = rawPhone.replace(/\\D/g, \"\"); // remove non-digits\n item.json.billing.phone = cleanedPhone;\n }\n return item;\n});\n\nlet topProduct = null;\n\n// Then, find the top product by quantity from cleaned items\nfor (const order of cleanedItems) {\n const lineItems = order.json.line_items || [];\n const billing = order.json.billing || {};\n\n for (const item of lineItems) {\n if (item.product_id) {\n const currentProduct = {\n json: {\n product_id: item.product_id,\n product_name: item.name || \"\",\n quantity: item.quantity || 0,\n customer_name: `${billing.first_name || ''} ${billing.last_name || ''}`.trim(),\n email: billing.email || '',\n address: billing.address_1 || '',\n phone: billing.phone || ''\n }\n };\n\n if (!topProduct || currentProduct.json.quantity > topProduct.json.quantity) {\n topProduct = currentProduct;\n }\n }\n }\n}\n\nreturn topProduct ? [topProduct] : [];\n"
},
"typeVersion": 2
},
{
"id": "dccbbc8e-1618-4e4b-b3aa-8395883ad5e2",
"name": "在已验证和已发送中保存行状态",
"type": "n8n-nodes-base.googleSheets",
"position": [
3728,
528
],
"parameters": {
"columns": {
"value": {
"suk": "={{ $('get specific product recommend latest product').item.json.sku }}",
"name": "={{ $('get most buy product id & Clear Number').item.json.customer_name }}",
"email": "={{ $('get most buy product id & Clear Number').item.json.email }}",
"price": "={{ $('get specific product recommend latest product').item.json.price }}",
"staus": "sent",
"title": "={{ $('get specific product recommend latest product').item.json.name }}",
"number": "={{ $('get most buy product id & Clear Number').item.json.phone }}",
"address1": "={{ $('get most buy product id & Clear Number').item.json.address }}",
"validity": "verified",
"product link": "={{ $('get specific product recommend latest product').item.json.permalink }}"
},
"schema": [
{
"id": "name",
"type": "string",
"display": true,
"required": false,
"displayName": "name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "number",
"type": "string",
"display": true,
"required": false,
"displayName": "number",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "email",
"type": "string",
"display": true,
"required": false,
"displayName": "email",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "address1",
"type": "string",
"display": true,
"required": false,
"displayName": "address1",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "price",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "price",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "suk",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "suk",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "title",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "title",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "product link",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "product link",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "validity",
"type": "string",
"display": true,
"required": false,
"displayName": "validity",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "staus",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "staus",
"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/1yTxkAM1kq2udndvG5M2jUuQCY8SkvoLgrspQ100LvKs/edit#gid=0",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1yTxkAM1kq2udndvG5M2jUuQCY8SkvoLgrspQ100LvKs",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1yTxkAM1kq2udndvG5M2jUuQCY8SkvoLgrspQ100LvKs/edit?usp=drivesdk",
"cachedResultName": "Send WooCommerce Cross-Sell Offers to Customers via WhatsApp Using Rapiwa API"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "gFH3Wjq6yYqSEAei",
"name": "Google Sheets"
}
},
"typeVersion": 4.6
},
{
"id": "b8b8e6e2-d28a-4e7c-a55c-8df6ca64c4d5",
"name": "在未验证和未发送中保存行状态",
"type": "n8n-nodes-base.googleSheets",
"position": [
3504,
736
],
"parameters": {
"columns": {
"value": {
"suk": "={{ $('get specific product recommend latest product').item.json.sku }}",
"name": "={{ $('get most buy product id & Clear Number').item.json.customer_name }}",
"email": "={{ $('get most buy product id & Clear Number').item.json.email }}",
"price": "={{ $('get specific product recommend latest product').item.json.price }}",
"staus": "not sent",
"title": "={{ $('get specific product recommend latest product').item.json.name }}",
"number": "={{ $('get most buy product id & Clear Number').item.json.phone }}",
"address1": "={{ $('get most buy product id & Clear Number').item.json.address }}",
"validity": "unverified",
"product link": "={{ $('get specific product recommend latest product').item.json.permalink }}"
},
"schema": [
{
"id": "name",
"type": "string",
"display": true,
"required": false,
"displayName": "name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "number",
"type": "string",
"display": true,
"required": false,
"displayName": "number",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "email",
"type": "string",
"display": true,
"required": false,
"displayName": "email",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "address1",
"type": "string",
"display": true,
"required": false,
"displayName": "address1",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "price",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "price",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "suk",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "suk",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "title",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "title",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "product link",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "product link",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "validity",
"type": "string",
"display": true,
"required": false,
"displayName": "validity",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "staus",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "staus",
"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/1yTxkAM1kq2udndvG5M2jUuQCY8SkvoLgrspQ100LvKs/edit#gid=0",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1yTxkAM1kq2udndvG5M2jUuQCY8SkvoLgrspQ100LvKs",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1yTxkAM1kq2udndvG5M2jUuQCY8SkvoLgrspQ100LvKs/edit?usp=drivesdk",
"cachedResultName": "Send WooCommerce Cross-Sell Offers to Customers via WhatsApp Using Rapiwa API"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "gFH3Wjq6yYqSEAei",
"name": "Google Sheets"
}
},
"typeVersion": 4.6
},
{
"id": "773f0d84-2270-4714-854e-1bfc236c2a5c",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1392,
432
],
"parameters": {
"width": 1168,
"height": 1696,
"content": "# 使用Rapiwa API通过WhatsApp向客户发送WooCommerce交叉销售优惠"
},
"typeVersion": 1
},
{
"id": "0a51cbe3-e0c7-4c4a-b65b-d5536900194a",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
144,
272
],
"parameters": {
"width": 528,
"height": 688,
"content": "## 获取多个客户"
},
"typeVersion": 1
},
{
"id": "91a455c8-9ad2-4390-a750-40c92683a8b3",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-160,
432
],
"parameters": {
"color": 7,
"width": 288,
"height": 368,
"content": "## 计划触发器"
},
"typeVersion": 1
},
{
"id": "6ffff150-fd0e-400e-9f4f-878c23d4fc7b",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
864,
192
],
"parameters": {
"width": 688,
"height": 768,
"content": "## 获取客户数据"
},
"typeVersion": 1
},
{
"id": "2b4ce264-bcb6-4554-9f7a-3b90af6e407c",
"name": "便签5",
"type": "n8n-nodes-base.stickyNote",
"position": [
1568,
208
],
"parameters": {
"width": 720,
"height": 752,
"content": "## 获取特定产品数据"
},
"typeVersion": 1
},
{
"id": "5834724b-c8eb-4c1b-9d27-8895be551bf2",
"name": "### 需要帮助?",
"type": "n8n-nodes-base.stickyNote",
"position": [
2304,
272
],
"parameters": {
"width": 336,
"height": 688,
"content": "## 获取特定产品推荐最新产品"
},
"typeVersion": 1
},
{
"id": "60d68dcd-39f4-4df9-9f90-1aa7f2451b87",
"name": "## 试试看!",
"type": "n8n-nodes-base.stickyNote",
"position": [
2656,
320
],
"parameters": {
"width": 496,
"height": 640,
"content": "## 使用Rapiwa检查有效的WhatsApp号码"
},
"typeVersion": 1
},
{
"id": "3900ad3e-04c4-4e08-87ba-15588d3308df",
"name": "GET 模型",
"type": "n8n-nodes-base.stickyNote",
"position": [
3168,
-128
],
"parameters": {
"width": 784,
"height": 1088,
"content": "### 如果(决策节点)"
},
"typeVersion": 1
},
{
"id": "957bac3d-0656-4e2c-bf5a-b09db94fe27d",
"name": "Rapiwa发送器",
"type": "n8n-nodes-base.httpRequest",
"position": [
3504,
528
],
"parameters": {
"url": "=https://app.rapiwa.com/api/send-message",
"method": "POST",
"options": {},
"sendBody": true,
"authentication": "genericCredentialType",
"bodyParameters": {
"parameters": [
{
"name": "number",
"value": "={{ $json.data.number }}"
},
{
"name": "message_type",
"value": "text"
},
{
"name": "message",
"value": "=Hello {{ $('get most buy product id & Clear Number').item.json.customer_name }},\n\nThanks again for your recent purchase! 🎁 \nWe thought you might also love *{{ $('get specific product recommend latest product').item.json.name }}* - it’s a favorite among our customers who bought something similar.\n\nOnly *BDT {{ $('get specific product recommend latest product').item.json.price }}* – limited stock! \nCheck it out 👉 {{ $('get specific product recommend latest product').item.json.permalink }}\n\nLet us know if you need any help.\n- Team *SpaGreen Creative*\n"
}
]
},
"genericAuthType": "httpBearerAuth"
},
"credentials": {
"httpBearerAuth": {
"id": "jnaHCyYia9OAFozh",
"name": "Rapiwa Bearer YOUR_TOKEN_HERE"
}
},
"typeVersion": 4.2
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "8ffe0181-714f-4997-aff1-8bd4b1a21a3f",
"connections": {
"If": {
"main": [
[
{
"node": "Rapiwa Sender",
"type": "main",
"index": 0
}
],
[
{
"node": "Save State of Rows in Unerified & Not sent",
"type": "main",
"index": 0
}
]
]
},
"Wait": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Rapiwa Sender": {
"main": [
[
{
"node": "Save State of Rows in Verified & Sent",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items": {
"main": [
[],
[
{
"node": "get customer data",
"type": "main",
"index": 0
}
]
]
},
"Schedule Trigger": {
"main": [
[
{
"node": "Get many customers",
"type": "main",
"index": 0
}
]
]
},
"Code (clean data)": {
"main": [
[
{
"node": "get specific product recommend latest product",
"type": "main",
"index": 0
}
]
]
},
"get customer data": {
"main": [
[
{
"node": "get most buy product id & Clear Number",
"type": "main",
"index": 0
}
]
]
},
"Get many customers": {
"main": [
[
{
"node": "Code (get paying_customer)",
"type": "main",
"index": 0
}
]
]
},
"get specific product data": {
"main": [
[
{
"node": "Code (clean data)",
"type": "main",
"index": 0
}
]
]
},
"Code (get paying_customer)": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Save State of Rows in Verified & Sent": {
"main": [
[
{
"node": "Wait",
"type": "main",
"index": 0
}
]
]
},
"get most buy product id & Clear Number": {
"main": [
[
{
"node": "get specific product data",
"type": "main",
"index": 0
}
]
]
},
"Check valid whatsapp number Using Rapiwa": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"Save State of Rows in Unerified & Not sent": {
"main": [
[
{
"node": "Wait",
"type": "main",
"index": 0
}
]
]
},
"get specific product recommend latest product": {
"main": [
[
{
"node": "Check valid whatsapp number Using Rapiwa",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 社交媒体
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
使用 Rapiwa API 通过 WhatsApp 向客户发送 WooCommerce 折扣券
使用 Rapiwa API 通过 WhatsApp 向客户发送 WooCommerce 折扣券
If
Code
Wait
+6
16 节点Rapiwa
社交媒体
使用Rapiwa API自动在WhatsApp上发送WooCommerce发票
使用Rapiwa API通过WhatsApp自动发送WooCommerce发票
If
Code
Wait
+5
15 节点Rapiwa
客户关系管理
WooCommerce订单完成的WhatsApp评价请求自动化
使用Rapiwa通过WhatsApp为完成的WooCommerce订单自动化评价请求
If
Code
Wait
+5
15 节点Rapiwa
客户培育
自动向 Shopify 客户发送 WhatsApp 折扣码
使用 Rapiwa 自动向 Shopify 客户发送 WhatsApp 折扣码
If
Code
Wait
+5
17 节点Rapiwa
通过WhatsApp、邮件和Twilio SMS发送的食品菜单更新通知器
食品菜单更新通知器
If
Set
Code
+7
22 节点Oneclick AI Squad
社交媒体
使用Rapiwa API的批量WhatsApp营销自动化(非官方集成)
使用Rapiwa API从Google Sheets批量发送WhatsApp消息
If
Code
Wait
+6
20 节点SpaGreen Creative
社交媒体