8
n8n 中文网amn8n.com

已验证推荐奖励通知

高级

这是一个Social Media领域的自动化工作流,包含 19 个节点。主要使用 If, Set, Gmail, Webhook, GoogleSheets 等节点。 邮件验证与可视化优惠券的自动化推荐奖励系统

前置要求
  • Google 账号和 Gmail API 凭证
  • HTTP Webhook 端点(n8n 会自动生成)
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "",
  "meta": {
    "instanceId": "",
    "templateCredsSetupCompleted": false
  },
  "name": "已验证推荐奖励通知",
  "tags": [],
  "nodes": [
    {
      "id": "fe5b07ff-5797-4250-a69e-49860089cdca",
      "name": "便签 - 设置凭证",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1552,
        80
      ],
      "parameters": {
        "color": 2,
        "width": 520,
        "height": 432,
        "content": "## 🔐 需要设置凭证"
      },
      "typeVersion": 1
    },
    {
      "id": "716c5cc8-d3fe-41e2-ac10-7c65c509b234",
      "name": "Webhook 触发器",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -880,
        368
      ],
      "webhookId": "",
      "parameters": {
        "path": "referral-reward",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 1
    },
    {
      "id": "302609be-73be-4d33-bd9d-b9fba0077c64",
      "name": "便签 - Webhook",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1008,
        48
      ],
      "parameters": {
        "color": 3,
        "width": 380,
        "height": 460,
        "content": "## 🎯 WEBHOOK 触发器"
      },
      "typeVersion": 1
    },
    {
      "id": "7b2fa8ce-5ed9-4e78-8373-2aa62845fffb",
      "name": "便签 - 邮箱验证",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -608,
        192
      ],
      "parameters": {
        "color": 4,
        "width": 204,
        "height": 332,
        "content": "## ✅ 邮箱验证"
      },
      "typeVersion": 1
    },
    {
      "id": "776e1c97-2b01-42c9-ae75-463823f90646",
      "name": "IF 邮箱有效?",
      "type": "n8n-nodes-base.if",
      "position": [
        -320,
        368
      ],
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{ $json.valid }}",
              "value2": "={{ true }}"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "55e8d038-8915-42c1-8ec8-4b90869b2cfc",
      "name": "便签 - 条件分支",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -384,
        144
      ],
      "parameters": {
        "color": 5,
        "width": 316,
        "height": 372,
        "content": "## ⚖️ 条件逻辑"
      },
      "typeVersion": 1
    },
    {
      "id": "40585967-a862-4c5b-a212-f20b80be4c80",
      "name": "设置优惠券模板",
      "type": "n8n-nodes-base.set",
      "position": [
        80,
        256
      ],
      "parameters": {
        "fields": {
          "values": [
            {
              "name": "referrer_name",
              "stringValue": "={{ $('Webhook Trigger').item.json.body.referrer_name }}"
            },
            {
              "name": "referrer_email",
              "stringValue": "={{ $('Webhook Trigger').item.json.body.referrer_email }}"
            },
            {
              "name": "campaign",
              "stringValue": "={{ $('Webhook Trigger').item.json.body.campaign }}"
            },
            {
              "name": "coupon_code",
              "stringValue": "=REF-{{ $('Webhook Trigger').item.json.body.referrer_name.toUpperCase().slice(0,4) }}{{ Math.floor(Math.random()*9999) }}"
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "fb96cbf0-d51c-426e-b1b8-9d5155a59a32",
      "name": "便签 - 优惠券模板",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -48,
        -64
      ],
      "parameters": {
        "color": 6,
        "width": 380,
        "height": 460,
        "content": "## 🎨 优惠券模板创建"
      },
      "typeVersion": 1
    },
    {
      "id": "9f826d92-a7ad-4254-9413-574d0e4587f9",
      "name": "便签 - HTML 转图片",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        352,
        64
      ],
      "parameters": {
        "color": 6,
        "width": 204,
        "height": 332,
        "content": "## 🖼️ HTML 转图片转换"
      },
      "typeVersion": 1
    },
    {
      "id": "1148e573-98e7-41ae-9295-7cf0113a357c",
      "name": "发送奖励邮件 (Gmail)",
      "type": "n8n-nodes-base.gmail",
      "position": [
        656,
        256
      ],
      "webhookId": "",
      "parameters": {
        "sendTo": "={{ $('Set Coupon Template').item.json.referrer_email }}",
        "message": "=<div style=\"font-family: Arial, sans-serif; max-width: 600px; margin: 0 auto; padding: 20px;\">\n  <h2 style=\"color: #667eea;\">Hi {{ $('Set Coupon Template').item.json.referrer_name }},</h2>\n  \n  <p style=\"font-size: 16px; line-height: 1.6;\">Thank you for successfully referring a friend! 🎉</p>\n  \n  <p style=\"font-size: 16px; line-height: 1.6;\">Here's your exclusive reward coupon:</p>\n  \n  <div style=\"text-align: center; margin: 30px 0;\">\n    <img src=\"{{ $json.image_url }}\" alt=\"Reward Coupon\" style=\"max-width: 100%; border-radius: 10px; box-shadow: 0 4px 12px rgba(0,0,0,0.1);\" />\n  </div>\n  \n  <p style=\"font-size: 16px;\"><strong>Your Coupon Code:</strong> <code style=\"background: #f3f4f6; padding: 5px 10px; border-radius: 5px; font-size: 18px;\">{{ $('Set Coupon Template').item.json.coupon_code }}</code></p>\n  \n  <p style=\"color: #6b7280; font-size: 14px; line-height: 1.6;\">This coupon is valid for 30 days and can be used on your next purchase.</p>\n  \n  <p style=\"margin-top: 30px; font-size: 16px;\">We appreciate your support! 💙</p>\n  \n  <p style=\"font-size: 16px;\">– The Team</p>\n  \n  <hr style=\"border: none; border-top: 1px solid #e5e7eb; margin: 30px 0;\" />\n  \n  <p style=\"font-size: 12px; color: #9ca3af; text-align: center;\">Campaign: {{ $('Set Coupon Template').item.json.campaign }}</p>\n</div>",
        "options": {},
        "subject": "🎁 Your Referral Reward Coupon is Here!"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "YOUR_GMAIL_OAUTH2_ID",
          "name": "Gmail OAuth2"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "95d7218e-cbb2-4c33-a31b-f7140b764e82",
      "name": "便签 - 奖励邮件",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        576,
        -16
      ],
      "parameters": {
        "color": 7,
        "width": 332,
        "height": 444,
        "content": "## 📧 发送奖励邮件"
      },
      "typeVersion": 1
    },
    {
      "id": "eb052f76-0c33-418a-a6a2-c9a1835e46ab",
      "name": "记录到 Google Sheets(成功)",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1008,
        256
      ],
      "parameters": {
        "columns": {
          "value": {
            "Status": "Reward Sent",
            "Campaign": "={{ $('Set Coupon Template').item.json.campaign }}",
            "Timestamp": "={{ $now.toISO() }}",
            "Coupon Code": "={{ $('Set Coupon Template').item.json.coupon_code }}",
            "Referrer Name": "={{ $('Set Coupon Template').item.json.referrer_name }}",
            "Referrer Email": "={{ $('Set Coupon Template').item.json.referrer_email }}",
            "Coupon Image URL": "={{ $('HTML/CSS to Image').item.json.image_url }}"
          },
          "schema": [
            {
              "id": "Timestamp",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Timestamp",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Referrer Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Referrer Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Referrer Email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Referrer Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Coupon Code",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Coupon Code",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Coupon Image URL",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Coupon Image URL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Campaign",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Campaign",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Referrer Email"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_GOOGLE_SHEETS_SHEET_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEETS_ID/edit#gid/YOUR_GOOGLE_SHEETS_SHEET_ID",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_GOOGLE_SHEETS_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEETS_ID/edit?usp=drivesdk",
          "cachedResultName": "Referral_Reward_Tracker"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "YOUR_GOOGLE_SHEETS_OAUTH2_ID",
          "name": "Google Sheets OAuth2"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "f019b026-0714-4523-bd95-0bde43ade8d7",
      "name": "便签 - 记录成功",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        928,
        -32
      ],
      "parameters": {
        "color": 4,
        "width": 380,
        "height": 464,
        "content": "## 📊 记录到 Google Sheets(成功)"
      },
      "typeVersion": 1
    },
    {
      "id": "9e8164af-fe19-4170-91ce-fdab6228d09c",
      "name": "发送无效邮箱通知",
      "type": "n8n-nodes-base.gmail",
      "position": [
        80,
        464
      ],
      "webhookId": "",
      "parameters": {
        "sendTo": "=adminexample@gmail.com",
        "message": "=<div style=\"font-family: Arial, sans-serif; max-width: 600px; margin: 0 auto; padding: 20px;\">\n  <h2 style=\"color: #dc2626;\">Hi {{ $('Webhook Trigger').item.json.body.referrer_name }},</h2>\n  \n  <p style=\"font-size: 16px; line-height: 1.6;\">We received your referral submission, but unfortunately the email address could not be verified.</p>\n  \n  <p style=\"font-size: 16px; line-height: 1.6;\">This could be due to:</p>\n  <ul style=\"line-height: 1.8;\">\n    <li>Email address typo</li>\n    <li>Disposable/temporary email service</li>\n    <li>Invalid email format</li>\n  </ul>\n  \n  <p style=\"font-size: 16px; line-height: 1.6;\">Please double-check the email address and submit again.</p>\n  \n  <p style=\"font-size: 16px; line-height: 1.6;\">If you believe this is an error, please contact our support team.</p>\n  \n  <p style=\"margin-top: 30px; font-size: 16px;\">Thank you for your understanding!</p>\n  \n  <p style=\"font-size: 16px;\">– The Team</p>\n</div>",
        "options": {},
        "subject": "Referral Submission - Email Verification Failed"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "YOUR_GMAIL_OAUTH2_ID",
          "name": "Gmail OAuth2"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "a3492dc2-37c2-41ae-be4e-b92c5990d66d",
      "name": "便签 - 无效邮箱通知",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -16,
        448
      ],
      "parameters": {
        "width": 316,
        "height": 496,
        "content": "## ❌ 无效邮箱通知"
      },
      "typeVersion": 1
    },
    {
      "id": "3435d390-9873-4c19-87a1-c6a5dbb92cbd",
      "name": "记录到 Google Sheets(失败)",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        400,
        464
      ],
      "parameters": {
        "columns": {
          "value": {
            "Status": "Email Verification Failed",
            "Campaign": "={{ $('Webhook Trigger').item.json.body.campaign }}",
            "Timestamp": "={{ $now.toISO() }}",
            "Referrer Name": "={{ $('Webhook Trigger').item.json.body.referrer_name }}",
            "Referrer Email": "={{ $('Webhook Trigger').item.json.body.referrer_email }}"
          },
          "schema": [
            {
              "id": "Timestamp",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Timestamp",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Referrer Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Referrer Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Referrer Email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Referrer Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Coupon Code",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Coupon Code",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Coupon Image URL",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Coupon Image URL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Campaign",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Campaign",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Referrer Email"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_GOOGLE_SHEETS_SHEET_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEETS_ID/edit#gid/YOUR_GOOGLE_SHEETS_SHEET_ID",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_GOOGLE_SHEETS_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEETS_ID/edit?usp=drivesdk",
          "cachedResultName": "Referral_Reward_Tracker"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "YOUR_GOOGLE_SHEETS_OAUTH2_ID",
          "name": "Google Sheets OAuth2"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "2c134161-6eb6-4ff0-8fe1-98f92f04f9f4",
      "name": "便签 - 记录失败",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        320,
        448
      ],
      "parameters": {
        "width": 396,
        "height": 576,
        "content": "## 📊 记录到 Google Sheets(失败)"
      },
      "typeVersion": 1
    },
    {
      "id": "dfcf248e-bc0c-47f6-b652-cb399892c3a3",
      "name": "Verifi Email",
      "type": "n8n-nodes-verifiemail.verifiEmail",
      "position": [
        -560,
        368
      ],
      "parameters": {
        "email": "={{ $json.body.referrer_email }}"
      },
      "credentials": {
        "verifiEmailApi": {
          "id": "YOUR_VERIFI_EMAIL_API_ID",
          "name": "VerifiEmail API"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "2dc38b0a-115d-4c60-9cbb-177c305b571b",
      "name": "HTML/CSS 转图片",
      "type": "n8n-nodes-htmlcsstoimage.htmlCssToImage",
      "position": [
        400,
        256
      ],
      "parameters": {
        "html_content": "=<!DOCTYPE html>\n<html>\n<head>\n<style>\n  body {\n    font-family: 'Inter', Arial, sans-serif;\n    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);\n    margin: 0;\n    padding: 40px;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    min-height: 100vh;\n  }\n  .coupon-card {\n    background: white;\n    border-radius: 20px;\n    padding: 40px;\n    box-shadow: 0 20px 60px rgba(0,0,0,0.3);\n    text-align: center;\n    max-width: 500px;\n  }\n  h1 {\n    color: #667eea;\n    font-size: 32px;\n    margin-bottom: 10px;\n  }\n  .reward-amount {\n    font-size: 48px;\n    color: #16a34a;\n    font-weight: bold;\n    margin: 20px 0;\n  }\n  .coupon-code {\n    background: #f3f4f6;\n    padding: 15px 25px;\n    border-radius: 10px;\n    font-size: 24px;\n    font-weight: bold;\n    color: #1f2937;\n    letter-spacing: 2px;\n    margin: 20px 0;\n    border: 2px dashed #667eea;\n  }\n  .campaign-name {\n    color: #6b7280;\n    font-size: 14px;\n    margin-top: 20px;\n  }\n</style>\n</head>\n<body>\n  <div class=\"coupon-card\">\n    <h1>🎁 Referral Reward</h1>\n    <p style=\"font-size: 18px;\">Hey <strong>{{ $('Webhook Trigger').item.json.body.referrer_name }}</strong>,</p>\n    <p>Thanks for referring your friend!</p>\n    <div class=\"reward-amount\">10% OFF</div>\n    <p>Your Exclusive Coupon Code:</p>\n    <div class=\"coupon-code\">\n      {{ $json.coupon_code }}\n    </div>\n    <p style=\"margin-top: 20px;\">Valid for 30 days</p>\n    <p class=\"campaign-name\">Campaign: {{ $('Webhook Trigger').item.json.body.campaign }}</p>\n  </div>\n</body>\n</html>"
      },
      "credentials": {
        "htmlcsstoimgApi": {
          "id": "YOUR_HTMLCSSTOIMG_API_Key",
          "name": "Htmlcsstoimg API"
        }
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "",
  "connections": {
    "Verifi Email": {
      "main": [
        [
          {
            "node": "IF Email Valid?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF Email Valid?": {
      "main": [
        [
          {
            "node": "Set Coupon Template",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Invalid Email Notice",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook Trigger": {
      "main": [
        [
          {
            "node": "Verifi Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTML/CSS to Image": {
      "main": [
        [
          {
            "node": "Send Reward Email (Gmail)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Coupon Template": {
      "main": [
        [
          {
            "node": "HTML/CSS to Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Invalid Email Notice": {
      "main": [
        [
          {
            "node": "Log to Google Sheets (Failed)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Reward Email (Gmail)": {
      "main": [
        [
          {
            "node": "Log to Google Sheets (Success)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 社交媒体

需要付费吗?

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

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

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

作者
Jitesh Dugar

Jitesh Dugar

@jiteshdugar

AI Automation Specialist - OpenAI, CRM & Automation Expert with a solid understanding of various tools that include Zapier, Make, Zoho CRM, Hubspot, Google Sheets, Airtable, Pipedrive, Google Analytics, and more.

外部链接
在 n8n.io 查看

分享此工作流