This workflow corresponds to n8n.io template #10161 — we link there as the canonical source.
This workflow follows the Gmail → Google Sheets recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"id": "",
"meta": {
"templateCredsSetupCompleted": false
},
"name": "Verified Referral Reward Notification",
"tags": [],
"nodes": [
{
"id": "fe5b07ff-5797-4250-a69e-49860089cdca",
"name": "Sticky Note - Setup Credentials",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1552,
80
],
"parameters": {
"color": 2,
"width": 520,
"height": 432,
"content": "## \ud83d\udd10 SETUP CREDENTIALS REQUIRED\n\n\n1\ufe0f\u20e3 **VerifiEmail API Key**\n - Sign up at: https://verifi.email\n - Get your API key from dashboard\n\n2\ufe0f\u20e3 **HTMLCSStoImage API**\n - Sign up at: https://htmlcsstoimg.com\n - Get User ID and API Key\n\n3\ufe0f\u20e3 **Gmail Account**\n - Enable 2FA on your Gmail\n\n4\ufe0f\u20e3 **Google Sheets**\n - Create sheet: 'Referral_Reward_Tracker'\n - Headers: Timestamp | Referrer Name | Referrer Email | Status | Coupon Code | Coupon Image URL | Campaign\n\n\u2705 Test each credential before activating!"
},
"typeVersion": 1
},
{
"id": "716c5cc8-d3fe-41e2-ac10-7c65c509b234",
"name": "Webhook Trigger",
"type": "n8n-nodes-base.webhook",
"position": [
-880,
368
],
"parameters": {
"path": "referral-reward",
"options": {},
"httpMethod": "POST",
"responseMode": "responseNode"
},
"typeVersion": 1
},
{
"id": "302609be-73be-4d33-bd9d-b9fba0077c64",
"name": "Sticky Note - Webhook",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1008,
48
],
"parameters": {
"color": 3,
"width": 380,
"height": 460,
"content": "## \ud83c\udfaf WEBHOOK TRIGGER\n\n**Purpose:** Receives referral form submissions from Jotform\n\n**Expected Data:**\n```json\n{\n \"referrer_name\": \"John Doe\",\n \"referrer_email\": \"john@example.com\",\n \"referred_friend\": \"jane@example.com\",\n \"campaign\": \"Holiday Referral 2025\"\n}\n```\n"
},
"typeVersion": 1
},
{
"id": "7b2fa8ce-5ed9-4e78-8373-2aa62845fffb",
"name": "Sticky Note - Email Verification",
"type": "n8n-nodes-base.stickyNote",
"position": [
-608,
192
],
"parameters": {
"color": 4,
"width": 204,
"height": 332,
"content": "## \u2705 EMAIL VERIFICATION\n\n**Purpose:** Validate referrer email to prevent abuse and fake submissions\n"
},
"typeVersion": 1
},
{
"id": "776e1c97-2b01-42c9-ae75-463823f90646",
"name": "IF Email Valid?",
"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": "Sticky Note - Conditional Branch",
"type": "n8n-nodes-base.stickyNote",
"position": [
-384,
144
],
"parameters": {
"color": 5,
"width": 316,
"height": 372,
"content": "## \u2696\ufe0f CONDITIONAL LOGIC\n\n**Condition:**\n- IF `status` equals `valid`\n \u2192 TRUE: Generate reward coupon\n \u2192 FALSE: Send rejection email\n\n**Branches:**\n\u2705 TRUE \u2192 Coupon generation flow\n\u274c FALSE \u2192 Invalid email notification"
},
"typeVersion": 1
},
{
"id": "40585967-a862-4c5b-a212-f20b80be4c80",
"name": "Set Coupon Template",
"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": "Sticky Note - Coupon Template",
"type": "n8n-nodes-base.stickyNote",
"position": [
-48,
-64
],
"parameters": {
"color": 6,
"width": 380,
"height": 460,
"content": "## \ud83c\udfa8 COUPON TEMPLATE CREATION\n\n**Purpose:** Generate personalized HTML coupon card with dynamic data\n\n**Fields Created:**\n1. `html_content` - Complete HTML/CSS coupon card\n2. `referrer_name` - From webhook data\n3. `referrer_email` - From webhook data\n4. `campaign` - Campaign identifier\n5. `coupon_code` - Unique code format: REF-JOHN1234\n\n\n"
},
"typeVersion": 1
},
{
"id": "9f826d92-a7ad-4254-9413-574d0e4587f9",
"name": "Sticky Note - HTML to Image",
"type": "n8n-nodes-base.stickyNote",
"position": [
352,
64
],
"parameters": {
"color": 6,
"width": 204,
"height": 332,
"content": "## \ud83d\uddbc\ufe0f HTML TO IMAGE CONVERSION\n\n**Purpose:** Convert HTML coupon card into a high-quality PNG image\n\n"
},
"typeVersion": 1
},
{
"id": "1148e573-98e7-41ae-9295-7cf0113a357c",
"name": "Send Reward Email (Gmail)",
"type": "n8n-nodes-base.gmail",
"position": [
656,
256
],
"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! \ud83c\udf89</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! \ud83d\udc99</p>\n \n <p style=\"font-size: 16px;\">\u2013 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": "\ud83c\udf81 Your Referral Reward Coupon is Here!"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "95d7218e-cbb2-4c33-a31b-f7140b764e82",
"name": "Sticky Note - Reward Email",
"type": "n8n-nodes-base.stickyNote",
"position": [
576,
-16
],
"parameters": {
"color": 7,
"width": 332,
"height": 444,
"content": "## \ud83d\udce7 SEND REWARD EMAIL\n\n**Purpose:** Deliver personalized reward email with coupon image to referrer\n\n Coupon is Here!\"\n- **Body:** HTML formatted with:\n \u2022 Personalized greeting\n \u2022 Embedded coupon image from HCTI\n \u2022 Text version of coupon code\n \u2022 Validity information (30 days)\n \u2022 Campaign details\n"
},
"typeVersion": 1
},
{
"id": "eb052f76-0c33-418a-a6a2-c9a1835e46ab",
"name": "Log to Google Sheets (Success)",
"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": {
"name": "<your credential>"
}
},
"typeVersion": 4.2
},
{
"id": "f019b026-0714-4523-bd95-0bde43ade8d7",
"name": "Sticky Note - Log Success",
"type": "n8n-nodes-base.stickyNote",
"position": [
928,
-32
],
"parameters": {
"color": 4,
"width": 380,
"height": 464,
"content": "## \ud83d\udcca LOG TO GOOGLE SHEETS (SUCCESS)\n\n**Purpose:** Track all successful referral rewards for analytics and reporting\n\n**Sheet Name:** Referral_Reward_Tracker\n**Operation:** Append Row\n\n**Sheet Headers Required:**\n`Timestamp | Referrer Name | Referrer Email | Status | Coupon Code | Coupon Image URL | Campaign`\n\n"
},
"typeVersion": 1
},
{
"id": "9e8164af-fe19-4170-91ce-fdab6228d09c",
"name": "Send Invalid Email Notice",
"type": "n8n-nodes-base.gmail",
"position": [
80,
464
],
"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;\">\u2013 The Team</p>\n</div>",
"options": {},
"subject": "Referral Submission - Email Verification Failed"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "a3492dc2-37c2-41ae-be4e-b92c5990d66d",
"name": "Sticky Note - Invalid Email Notice",
"type": "n8n-nodes-base.stickyNote",
"position": [
-16,
448
],
"parameters": {
"width": 316,
"height": 496,
"content": "\n\n\n\n\n\n\n\n\n\n\n\n\n## \u274c INVALID EMAIL NOTIFICATION\n\n**Purpose:** Inform user their email failed verification\n\n**Email Content:**\n- Polite explanation of verification failure\n- Possible reasons:\n \u2022 Email typo\n \u2022 Disposable email service\n \u2022 Invalid format\n- Instructions to resubmit\n- Support contact option"
},
"typeVersion": 1
},
{
"id": "3435d390-9873-4c19-87a1-c6a5dbb92cbd",
"name": "Log to Google Sheets (Failed)",
"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": {
"name": "<your credential>"
}
},
"typeVersion": 4.2
},
{
"id": "2c134161-6eb6-4ff0-8fe1-98f92f04f9f4",
"name": "Sticky Note - Log Failed",
"type": "n8n-nodes-base.stickyNote",
"position": [
320,
448
],
"parameters": {
"width": 396,
"height": 576,
"content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n## \ud83d\udcca LOG TO GOOGLE SHEETS (FAILED)\n\n**Purpose:** Track failed verification attempts for analysis\n\n**Analytics Value:**\n- Identify patterns in failed submissions\n- Track conversion rate (valid vs invalid)\n- Campaign quality assessment\n- Fraud detection patterns\n\n**Business Insights:**\n- % of valid submissions\n- Most common failure reasons\n- Campaign effectiveness\n- User behavior patterns"
},
"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": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "2dc38b0a-115d-4c60-9cbb-177c305b571b",
"name": "HTML/CSS to Image",
"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>\ud83c\udf81 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": {
"name": "<your credential>"
}
},
"typeVersion": 1
}
],
"active": false,
"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
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
gmailOAuth2googleSheetsOAuth2ApihtmlcsstoimgApiverifiEmailApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Transform your referral program into a fully automated, fraud-resistant system that delivers professional rewards to verified referrers. This workflow combines email validation, dynamic coupon generation with visual design, automated email delivery, and comprehensive…
Source: https://n8n.io/workflows/10161/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
Transform your visitor management process with this fully automated, enterprise-grade workflow. The Verified Visitor Pass Generator eliminates manual data entry, prevents fake registrations through em
This comprehensive workflow automates the entire event RSVP process from form submission to attendee confirmation, including real-time email validation and personalized digital badge generation.
This workflow automatically generates beautiful, personalized promotional cards with QR codes and sends them via email to verified users. Perfect for e-commerce stores, marketing campaigns, and custom
Automate press credential verification and badge generation for journalists covering your events
A comprehensive n8n workflow template for automating e-commerce return processes with fraud prevention and professional document generation. E-commerce businesses preventing fraudulent returns Custome