-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Expand file tree
/
Copy pathLeadPilot Lite - AI Cold Email Writer.json
More file actions
159 lines (159 loc) · 7.07 KB
/
Copy pathLeadPilot Lite - AI Cold Email Writer.json
File metadata and controls
159 lines (159 loc) · 7.07 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
{
"name": "LeadPilot Lite — Manual Lead Email Writer",
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "leadpilot-lite",
"responseMode": "responseNode",
"options": {}
},
"id": "trigger-webhook",
"name": "Receive Lead Data",
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [200, 400],
"webhookId": "leadpilot-lite-input"
},
{
"parameters": {
"jsCode": "const body = $input.first().json.body || $input.first().json;\nconst leads = body.leads || [body];\n\nif (!leads.length || !leads[0].name) {\n throw new Error('Please provide leads with at least: name, email, title, company. Format: { \"leads\": [{ \"name\": \"...\", \"email\": \"...\", \"title\": \"...\", \"company\": \"...\" }] }');\n}\n\nconst senderName = body.sender_name || $env.LEADPILOT_SENDER_NAME || 'Your Name';\nconst senderCompany = body.sender_company || $env.LEADPILOT_SENDER_COMPANY || 'Your Company';\nconst senderValue = body.value_prop || $env.LEADPILOT_VALUE_PROP || 'We help companies save time with automation.';\nconst calendarLink = body.calendar_link || $env.LEADPILOT_CALENDAR_LINK || '';\n\nreturn leads.map(lead => ({\n json: {\n name: lead.name,\n email: lead.email || '',\n title: lead.title || '',\n company: lead.company || '',\n industry: lead.industry || '',\n companyDescription: lead.company_description || '',\n linkedinUrl: lead.linkedin_url || '',\n notes: lead.notes || '',\n senderName,\n senderCompany,\n senderValue,\n calendarLink,\n requestId: require('crypto').randomUUID()\n }\n}));"
},
"id": "parse-input",
"name": "Parse Lead List",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [420, 400]
},
{
"parameters": {
"model": "gpt-4o-mini",
"messages": {
"values": [
{
"role": "system",
"content": "You are an elite cold email copywriter. Write a personalized cold email.\n\nRules:\n- Subject: 3-7 words, personalized, zero spam triggers\n- Opening: Reference their company or role specifically\n- Body: 50-80 words MAX. One pain point + one value prop.\n- CTA: Soft question or calendar link\n- Include 1 follow-up email (3 days later, 30-50 words)\n\nJSON: { \"subjectLine\": \"...\", \"emailBody\": \"full email\", \"followUp\": { \"subject\": \"Re: [subject]\", \"body\": \"follow-up text\" } }"
},
{
"role": "user",
"content": "=Write a cold email:\n\nRecipient: {{$json.name}}\nTitle: {{$json.title}}\nCompany: {{$json.company}}\nIndustry: {{$json.industry}}\nAbout Company: {{$json.companyDescription}}\nNotes: {{$json.notes}}\n\nSender: {{$json.senderName}} at {{$json.senderCompany}}\nValue Prop: {{$json.senderValue}}\nCalendar: {{$json.calendarLink}}"
}
]
},
"options": {
"temperature": 0.7,
"maxTokens": 800,
"responseFormat": "json_object"
}
},
"id": "ai-write-email",
"name": "AI: Write Cold Email",
"type": "n8n-nodes-base.openAi",
"typeVersion": 1.8,
"position": [660, 400],
"retryOnFail": true,
"maxTries": 3,
"waitBetweenTries": 2000
},
{
"parameters": {
"jsCode": "const lead = $('Parse Lead List').item;\nconst emailRaw = $input.first().json;\nlet emailData;\ntry {\n emailData = JSON.parse(emailRaw.message?.content || emailRaw.content || '{}');\n} catch (e) {\n throw new Error('Failed to parse email: ' + e.message);\n}\n\nreturn [{\n json: {\n ...lead.json,\n email_subject: emailData.subjectLine || '',\n email_body: emailData.emailBody || '',\n followUp_subject: emailData.followUp?.subject || '',\n followUp_body: emailData.followUp?.body || '',\n generatedAt: new Date().toISOString()\n }\n}];"
},
"id": "merge-results",
"name": "Merge Lead + Email",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [880, 400]
},
{
"parameters": {
"operation": "append",
"documentId": {
"__rl": true,
"value": "={{ $env.LEADPILOT_SHEET_ID }}",
"mode": "id"
},
"sheetName": {
"__rl": true,
"value": "Lite Pipeline",
"mode": "name"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"Name": "={{ $json.name }}",
"Email": "={{ $json.email }}",
"Title": "={{ $json.title }}",
"Company": "={{ $json.company }}",
"Subject Line": "={{ $json.email_subject }}",
"Email Body": "={{ $json.email_body }}",
"Follow-up": "={{ $json.followUp_body }}",
"Generated At": "={{ $json.generatedAt }}",
"Sent": "=No"
}
},
"options": {}
},
"id": "save-sheets",
"name": "Save to Google Sheets",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.5,
"position": [1120, 300],
"retryOnFail": true,
"maxTries": 2
},
{
"parameters": {
"respondWith": "json",
"responseBody": "={{ JSON.stringify({ success: true, lead: $json.name, company: $json.company, subjectLine: $json.email_subject, message: 'Email generated. Check Google Sheets to review and send.' }) }}"
},
"id": "respond-success",
"name": "Respond: Success",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.1,
"position": [1120, 500]
},
{
"parameters": {
"content": "## LeadPilot Lite — Manual Lead Email Writer\n\nSimplified version for manual lead lists.\nNo Apollo.io needed — you provide the leads.\n\n**Input:** POST with lead data (name, email, title, company)\n**Output:** Personalized cold email + 1 follow-up\n**Saved to:** Google Sheets for review before sending\n\nPerfect for:\n- Small lead lists (5-20 leads)\n- Manual prospecting\n- Testing email copy before scaling",
"width": 380,
"height": 280,
"color": 6
},
"id": "note-overview",
"name": "Sticky Note: Overview",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [120, 80]
}
],
"connections": {
"Receive Lead Data": {
"main": [[{ "node": "Parse Lead List", "type": "main", "index": 0 }]]
},
"Parse Lead List": {
"main": [[{ "node": "AI: Write Cold Email", "type": "main", "index": 0 }]]
},
"AI: Write Cold Email": {
"main": [[{ "node": "Merge Lead + Email", "type": "main", "index": 0 }]]
},
"Merge Lead + Email": {
"main": [[
{ "node": "Save to Google Sheets", "type": "main", "index": 0 },
{ "node": "Respond: Success", "type": "main", "index": 0 }
]]
}
},
"settings": {
"executionOrder": "v1",
"saveManualExecutions": true
},
"tags": [
{ "name": "LeadPilot", "id": "leadpilot" },
{ "name": "AutoFlow", "id": "autoflow" },
{ "name": "Lite", "id": "lite" }
],
"meta": {
"instanceId": "leadpilot-lite-v1"
}
}