8
n8n 中文网amn8n.com

使用Rapiwa API从Shopify发送自动WhatsApp订单确认

高级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 18 个节点。主要使用 If, Code, Wait, Webhook, HttpRequest 等节点。 使用Rapiwa和Google Sheets从Shopify发送自动WhatsApp订单确认

前置要求
  • HTTP Webhook 端点(n8n 会自动生成)
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "gVsYIc202VgqnM5S",
  "meta": {
    "instanceId": "cb9a1e5321767b6316634728341237e564b2587ab15b74ca0a89eb02a53484d6",
    "templateCredsSetupCompleted": true
  },
  "name": "使用 Rapiwa API 从 Shopify 发送自动 WhatsApp 订单确认",
  "tags": [],
  "nodes": [
    {
      "id": "49f6c0b4-d943-425b-8e90-5bb3264300f0",
      "name": "遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1568,
        304
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "4a602b94-9664-429c-86f1-5faf96cc8a59",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        1168,
        304
      ],
      "webhookId": "a9b6a936-e5f2-4d4c-9cf9-182de0a970d5",
      "parameters": {
        "path": "a9b6a936-e5f2-4d4c-9cf9-182de0a970d5",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2
    },
    {
      "id": "34695eb4-af92-47fa-b499-d0232d2fd47b",
      "name": "清理 WhatsApp 号码",
      "type": "n8n-nodes-base.code",
      "position": [
        2336,
        320
      ],
      "parameters": {
        "jsCode": "const items = $input.all();\nconst updatedItems = items.map((item) => {\n  const waNo = item?.json[\"WhatsApp No\"];\n  const waNoStr = typeof waNo === 'string' ? waNo : (waNo !== undefined && waNo !== null ? String(waNo) : \"\");\n  const cleanedNumber = waNoStr.replace(/\\D/g, \"\");\n  item.json[\"WhatsApp No\"] = cleanedNumber;\n  return item;\n});\nreturn updatedItems;"
      },
      "typeVersion": 2
    },
    {
      "id": "950fd5e6-df76-4ede-8cef-f0bf83e96d03",
      "name": "使用 Rapiwa1 检查有效 WhatsApp 号码",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2608,
        320
      ],
      "parameters": {
        "url": "=https://app.rapiwa.com/api/verify-whatsapp",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "number",
              "value": "={{ $json[\"WhatsApp No\"] }}"
            }
          ]
        },
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "id": "jnaHCyYia9OAFozh",
          "name": "Rapiwa Bearer Auth"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "384a2bfb-85ed-4d73-8918-db5443707362",
      "name": "便签 10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2240,
        -320
      ],
      "parameters": {
        "width": 576,
        "height": 992,
        "content": "## 清理和验证 WhatsApp 号码"
      },
      "typeVersion": 1
    },
    {
      "id": "24bd6b89-6c12-429b-89c2-af26f7a5ec36",
      "name": "便签9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2832,
        -320
      ],
      "parameters": {
        "color": 5,
        "width": 432,
        "height": 992,
        "content": "## 条件逻辑"
      },
      "typeVersion": 1
    },
    {
      "id": "6e674ebc-6552-4b42-acdb-1953f7c070d7",
      "name": "便签 12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3280,
        -320
      ],
      "parameters": {
        "color": 4,
        "width": 880,
        "height": 688,
        "content": "## 通过 HTTP 请求使用 Rapiwa 发送消息"
      },
      "typeVersion": 1
    },
    {
      "id": "426ebbd2-7716-4760-b482-780ac36a958d",
      "name": "便签 13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3280,
        384
      ],
      "parameters": {
        "color": 7,
        "width": 886,
        "height": 624,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "645ed438-a1ca-4158-bb3d-2f304aa337d5",
      "name": "等待",
      "type": "n8n-nodes-base.wait",
      "position": [
        3680,
        448
      ],
      "webhookId": "6c474e54-eb3c-4fcd-b455-948322cd0121",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "7c761688-bd05-465e-80f2-651b03f8f438",
      "name": "条件判断",
      "type": "n8n-nodes-base.if",
      "position": [
        2976,
        320
      ],
      "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": "153f0f6d-d2fa-4459-a092-99722b68697d",
      "name": "更改未验证和未发送行的状态",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3440,
        448
      ],
      "parameters": {
        "columns": {
          "value": {
            "row_number": "={{ $('Limit').item.json.row_number }}"
          },
          "schema": [
            {
              "id": "email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "number",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "order id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "order id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "item name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "item name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "total price",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "total price",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "validity",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "validity",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "status",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "row_number"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1b5b9kvkfuCMtZ-7Z-w21sXOmHFmQ30N1iQPc2WMStEo/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1b5b9kvkfuCMtZ-7Z-w21sXOmHFmQ30N1iQPc2WMStEo",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1b5b9kvkfuCMtZ-7Z-w21sXOmHFmQ30N1iQPc2WMStEo/edit?usp=drivesdk",
          "cachedResultName": "Shopify - Send WhatsApp confirmation with order ID"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "gFH3Wjq6yYqSEAei",
          "name": "Google Sheets"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "416c0533-1aad-4885-a607-17b5770d67e2",
      "name": "使用 Rapiwa 发送消息",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3440,
        144
      ],
      "parameters": {
        "url": "https://app.rapiwa.com/api/send-message",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "=number",
              "value": "={{ $json.customer_phone }}"
            },
            {
              "name": "message_type",
              "value": "text"
            },
            {
              "name": "message",
              "value": "=Hi *{{ $json.customer_full_name }}*,\n\nThank you for shopping with *SpaGreen Creative*!\nWe're happy to confirm that your order has been successfully placed. \n\n🧾 *Order Details*\n• *Product*: {{ $json.line_item.title }}\n• *SKU*: {{ $json.line_item.sku }}\n• *Quantity*: {{ $json.line_item.quantity }}\n• *Vendor*: {{ $json.line_item.vendor }}\n• *Order ID*: {{ $json.name }}\n• *Product ID*: {{ $json.line_item.product_id }}\n\n📦 *Shipping Information*\n{{ $json.shipping_address.address1 }} {{ $json.shipping_address.address2 }}\n{{ $json.shipping_address.city }}, {{ $json.shipping_address.country }} - {{ $json.shipping_address.zip }}\n\n💳 *Payment Summary*\n• *Subtotal*: {{ $json.subtotal_price }} BDT\n• *Tax (VAT)*: {{ $json.total_tax_amount }} BDT\n• *Shipping*: {{ $json.total_shipping_amount }} BDT\n• *Discount*: {{ $json.total_discount_amount }} BDT\n• *Total Paid*: {{ $json.total_price }} BDT\n\n📅 **Order Date**: {{ $json.created_date }}\n\nThank you once again for choosing us. If you need any help or have questions, feel free to reach out anytime — we're here for you!\n\nWarm wishes,\n*Team SpaGreen Creative*"
            },
            {
              "name": "status"
            }
          ]
        },
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "id": "zb79NbTCD3LbxmSs",
          "name": "Bearer Auth account"
        },
        "httpHeaderAuth": {
          "id": "i9zvAj1mpabm9ci9",
          "name": "shopify-app-auth"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "d4a7a2df-6518-4ade-ad00-e833c254d847",
      "name": "更改已验证和已发送行的状态",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3680,
        144
      ],
      "parameters": {
        "columns": {
          "value": {
            "name": "={{ $json.name }}",
            "email": "={{ $json.email }}",
            "number": "={{ $json.phone }}",
            "status": "={{ $json.success }}",
            "order id": "={{ $json.customer_id }}",
            "validity": "verified",
            "item name": "={{ $json.product_title }}",
            "row_number": 0,
            "total price": "={{ $json.total_price }}"
          },
          "schema": [
            {
              "id": "email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "number",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "order id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "order id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "item name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "item name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "total price",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "total price",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "validity",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "validity",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "status",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "status"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1b5b9kvkfuCMtZ-7Z-w21sXOmHFmQ30N1iQPc2WMStEo/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1b5b9kvkfuCMtZ-7Z-w21sXOmHFmQ30N1iQPc2WMStEo",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1b5b9kvkfuCMtZ-7Z-w21sXOmHFmQ30N1iQPc2WMStEo/edit?usp=drivesdk",
          "cachedResultName": "Shopify - Send WhatsApp confirmation with order ID"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "gFH3Wjq6yYqSEAei",
          "name": "Google Sheets"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "3d0e7cb5-1c19-4366-a252-432f3406b875",
      "name": "便签 1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1072,
        -320
      ],
      "parameters": {
        "color": 7,
        "width": 320,
        "height": 992,
        "content": "## Webhook"
      },
      "typeVersion": 1
    },
    {
      "id": "b7e88ae6-6136-41f7-aa18-5eba05dbe026",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1408,
        -320
      ],
      "parameters": {
        "color": 2,
        "width": 816,
        "height": 992,
        "content": "## 遍历项目"
      },
      "typeVersion": 1
    },
    {
      "id": "821172b6-321e-4c9d-93c8-078ef48821c4",
      "name": "清理 Webhooks 响应数据",
      "type": "n8n-nodes-base.code",
      "position": [
        1936,
        320
      ],
      "parameters": {
        "jsCode": "const result = $input.all().map(item => {\n  const body = item.json.body || {};\n  const customer = body.customer || {};\n  const defaultAddress = customer.default_address || {};\n  const shippingAddress = body.shipping_address || {};\n  const lineItem = (body.line_items && body.line_items[0]) || {};\n  const totalTaxSet = body.total_tax_set?.shop_money || {};\n  const totalDiscountSet = body.total_discounts_set?.shop_money || {};\n  const totalShippingSet = body.total_shipping_price_set?.shop_money || {};\n\n  return {\n    customer_email: customer.email,\n    customer_phone: customer.phone,\n    created_date: body.created_at,\n    updated_at: body.updated_at,\n    name: body.name,\n    customer_full_name: `${customer.first_name || ''} ${customer.last_name || ''}`.trim(),\n    customer_id: customer.id,\n    country_code: defaultAddress.country_code,\n    customer_address: {\n      country: defaultAddress.country,\n      city: defaultAddress.city,\n      zip: defaultAddress.zip,\n      address1: defaultAddress.address1,\n      address2: defaultAddress.address2\n    },\n    subtotal_price: body.subtotal_price,\n    total_price: body.total_price,\n    total_tax_amount: totalTaxSet.amount,\n    total_discount_amount: totalDiscountSet.amount,\n    total_shipping_amount: totalShippingSet.amount,\n    shipping_address: {\n      country: shippingAddress.country,\n      city: shippingAddress.city,\n      zip: shippingAddress.zip,\n      address1: shippingAddress.address1,\n      address2: shippingAddress.address2\n    },\n    line_item: {\n      title: lineItem.title,\n      sku: lineItem.sku,\n      quantity: lineItem.quantity,\n      vendor: lineItem.vendor,\n      product_id: lineItem.product_id\n    }\n  };\n});\n\nreturn result;"
      },
      "typeVersion": 2
    },
    {
      "id": "e25c79ad-1ed7-47d9-a0c2-4eccd744c77b",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -304,
        -320
      ],
      "parameters": {
        "color": 4,
        "width": 1280,
        "height": 2720,
        "content": "# 使用 Rapiwa API 从 Shopify 发送自动 WhatsApp 订单确认"
      },
      "typeVersion": 1
    },
    {
      "id": "832d90a7-fdde-4bb0-a7ea-7f10259825dd",
      "name": "便签 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1072,
        -496
      ],
      "parameters": {
        "color": 3,
        "width": 3088,
        "content": "## 工作流摘要:"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "2ffa1a74-0a5c-494a-95c0-c828fb29bf10",
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Send Message Using Rapiwa",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Change State of Rows in Unverified & Not Sent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Clean Webhooks Response Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean WhatsApp Number": {
      "main": [
        [
          {
            "node": "Check valid whatsapp number Using Rapiwa1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Message Using Rapiwa": {
      "main": [
        [
          {
            "node": "Change State of Rows in Verified & Sent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean Webhooks Response Data": {
      "main": [
        [
          {
            "node": "Clean WhatsApp Number",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Change State of Rows in Verified & Sent": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check valid whatsapp number Using Rapiwa1": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Change State of Rows in Unverified & Not Sent": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 内容创作, 多模态 AI

需要付费吗?

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

工作流信息
难度等级
高级
节点数量18
分类2
节点类型8
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
SpaGreen Creative

SpaGreen Creative

@spagreen

SpaGreen Creative is a leading software company specializing in SaaS solutions, AI automation, and Laravel/Vue.js development. With 800+ eCommerce platforms and 8,000+ global clients, we deliver powerful tools for OTT, CRM, ERP, and WhatsApp marketing. We combine innovation and tech to build scalable digital products.

外部链接
在 n8n.io 查看

分享此工作流