8
n8n 中文网amn8n.com

使用Rapiwa API实现Shopify订单履约并通过WhatsApp发送跟踪链接

高级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 17 个节点。主要使用 If, Code, Wait, HttpRequest, GoogleSheets 等节点。 通过WhatsApp自动化Shopify订单履约通知

前置要求
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
  • Shopify Admin API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "qIxpz1WNuNQMj4Hq",
  "meta": {
    "instanceId": "cb9a1e5321767b6316634728341237e564b2587ab15b74ca0a89eb02a53484d6",
    "templateCredsSetupCompleted": true
  },
  "name": "使用 Rapiwa API 实现 Shopify 订单履约并通过 WhatsApp 发送跟踪链接",
  "tags": [],
  "nodes": [
    {
      "id": "bb285dab-fc99-4d5b-8b3b-36959d591a4f",
      "name": "获取所有客户数据",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -112,
        896
      ],
      "parameters": {
        "url": "=https://your_domain.myshopify.com/admin/api/2025-07/orders/{{ $json.order_id }}.json",
        "method": "=GET",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "X-Shopify-Access-Token",
              "value": "your_shopify_accesstoken like this➡️shpat_57xx78xxxxx90fxxx67"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "357f157e-ebd1-4865-8384-c2202c69461a",
      "name": "遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        80,
        896
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "0e597ab7-be2c-45fd-8b2b-6a34989b3b9a",
      "name": "Shopify 触发器",
      "type": "n8n-nodes-base.shopifyTrigger",
      "position": [
        -624,
        896
      ],
      "webhookId": "a8c45cbe-04b8-4c78-8418-1e50b9b8fd06",
      "parameters": {
        "topic": "fulfillments/create",
        "authentication": "accessToken"
      },
      "credentials": {
        "shopifyAccessTokenApi": {
          "id": "cWoMnmp2EszIQYpj",
          "name": "Shopify Access Token account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e9854c40-304b-49a8-a3e2-f3aae6a0996a",
      "name": "格式化 Webhook 响应数据",
      "type": "n8n-nodes-base.code",
      "position": [
        -448,
        896
      ],
      "parameters": {
        "jsCode": "const result = $input.all().map(item => {\n  const body = item.json;\n\n  return {\n    customer_id: body.id,\n    fulfillment_id: body.id,\n    order_id: body.order_id,\n    status: body.status,\n    created_at: body.created_at,\n    updated_at: body.updated_at,\n    tracking_company: body.tracking_company,\n    tracking_number: body.tracking_number,\n    tracking_url: body.tracking_url,\n    product_title: body.line_items?.[0]?.title || '',\n    customer_name: body.destination?.name || '',\n    country: body.destination?.country || '',\n    shop_domain: item.json.headers?.['x-shopify-shop-domain'] || '',\n  };\n});\n\nreturn result;"
      },
      "typeVersion": 2
    },
    {
      "id": "9df911dd-af84-4a81-8b15-4c758ed36c9e",
      "name": "清理号码",
      "type": "n8n-nodes-base.code",
      "position": [
        304,
        992
      ],
      "parameters": {
        "jsCode": "const items = $input.all();\n\nconst updatedItems = items.map((item) => {\n  const customer = item?.json?.order?.customer || {};\n\n  const rawPhone = customer?.phone || \"\";\n  const phoneStr = typeof rawPhone === 'string' ? rawPhone : String(rawPhone || \"\");\n  const cleanedPhone = phoneStr.replace(/\\D/g, \"\");\n\n  // Combine first and last name into full name\n  const firstName = customer.first_name || \"\";\n  const lastName = customer.last_name || \"\";\n  const fullName = `${firstName} ${lastName}`.trim();\n\n  return {\n    json: {\n      customer_id: customer.id || \"\",\n      name: fullName,\n      email: customer.email || \"\",\n      phone: cleanedPhone\n    }\n  };\n});\n\nreturn updatedItems;\n"
      },
      "typeVersion": 2
    },
    {
      "id": "9c7f6119-154c-4abf-8336-3ebe8133f479",
      "name": "已验证 在表格中追加行",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1184,
        1008
      ],
      "parameters": {
        "columns": {
          "value": {
            "email": "={{ $('Clean Number').item.json.email }}",
            "name ": "={{ $('Clean Number').item.json.name }}",
            "number": "={{ $('Clean Number').item.json.phone }}",
            "status": "verified",
            "customer_id": "={{ $('Clean Number').item.json.customer_id }}",
            "tracking_url": "={{ $('Format Webhook Response Data').item.json.tracking_url }}",
            "product_title": "={{ $('Format Webhook Response Data').item.json.product_title }}",
            "tracking_number": "={{ $('Format Webhook Response Data').item.json.tracking_number }}",
            "tracking_company": "={{ $('Format Webhook Response Data').item.json.tracking_company }}"
          },
          "schema": [
            {
              "id": "customer_id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "customer_id",
              "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": "number",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "tracking_company",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "tracking_company",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "tracking_number",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "tracking_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "tracking_url",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "tracking_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "product_title",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "product_title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "status",
              "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/1vxocktoY-y-PYBZNxmUDuQv02b5F8QKhbQ0yLHjwjBY/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1vxocktoY-y-PYBZNxmUDuQv02b5F8QKhbQ0yLHjwjBY",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1vxocktoY-y-PYBZNxmUDuQv02b5F8QKhbQ0yLHjwjBY/edit?usp=drivesdk",
          "cachedResultName": "Shopify - Send tracking link via WhatsApp"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "gFH3Wjq6yYqSEAei",
          "name": "Google Sheets"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "ed921c20-60e1-4c65-a946-cd477658d7e1",
      "name": "使用 Rapiwa 发送消息",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        960,
        1008
      ],
      "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": "=Hi {{ $('Loop Over Items').item.json.name }},\nGood news! Your order has just been fulfilled.\n\nTracking Number: *{{ $('Format Webhook Response Data').item.json.tracking_number }}*\n\nTrack your package here: *{{ $('Format Webhook Response Data').item.json.tracking_url }}*\n\nThank you for shopping with us.  \n-Team SpaGreen Creative\n"
            }
          ]
        },
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "id": "jnaHCyYia9OAFozh",
          "name": "Rapiwa Bearer Auth"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "53198fba-bd3b-4169-bfed-647f13caa22a",
      "name": "等待",
      "type": "n8n-nodes-base.wait",
      "position": [
        1184,
        1216
      ],
      "webhookId": "6c474e54-eb3c-4fcd-b455-948322cd0121",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "af670da1-14e9-4a4d-9d06-6e8d2bcbe051",
      "name": "使用 Rapiwa 检查有效的 WhatsApp 号码",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        528,
        992
      ],
      "parameters": {
        "url": "=https://app.rapiwa.com/api/verify-whatsapp",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "number",
              "value": "={{ $json.phone }}"
            }
          ]
        },
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "id": "jnaHCyYia9OAFozh",
          "name": "Rapiwa Bearer Auth"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "63985bfb-4fcd-427a-b6f5-ca56972dfa4a",
      "name": "条件判断",
      "type": "n8n-nodes-base.if",
      "position": [
        720,
        1120
      ],
      "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": "ef4e6f6f-5c3b-4598-ace3-bb47d91882fe",
      "name": "已验证 在表格1中追加行",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        976,
        1216
      ],
      "parameters": {
        "columns": {
          "value": {
            "email": "={{ $('Clean Number').item.json.email }}",
            "name ": "={{ $('Clean Number').item.json.name }}",
            "number": "={{ $('Clean Number').item.json.phone }}",
            "status": "unverified",
            "customer_id": "={{ $('Clean Number').item.json.customer_id }}",
            "tracking_url": "={{ $('Format Webhook Response Data').item.json.tracking_url }}",
            "product_title": "={{ $('Format Webhook Response Data').item.json.product_title }}",
            "tracking_number": "={{ $('Format Webhook Response Data').item.json.tracking_number }}",
            "tracking_company": "={{ $('Format Webhook Response Data').item.json.tracking_company }}"
          },
          "schema": [
            {
              "id": "customer_id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "customer_id",
              "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": "number",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "tracking_company",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "tracking_company",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "tracking_number",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "tracking_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "tracking_url",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "tracking_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "product_title",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "product_title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "status",
              "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/1vxocktoY-y-PYBZNxmUDuQv02b5F8QKhbQ0yLHjwjBY/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1vxocktoY-y-PYBZNxmUDuQv02b5F8QKhbQ0yLHjwjBY",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1vxocktoY-y-PYBZNxmUDuQv02b5F8QKhbQ0yLHjwjBY/edit?usp=drivesdk",
          "cachedResultName": "Shopify - Send tracking link via WhatsApp"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "gFH3Wjq6yYqSEAei",
          "name": "Google Sheets"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "92e8dfd3-a657-49a7-8c6f-f9a77e467b72",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2576,
        192
      ],
      "parameters": {
        "color": 4,
        "width": 1728,
        "height": 3536,
        "content": "# 使用 Rapiwa API 实现 Shopify 订单履约并通过 WhatsApp 发送跟踪链接"
      },
      "typeVersion": 1
    },
    {
      "id": "9242aaa7-3458-4bba-8965-4ee434a92421",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -768,
        192
      ],
      "parameters": {
        "color": 4,
        "width": 592,
        "height": 1056,
        "content": "## 1. 节点:Shopify 触发器"
      },
      "typeVersion": 1
    },
    {
      "id": "21e5181e-236e-47aa-aec2-a90b8980972d",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        192
      ],
      "parameters": {
        "color": 5,
        "width": 384,
        "height": 1232,
        "content": "## 1. 节点:获取所有客户数据"
      },
      "typeVersion": 1
    },
    {
      "id": "0b192c42-a681-458e-9c04-b327c8c1d3fe",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        256,
        192
      ],
      "parameters": {
        "color": 6,
        "width": 432,
        "height": 1232,
        "content": "## 1. 节点:使用 Rapiwa 检查有效 WhatsApp 号码"
      },
      "typeVersion": 1
    },
    {
      "id": "28edb9e1-79e8-4519-940b-17fba681a694",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        704,
        192
      ],
      "parameters": {
        "color": 4,
        "width": 656,
        "height": 1232,
        "content": "## 1. 节点:条件判断"
      },
      "typeVersion": 1
    },
    {
      "id": "0cd9fd3c-ef9a-4ff3-bbdb-d6be4ac3a962",
      "name": "便利贴5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -768,
        -96
      ],
      "parameters": {
        "color": 3,
        "width": 2112,
        "height": 272,
        "content": "# 工作流摘要"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "a4f318ef-c966-4231-8931-721438e6c92f",
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Send Message Using Rapiwa",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "verified append row in sheet1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean Number": {
      "main": [
        [
          {
            "node": "Check valid whatsapp number Using Rapiwa",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Clean Number",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Shopify Trigger": {
      "main": [
        [
          {
            "node": "Format Webhook Response Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "get all customer data": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Message Using Rapiwa": {
      "main": [
        [
          {
            "node": "verified append row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Webhook Response Data": {
      "main": [
        [
          {
            "node": "get all customer data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "verified append row in sheet": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "verified append row in sheet1": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check valid whatsapp number Using Rapiwa": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

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

需要付费吗?

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

工作流信息
难度等级
高级
节点数量17
分类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 查看

分享此工作流