使用Gmail向高价值Magento 2客户发送自动折扣券

中级

这是一个Social Media领域的自动化工作流,包含 14 个节点。主要使用 If、Code、Cron、Gmail、HttpRequest 等节点。 使用Gmail向高价值Magento 2客户发送自动折扣券

前置要求
  • Google 账号和 Gmail API 凭证
  • 可能需要目标 API 的认证凭证

使用的节点 (14 个)

工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "c3b23fffea49117e798bf0289bfe84ed0e7c634b0def397db74b35f7d28d1f5f",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "a0292746-e1af-48ef-8c3e-2b315d9bc3c2",
      "name": "Cron",
      "type": "n8n-nodes-base.cron",
      "position": [
        -2180,
        -120
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "d21a21ce-4e3d-429c-8eb2-767bf798a35d",
      "name": "获取已完成订单",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1300,
        -120
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "f295afc4-fb07-43ab-ad05-514dac34b1e8",
      "name": "创建新销售规则",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        -640,
        -220
      ],
      "parameters": {},
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "a67ca1ec-85b3-42cd-b66f-26cf92f2d700",
      "name": "为每个客户生成优惠券",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        -420,
        -220
      ],
      "parameters": {},
      "typeVersion": 4.2,
      "alwaysOutputData": false
    },
    {
      "id": "dc219703-3d7d-4746-81dd-d5b06baf2dff",
      "name": "获取客户订单价值",
      "type": "n8n-nodes-base.code",
      "position": [
        -1080,
        -120
      ],
      "parameters": {},
      "typeVersion": 2,
      "alwaysOutputData": true
    },
    {
      "id": "2bf70bfd-f199-40ee-8b54-a89d51a89575",
      "name": "获取3个月日期",
      "type": "n8n-nodes-base.code",
      "position": [
        -1520,
        -120
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "def79c1c-5539-4b53-9c87-05c70f040d30",
      "name": "如果",
      "type": "n8n-nodes-base.if",
      "position": [
        -860,
        -120
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "9f4571bc-0481-4c0a-b5b5-9944198a6ade",
      "name": "获取媒体路径",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1960,
        -120
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "7c293a01-e30e-4787-bab9-ad8c0a63cbfd",
      "name": "设置或获取徽标",
      "type": "n8n-nodes-base.code",
      "position": [
        -1740,
        -120
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "81cf4124-2c8b-4ac9-86b0-e5447ced2889",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2230,
        -300
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "5573f544-0270-4150-9fdb-52baafa802c9",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1350,
        -300
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "32229245-ce6c-4aab-81fe-5441e0eb2879",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -690,
        -300
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "1d1e29f7-14cd-4361-8506-d6715e9f01b4",
      "name": "发送凭证",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -200,
        -220
      ],
      "webhookId": "c2c62b05-62e3-40aa-9053-563f905ea464",
      "parameters": {},
      "typeVersion": 2.1
    },
    {
      "id": "5da9da7f-07de-4419-b830-4b338ffadd28",
      "name": "发送报告",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -640,
        -20
      ],
      "webhookId": "66721662-d11e-4469-a473-364c96f35d9a",
      "parameters": {},
      "typeVersion": 2.1
    }
  ],
  "pinData": {},
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Create New Sales Rule",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Cron": {
      "main": [
        [
          {
            "node": "Get Media Path",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SetOrGet Logo": {
      "main": [
        [
          {
            "node": "Get 3 Month Dates",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Media Path": {
      "main": [
        [
          {
            "node": "SetOrGet Logo",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get 3 Month Dates": {
      "main": [
        [
          {
            "node": "Get Completed Orders",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Completed Orders": {
      "main": [
        [
          {
            "node": "Get Customer Order Value",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create New Sales Rule": {
      "main": [
        [
          {
            "node": "Generate Coupon for Each Customer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Customer Order Value": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Coupon for Each Customer": {
      "main": [
        [
          {
            "node": "Send Voucher",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

这是一个中级难度的工作流,适用于Social Media等场景。适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

需要付费吗?

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

工作流信息
难度等级
中级
节点数量14
分类1
节点类型6
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
Kanaka Kishore Kandregula

Kanaka Kishore Kandregula

@kmyprojects

Experienced Magento 2 Developer with 10+ years of expertise in building and optimizing eCommerce solutions. Over the past year, I’ve expanded my skills into workflow automation using n8n, streamlining business processes and integrating systems for efficiency. Passionate about solving complex problems, enhancing performance, and leveraging automation to drive smarter workflows.

外部链接
在 n8n.io 上查看 →

分享此工作流