-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemail_campaign_workflow.json
More file actions
96 lines (95 loc) · 3.21 KB
/
email_campaign_workflow.json
File metadata and controls
96 lines (95 loc) · 3.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
{
"name": "Email Campaign – Google Sheets + SMTP + Tracking",
"nodes": [
{
"id": "ManualTrigger",
"name": "Manual Trigger",
"type": "n8n-nodes-base.manualTrigger",
"position": [200, 300]
},
{
"id": "ReadSheet",
"name": "Read Google Sheet",
"type": "n8n-nodes-base.googleSheets",
"position": [400, 300],
"parameters": {
"operation": "read",
"sheetId": "PUT_GOOGLE_SHEET_ID",
"range": "Sheet1"
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "GOOGLE_CRED_ID",
"name": "Google Sheets OAuth2"
}
}
},
{
"id": "IfEmail",
"name": "IF Email Exists",
"type": "n8n-nodes-base.if",
"position": [600, 300],
"parameters": {
"conditions": {
"string": [
{
"value1": "={{$json.email}}",
"operation": "isNotEmpty"
}
]
}
}
},
{
"id": "SetVars",
"name": "Set Campaign Variables",
"type": "n8n-nodes-base.set",
"position": [800, 300],
"parameters": {
"values": {
"string": [
{ "name": "campaign_id", "value": "CA-2025-001" },
{ "name": "sender_name", "value": "Test Name" },
{ "name": "base_tracking_url", "value": "Your Link" }
]
}
}
},
{
"id": "Tracking",
"name": "Generate Tracking URL",
"type": "n8n-nodes-base.function",
"position": [1000, 300],
"parameters": {
"functionCode": "const crypto = require('crypto');\nitem.tracking_id = crypto.randomUUID();\nitem.tracking_url = `${item.base_tracking_url}?cid=${item.campaign_id}&tid=${item.tracking_id}&email=${encodeURIComponent(item.email)}`;\nreturn item;"
}
},
{
"id": "SendEmail",
"name": "Send Email (SMTP)",
"type": "n8n-nodes-base.emailSend",
"position": [1200, 300],
"parameters": {
"fromEmail": "security@yourdomain.com",
"fromName": "={{$json.sender_name}}",
"toEmail": "={{$json.email}}",
"toName": "={{$json.name}}",
"subject": "Important Security Awareness Notice",
"html": "<h2>Hello {{$json.name}},</h2><p>This email is part of an authorized security awareness campaign.</p><p><a href=\"{{$json.tracking_url}}\" style=\"background:#2563eb;color:#fff;padding:12px 20px;text-decoration:none;border-radius:4px;\">Review Activity</a></p><p>Regards,<br><b>Nitish</b></p>"
},
"credentials": {
"smtp": {
"id": "SMTP_CRED_ID",
"name": "SMTP Account"
}
}
}
],
"connections": {
"Manual Trigger": { "main": [[{ "node": "Read Google Sheet", "type": "main" }]] },
"Read Google Sheet": { "main": [[{ "node": "IF Email Exists", "type": "main" }]] },
"IF Email Exists": { "main": [[{ "node": "Set Campaign Variables", "type": "main" }]] },
"Set Campaign Variables": { "main": [[{ "node": "Generate Tracking URL", "type": "main" }]] },
"Generate Tracking URL": { "main": [[{ "node": "Send Email (SMTP)", "type": "main" }]] }
}
}