From bcac2c7df5eb5edf57caea6582c6e8c3e5958a6f Mon Sep 17 00:00:00 2001 From: nusquama Date: Tue, 10 Mar 2026 12:14:08 +0800 Subject: [PATCH] creation --- ...ach-campaigns-from-telegram-with-gmail-and-google-sheets.webp | 1 + 1 file changed, 1 insertion(+) create mode 100644 workflows/Run email outreach campaigns from Telegram with Gmail and Google Sheets-13732/13732-run-email-outreach-campaigns-from-telegram-with-gmail-and-google-sheets.webp diff --git a/workflows/Run email outreach campaigns from Telegram with Gmail and Google Sheets-13732/13732-run-email-outreach-campaigns-from-telegram-with-gmail-and-google-sheets.webp b/workflows/Run email outreach campaigns from Telegram with Gmail and Google Sheets-13732/13732-run-email-outreach-campaigns-from-telegram-with-gmail-and-google-sheets.webp new file mode 100644 index 000000000..0179f07f1 --- /dev/null +++ b/workflows/Run email outreach campaigns from Telegram with Gmail and Google Sheets-13732/13732-run-email-outreach-campaigns-from-telegram-with-gmail-and-google-sheets.webp @@ -0,0 +1 @@ +{"id":"dmn8AntnAjByNdMj","meta":{"instanceId":"1cfae1c5e40abdb9d6aa4140af4a502d39ba6c004725411e2213384175f7e3f4","templateCredsSetupCompleted":true},"name":"Automated Email Outreach via Telegram and Google Sheets","tags":[],"nodes":[{"id":"0952c637-9082-49df-a91f-761a904496be","name":"Track Email Open","type":"n8n-nodes-base.webhook","position":[512,592],"webhookId":"cfe0a051-fb6c-4c9b-92e0-4fadb9568bab","parameters":{"path":"open","options":{}},"typeVersion":2.1},{"id":"779f275e-23c0-4393-847d-11386736bef5","name":"Map Campaign Fields","type":"n8n-nodes-base.set","position":[1184,-128],"parameters":{"options":{},"assignments":{"assignments":[{"id":"0f6f928d-8c88-482d-91a5-9a51a2f58b43","name":"EmailContent","type":"string","value":"={{ $json.data.Content }}"},{"id":"04380532-4dd6-4b15-9fbc-1f19839d471c","name":"Email","type":"string","value":"={{ $json.data[\"Choose the email\"] }}"},{"id":"7244d93f-6b12-4d87-a9df-23774b323db9","name":"Subject","type":"string","value":"={{ $json.data.Subject }}"}]}},"typeVersion":3.4},{"id":"5097d9c0-c330-41ea-9594-c7918875fe37","name":"Prompt Campaign via Telegram","type":"n8n-nodes-base.telegram","position":[960,-128],"webhookId":"747c0f19-145a-4458-b7a3-feaebca16bb7","parameters":{"chatId":"123456789","message":"Start outreach Here 👇","options":{"limitWaitTime":{"values":{"resumeUnit":"minutes","resumeAmount":5}}},"operation":"sendAndWait","formFields":{"values":[{"fieldType":"dropdown","fieldLabel":"Choose the email","fieldOptions":{"values":[{"option":"user@example.com"},{"option":"user@example.com"}]},"requiredField":true},{"fieldLabel":"Subject"},{"fieldType":"textarea","fieldLabel":"Content","requiredField":true},{"fieldLabel":"Cap","placeholder":"(Optional) 50 Default"}]},"responseType":"customForm"},"typeVersion":1.2},{"id":"6a271b9c-0cb4-4ce4-84b0-01e67d23bb8e","name":"Create Campaign Row","type":"n8n-nodes-base.googleSheets","position":[1408,-128],"parameters":{"columns":{"value":{"Sn":"==ROW() - 1","Cap":"50","Sent":"0","Email":"={{ $json.Email }}","Failed":"0","Opened":"0","Status":"draft","Content":"={{ $json.EmailContent }}","Subject":"={{ $json.Subject }}"},"schema":[{"id":"Sn","type":"string","display":true,"required":false,"displayName":"Sn","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Email","type":"string","display":true,"required":false,"displayName":"Email","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Subject","type":"string","display":true,"removed":false,"required":false,"displayName":"Subject","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Content","type":"string","display":true,"required":false,"displayName":"Content","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Cap","type":"string","display":true,"required":false,"displayName":"Cap","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Status","type":"string","display":true,"required":false,"displayName":"Status","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Sent","type":"string","display":true,"required":false,"displayName":"Sent","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Failed","type":"string","display":true,"required":false,"displayName":"Failed","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Opened","type":"string","display":true,"required":false,"displayName":"Opened","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"append","sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE/edit#gid=0","cachedResultName":"Dashboard"},"documentId":{"__rl":true,"mode":"list","value":"1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE/edit?usp=drivesdk","cachedResultName":"Email Outreach"}},"typeVersion":4.7},{"id":"781e0cc2-65ab-4b00-bd32-e6cad5266bc2","name":"Route by Sender Email","type":"n8n-nodes-base.switch","position":[960,192],"parameters":{"rules":{"values":[{"outputKey":"Ayush","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"31c728fb-bbc1-428c-bcd0-b618ac430f43","operator":{"type":"string","operation":"equals"},"leftValue":"={{ $json.Email }}","rightValue":"=aitechcompany11@gmail.com"}]},"renameOutput":true},{"outputKey":"kayaash","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"e61a1b70-1b3e-4bd2-831b-3cd8a3c31dde","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.Email }}","rightValue":"=kayaash@blockwee.xyz"}]},"renameOutput":true},{"outputKey":"sonam","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"b93d3fbb-c66e-4725-92d3-9168ef0c3886","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.Email }}","rightValue":"user@example.com"}]},"renameOutput":true}]},"options":{}},"typeVersion":3.2},{"id":"43c8ec29-b123-4bea-91bd-95f5f3f8cafb","name":"Build HTML Template","type":"n8n-nodes-base.html","position":[2080,208],"parameters":{"html":"\n\n\n \n {{ $('Loop Over Leads').item.json.subject }}\n \n \n\n\n
\n \n \n \n \n \n\n \n \n \n \n
\n {{ $('Loop Over Leads').item.json.content }}\n
\n

\n You are receiving this email from AI Tech because we believe it could be relevant to.
\n If you prefer not to receive further messages, you can unsubscribe here.\n

\n

\n
\n
\n\n\n"},"typeVersion":1.2},{"id":"7f6decf7-a101-4d71-9f58-d314c9436dd0","name":"Extract Tracking Params","type":"n8n-nodes-base.set","position":[704,592],"parameters":{"options":{},"assignments":{"assignments":[{"id":"9b330c11-7b6c-4a00-86a6-bde01316b915","name":"id","type":"string","value":"={{ $json.query.id }}"},{"id":"aa8371d9-a31f-4e30-8ff1-be738bca31d2","name":"email","type":"string","value":"={{ $json.query.email }}"}]}},"typeVersion":3.4},{"id":"cdfcc1e6-f51d-4081-9783-5a102df8efa4","name":"Increment Open Count","type":"n8n-nodes-base.googleSheets","position":[1744,608],"parameters":{"columns":{"value":{"Sn":"={{ $('Extract Tracking Params').item.json.id }}","Opened":"={{ $json.Opened + 1}}"},"schema":[{"id":"Sn","type":"string","display":true,"removed":false,"required":false,"displayName":"Sn","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Email","type":"string","display":true,"removed":true,"required":false,"displayName":"Email","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Content","type":"string","display":true,"removed":true,"required":false,"displayName":"Content","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Cap","type":"string","display":true,"removed":true,"required":false,"displayName":"Cap","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Status","type":"string","display":true,"removed":true,"required":false,"displayName":"Status","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Sent","type":"string","display":true,"removed":true,"required":false,"displayName":"Sent","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Failed","type":"string","display":true,"removed":true,"required":false,"displayName":"Failed","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Opened","type":"string","display":true,"required":false,"displayName":"Opened","defaultMatch":false,"canBeUsedToMatch":true},{"id":"row_number","type":"number","display":true,"removed":true,"readOnly":true,"required":false,"displayName":"row_number","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["Sn"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"update","sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE/edit#gid=0","cachedResultName":"Dashboard"},"documentId":{"__rl":true,"mode":"list","value":"1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE/edit?usp=drivesdk","cachedResultName":"Email Outreach"}},"typeVersion":4.7},{"id":"4f6cface-e987-49ab-b071-b8e7987eafd8","name":"Lookup Campaign Row","type":"n8n-nodes-base.googleSheets","position":[912,592],"parameters":{"options":{},"filtersUI":{"values":[{"lookupValue":"={{ $json.id }}","lookupColumn":"Sn"}]},"sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE/edit#gid=0","cachedResultName":"Dashboard"},"documentId":{"__rl":true,"mode":"list","value":"1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE/edit?usp=drivesdk","cachedResultName":"Email Outreach"}},"typeVersion":4.7},{"id":"d25db34e-e0d5-4942-85c3-71ecae442f06","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[432,448],"parameters":{"color":6,"width":1936,"height":352,"content":"## 3. Track Email Opens\n\nWebhook receives open-tracking pixel hits. Looks up the campaign row,\nchecks if the open was already logged, increments the open counter,\nand writes to the logs sheet to prevent duplicate counts."},"typeVersion":1},{"id":"6087ee53-bd39-4130-b87e-675a7d6417ab","name":"Watch for New Campaigns","type":"n8n-nodes-base.googleSheetsTrigger","position":[512,208],"parameters":{"event":"rowAdded","options":{},"pollTimes":{"item":[{"mode":"everyMinute"}]},"sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE/edit#gid=0","cachedResultName":"Dashboard"},"documentId":{"__rl":true,"mode":"list","value":"1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE/edit?usp=drivesdk","cachedResultName":"Email Outreach"}},"typeVersion":1},{"id":"a0ff6769-ad01-4211-91f4-901fb005d714","name":"Send Email via Gmail","type":"n8n-nodes-base.gmail","position":[2304,208],"webhookId":"ce78f2e6-6654-4b1c-8de7-c7c440e150ec","parameters":{"sendTo":"={{ $('Loop Over Leads').item.json.email }}","message":"={{ $json.html }}\n\n\n","options":{"appendAttribution":false},"subject":"={{ $('Loop Over Leads').item.json.subject }}"},"typeVersion":2.1},{"id":"4623b7e3-f19d-4634-a244-5ba7b93a5f14","name":"If Status Is Draft","type":"n8n-nodes-base.if","position":[736,208],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"5dbfb8cf-fb2d-4845-b9a2-d340cbffc69f","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.Status }}","rightValue":"draft"}]}},"typeVersion":2.2},{"id":"4b63591e-eabc-4973-a0ea-e7faba12500a","name":"Cap Lead Count","type":"n8n-nodes-base.limit","position":[1408,208],"parameters":{"maxItems":"={{ $('Watch for New Campaigns').item.json.Cap }}"},"typeVersion":1},{"id":"58ae18d7-1059-4c39-890a-a03869761f3c","name":"Wait Random Delay","type":"n8n-nodes-base.wait","position":[3200,208],"webhookId":"9578deb6-4dfb-46b6-879a-21ff05bf17e3","parameters":{"amount":"={{ $json.delaySeconds }}"},"typeVersion":1.1},{"id":"82813897-8576-4b5a-a804-607ca28501e8","name":"Generate Random Delay","type":"n8n-nodes-base.code","position":[2976,208],"parameters":{"jsCode":"// Generate a random integer between 1 and 5 (inclusive)\nconst randomMinutes = Math.floor(Math.random() * 5) + 1;\n\n// Convert minutes to seconds\nconst delaySeconds = randomMinutes * 60;\n\n// Return as JSON object (for n8n or similar)\nreturn [{ json: { delaySeconds } }];"},"typeVersion":2},{"id":"3aceaf2e-deb4-4151-881e-0b93c0d1311a","name":"Handle Unsubscribe","type":"n8n-nodes-base.webhook","position":[528,976],"webhookId":"cfe0a051-fb6c-4c9b-92e0-4fadb9568bab","parameters":{"path":"unsubscribe","options":{}},"typeVersion":2.1},{"id":"f178a7b6-eb73-434e-ba35-d2ac032fab48","name":"Extract Unsubscribe ID","type":"n8n-nodes-base.set","position":[752,976],"parameters":{"options":{},"assignments":{"assignments":[{"id":"9b330c11-7b6c-4a00-86a6-bde01316b915","name":"id","type":"string","value":"={{ $json.query.id }}"}]}},"typeVersion":3.4},{"id":"f954125b-d20c-4f1c-a84d-041eda995b39","name":"Mark as Unsubscribed","type":"n8n-nodes-base.googleSheets","position":[1200,976],"parameters":{"columns":{"value":{"Id":"={{ $json.Id }}","Subscribe":"no"},"schema":[{"id":"Id","type":"string","display":true,"removed":false,"required":false,"displayName":"Id","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Email","type":"string","display":true,"removed":true,"required":false,"displayName":"Email","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Name","type":"string","display":true,"removed":true,"required":false,"displayName":"Name","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Subscribe","type":"string","display":true,"removed":false,"required":false,"displayName":"Subscribe","defaultMatch":false,"canBeUsedToMatch":true},{"id":"row_number","type":"number","display":true,"removed":true,"readOnly":true,"required":false,"displayName":"row_number","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["Id"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"update","sheetName":{"__rl":true,"mode":"list","value":472191422,"cachedResultUrl":"https://docs.google.com/spreadsheets/d/1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE/edit#gid=472191422","cachedResultName":"Leads"},"documentId":{"__rl":true,"mode":"list","value":"1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE/edit?usp=drivesdk","cachedResultName":"Email Outreach"}},"typeVersion":4.7},{"id":"199c2c58-053c-4148-b9d6-74c0310ce55e","name":"Lookup Lead Record","type":"n8n-nodes-base.googleSheets","position":[976,976],"parameters":{"options":{},"filtersUI":{"values":[{"lookupValue":"={{ $json.id }}","lookupColumn":"Id"}]},"sheetName":{"__rl":true,"mode":"list","value":472191422,"cachedResultUrl":"https://docs.google.com/spreadsheets/d/1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE/edit#gid=472191422","cachedResultName":"Leads"},"documentId":{"__rl":true,"mode":"list","value":"1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE/edit?usp=drivesdk","cachedResultName":"Email Outreach"}},"typeVersion":4.7},{"id":"55d3860c-4d7f-4952-a1d1-04988d7355d2","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[448,832],"parameters":{"color":3,"width":944,"height":304,"content":"## 4. Handle Unsubscribe Requests\n\nWebhook endpoint receives unsubscribe clicks from email footers.\nLooks up the lead by ID and sets `Subscribe = no` to exclude\nthem from future campaigns."},"typeVersion":1},{"id":"0c52e8d5-52ef-42b8-b17b-be45ca564d3d","name":"Listen for Telegram Commands","type":"n8n-nodes-base.telegramTrigger","position":[512,-128],"webhookId":"afd8d618-7a37-4b3b-b496-038e3a88113f","parameters":{"updates":["message"],"additionalFields":{}},"typeVersion":1.2},{"id":"7556d447-a54d-4a14-a391-b782a399484f","name":"If Outreach Command","type":"n8n-nodes-base.if","position":[736,-128],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"3a57647f-17ef-43f0-bf41-362bab0bfc9f","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.message.text }}","rightValue":"/outreach"},{"id":"4189da0f-951d-4e36-a127-8174b6267ade","operator":{"type":"number","operation":"equals"},"leftValue":"={{ $json.message.chat.id}}","rightValue":1750928632}]}},"typeVersion":2.2},{"id":"7ccc8026-2329-4241-8411-09bc588f2eea","name":"Map Lead Fields","type":"n8n-nodes-base.set","position":[1632,208],"parameters":{"options":{},"assignments":{"assignments":[{"id":"af23a3d8-0835-4ab5-bc53-975284617653","name":"email","type":"string","value":"={{ $json.Email }}"},{"id":"6c70160c-1d52-4473-9ee0-47d648b081b9","name":"subject","type":"string","value":"={{ $('Route by Sender Email').item.json.Subject }}"},{"id":"88cc36b3-07dd-4532-b521-2abca1bc801d","name":"content","type":"string","value":"={{ $('Route by Sender Email').item.json.Content }}"},{"id":"e8a1c269-a94c-4ee0-aaa4-93701289610a","name":"id","type":"string","value":"={{ $('Route by Sender Email').item.json.Sn }}"},{"id":"07f7f836-8288-48a5-b351-8645e2dce175","name":"sent","type":"string","value":"={{ $('Watch for New Campaigns').item.json.Sent }}"}]}},"typeVersion":3.4},{"id":"1639bfb1-08fa-4b3b-894a-f16d13ff9250","name":"Loop Over Leads","type":"n8n-nodes-base.splitInBatches","position":[1856,208],"parameters":{"options":{}},"typeVersion":3},{"id":"42b0a806-733e-46ec-8362-7089fc6e8239","name":"Mark Campaign Done","type":"n8n-nodes-base.googleSheets","position":[2176,592],"parameters":{"columns":{"value":{"Sn":"={{ $json.id }}","Status":"Done"},"schema":[{"id":"Sn","type":"string","display":true,"removed":false,"required":false,"displayName":"Sn","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Email","type":"string","display":true,"removed":true,"required":false,"displayName":"Email","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Subject","type":"string","display":true,"removed":true,"required":false,"displayName":"Subject","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Content","type":"string","display":true,"removed":true,"required":false,"displayName":"Content","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Cap","type":"string","display":true,"removed":true,"required":false,"displayName":"Cap","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Status","type":"string","display":true,"removed":false,"required":false,"displayName":"Status","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Sent","type":"string","display":true,"removed":true,"required":false,"displayName":"Sent","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Failed","type":"string","display":true,"removed":true,"required":false,"displayName":"Failed","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Opened","type":"string","display":true,"removed":true,"required":false,"displayName":"Opened","defaultMatch":false,"canBeUsedToMatch":true},{"id":"row_number","type":"number","display":true,"removed":true,"readOnly":true,"required":false,"displayName":"row_number","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["Sn"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"update","sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE/edit#gid=0","cachedResultName":"Dashboard"},"documentId":{"__rl":true,"mode":"list","value":"1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE/edit?usp=drivesdk","cachedResultName":"Email Outreach"}},"typeVersion":4.7},{"id":"ef4365b1-e123-47b4-9d52-d21a35c876c1","name":"Update Send Stats","type":"n8n-nodes-base.googleSheets","position":[2752,208],"parameters":{"columns":{"value":{"Sn":"={{ $('Loop Over Leads').item.json.id }}","Sent":"={{ $('Fetch Current Stats').item.json.sent +1 }}","Status":"Running"},"schema":[{"id":"Sn","type":"string","display":true,"removed":false,"required":false,"displayName":"Sn","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Email","type":"string","display":true,"removed":true,"required":false,"displayName":"Email","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Subject","type":"string","display":true,"removed":true,"required":false,"displayName":"Subject","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Content","type":"string","display":true,"removed":true,"required":false,"displayName":"Content","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Cap","type":"string","display":true,"removed":true,"required":false,"displayName":"Cap","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Status","type":"string","display":true,"removed":false,"required":false,"displayName":"Status","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Sent","type":"string","display":true,"required":false,"displayName":"Sent","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Failed","type":"string","display":true,"removed":true,"required":false,"displayName":"Failed","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Opened","type":"string","display":true,"removed":true,"required":false,"displayName":"Opened","defaultMatch":false,"canBeUsedToMatch":true},{"id":"row_number","type":"number","display":true,"removed":true,"readOnly":true,"required":false,"displayName":"row_number","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["Sn"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"update","sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE/edit#gid=0","cachedResultName":"Dashboard"},"documentId":{"__rl":true,"mode":"list","value":"1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE/edit?usp=drivesdk","cachedResultName":"Email Outreach"}},"typeVersion":4.7},{"id":"f2be8c4a-b7af-410c-8331-49f0d5fadd86","name":"Fetch Current Stats","type":"n8n-nodes-base.googleSheets","position":[2528,208],"parameters":{"options":{},"filtersUI":{"values":[{"lookupValue":"={{ $('Loop Over Leads').item.json.id }}","lookupColumn":"Sn"}]},"sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE/edit#gid=0","cachedResultName":"Dashboard"},"documentId":{"__rl":true,"mode":"list","value":"1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE/edit?usp=drivesdk","cachedResultName":"Email Outreach"}},"typeVersion":4.7},{"id":"ba82b9ea-41d5-40f5-b3d5-8014851969ca","name":"Fetch Subscribed Leads","type":"n8n-nodes-base.googleSheets","position":[1184,208],"parameters":{"options":{},"filtersUI":{"values":[{"lookupValue":"yes","lookupColumn":"Subscribe"}]},"sheetName":{"__rl":true,"mode":"list","value":472191422,"cachedResultUrl":"https://docs.google.com/spreadsheets/d/1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE/edit#gid=472191422","cachedResultName":"Leads"},"documentId":{"__rl":true,"mode":"list","value":"1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE/edit?usp=drivesdk","cachedResultName":"Email Outreach"}},"typeVersion":4.7},{"id":"10f4594e-0aae-42cd-9e6c-64f1873814f3","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[432,-272],"parameters":{"color":5,"width":1152,"height":288,"content":"## 1. Launch Campaign from Telegram\n\nListens for the `/outreach` command from an authorized Telegram user.\nOpens a form to collect email sender, subject, content, and send cap.\nCreates a new campaign row on the Dashboard sheet."},"typeVersion":1},{"id":"37e2406c-fb71-4e79-98a7-72f72f8dd7dd","name":"If Not Already Logged","type":"n8n-nodes-base.if","position":[1504,592],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"loose"},"combinator":"and","conditions":[{"id":"dfc754bc-8525-423c-a7c0-70cc1e53373a","operator":{"type":"string","operation":"equals"},"leftValue":"={{ $json.exists }}","rightValue":"=yes"}]},"looseTypeValidation":true},"typeVersion":2.2},{"id":"198d1795-4d8e-425d-b237-3c2d9b075449","name":"Lookup Open Logs","type":"n8n-nodes-base.googleSheets","position":[1088,592],"parameters":{"options":{},"filtersUI":{"values":[{"lookupValue":"={{ $('Extract Tracking Params').item.json.id }}","lookupColumn":"id"}]},"sheetName":{"__rl":true,"mode":"list","value":1329490640,"cachedResultUrl":"https://docs.google.com/spreadsheets/d/1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE/edit#gid=1329490640","cachedResultName":"logs"},"documentId":{"__rl":true,"mode":"list","value":"1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE/edit?usp=drivesdk","cachedResultName":"Email Outreach"}},"typeVersion":4.7},{"id":"d52309a7-3447-4ace-a129-85f89b17edcc","name":"Log Open Event","type":"n8n-nodes-base.googleSheets","position":[1936,608],"parameters":{"columns":{"value":{"id":"={{ $('Extract Tracking Params').item.json.id }}","date":"={{ $now.format('yyyy-MM-dd') }}","seen":"yes","email":"={{ $('Extract Tracking Params').item.json.email }}"},"schema":[{"id":"id","type":"string","display":true,"removed":false,"required":false,"displayName":"id","defaultMatch":true,"canBeUsedToMatch":true},{"id":"email","type":"string","display":true,"required":false,"displayName":"email","defaultMatch":false,"canBeUsedToMatch":true},{"id":"date","type":"string","display":true,"required":false,"displayName":"date","defaultMatch":false,"canBeUsedToMatch":true},{"id":"seen","type":"string","display":true,"required":false,"displayName":"seen","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["id"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"append","sheetName":{"__rl":true,"mode":"list","value":1329490640,"cachedResultUrl":"https://docs.google.com/spreadsheets/d/1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE/edit#gid=1329490640","cachedResultName":"logs"},"documentId":{"__rl":true,"mode":"list","value":"1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1KJ-DYLqI_6sd_fadHAgLmh7iu7Ttn7NYWChk7k-GlxE/edit?usp=drivesdk","cachedResultName":"Email Outreach"}},"typeVersion":4.7},{"id":"6c8f80c7-c6d2-43e3-93a8-1fa9769dd3dd","name":"Check If Already Opened","type":"n8n-nodes-base.code","position":[1296,592],"parameters":{"jsCode":"// Input 1 = rows from \"logs\"\n// We also need the id & email from Edit Fields1\n\n// Read data from previous nodes\nconst logs = $input.all(); // all rows returned by logs sheet\nconst id = $('Extract Tracking Params').item.json.id;\nconst email = $('Extract Tracking Params').item.json.email;\n\n// Check if matching entry exists\nlet exists = \"no\";\n\nfor (const item of logs) {\n const row = item.json;\n\n if (row.id == id && row.email == email) {\n exists = \"yes\";\n break;\n }\n}\n\n// Return single result\nreturn [\n {\n json: {\n exists,\n id,\n email\n }\n }\n];\n"},"typeVersion":2},{"id":"2ae08e32-517d-42d2-b9df-8d4f467baca1","name":"Sticky Note - Intro","type":"n8n-nodes-base.stickyNote","position":[16,-272],"parameters":{"width":380,"height":960,"content":"## Automated Email Outreach via Telegram and Google Sheets\n\n### **What it does:**\nLets you launch personalized email campaigns from Telegram, track opens, manage unsubscribes, and monitor send stats — all via Google Sheets as the dashboard.\n\n### **Why it matters:**\nRun email outreach without expensive tools. Control everything from Telegram, track engagement in real-time, and respect unsubscribes automatically.\n\n### **How it works:**\n1. Send `/outreach` in Telegram to create a campaign\n2. Fill in sender email, subject, content, and cap\n3. Workflow fetches subscribed leads from the Leads sheet\n4. Sends HTML emails one-by-one with random delays\n5. Tracks opens via a tracking pixel webhook\n6. Handles unsubscribe requests via webhook\n\n### **Setup steps:**\n1. Connect **Telegram Bot** credentials\n2. Connect **Gmail OAuth2** credentials\n3. Connect **Google Sheets OAuth2** credentials\n4. Create a Google Sheet with `Dashboard`, `Leads`, and `logs` tabs\n5. Update the Sheet ID and webhook URLs in the nodes\n6. Set your Telegram `chatId` in the If Outreach Command node\n7. Test with a small cap (e.g., 2) before full send"},"typeVersion":1},{"id":"9beda2ca-69c7-40b3-bbdd-9662c3c9f72c","name":"Sticky Note - Send Emails","type":"n8n-nodes-base.stickyNote","position":[432,48],"parameters":{"color":4,"width":2980,"height":352,"content":"## 2. Send Email Campaign\n\nWhen a new campaign row appears on the Dashboard, filters for `draft` status,\nroutes by sender email, fetches subscribed leads, caps the batch, then loops\nthrough each lead — building the HTML template, sending via Gmail, updating\nstats, and waiting a random 1-5 minute delay between sends to avoid rate limits."},"typeVersion":1},{"id":"44c39af3-e715-4b51-a4c2-ad2bc8da110b","name":"Contact & Attribution","type":"n8n-nodes-base.stickyNote","position":[3424,-240],"parameters":{"width":700,"height":1268,"content":"## Was this helpful? Get in touch!\n\nI really hope this automation helped you. Your feedback is incredibly valuable and helps me create better resources for business and the n8n community.\n\n### **Have Feedback, a Question, or a Project Idea?**\n\nI've streamlined the way we connect. It all starts with one simple form that takes less than 10 seconds. After that, you'll chat with my AI assistant who will gather the key details and pass them directly on to me.\n\n#### **[Start the conversation here](https://tally.so/r/EkKGgB)**\n\n* **Give Feedback:** Share your thoughts on this template—whether you found a typo, encountered an unexpected error, have a suggestion, or just want to say thanks!\n\n* **n8n Consulting:** Have a complex business challenge or need a custom workflow built from scratch? Let's partner on a powerful automation solution tailored to your specific needs.\n\n* **Join your team:** We can work together to get you launched with confidence.\n\n---\n\nHappy Automating!\n[Milo Bravo](https://linkedin.com/in/MiloBravo/) | BRaiA Labs | Automation & BI Systems + AI Integration\n"},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"6b94b7e4-5e19-417f-a624-8b17f2721e6e","connections":{"Cap Lead Count":{"main":[[{"node":"Map Lead Fields","type":"main","index":0}]]},"Loop Over Leads":{"main":[[{"node":"Mark Campaign Done","type":"main","index":0}],[{"node":"Build HTML Template","type":"main","index":0}]]},"Map Lead Fields":{"main":[[{"node":"Loop Over Leads","type":"main","index":0}]]},"Lookup Open Logs":{"main":[[{"node":"Check If Already Opened","type":"main","index":0}]]},"Track Email Open":{"main":[[{"node":"Extract Tracking Params","type":"main","index":0}]]},"Update Send Stats":{"main":[[{"node":"Generate Random Delay","type":"main","index":0}]]},"Wait Random Delay":{"main":[[{"node":"Loop Over Leads","type":"main","index":0}]]},"Handle Unsubscribe":{"main":[[{"node":"Extract Unsubscribe ID","type":"main","index":0}]]},"If Status Is Draft":{"main":[[{"node":"Route by Sender Email","type":"main","index":0}]]},"Lookup Lead Record":{"main":[[{"node":"Mark as Unsubscribed","type":"main","index":0}]]},"Build HTML Template":{"main":[[{"node":"Send Email via Gmail","type":"main","index":0}]]},"Fetch Current Stats":{"main":[[{"node":"Update Send Stats","type":"main","index":0}]]},"If Outreach Command":{"main":[[{"node":"Prompt Campaign via Telegram","type":"main","index":0}]]},"Lookup Campaign Row":{"main":[[{"node":"Lookup Open Logs","type":"main","index":0}]]},"Map Campaign Fields":{"main":[[{"node":"Create Campaign Row","type":"main","index":0}]]},"Increment Open Count":{"main":[[{"node":"Log Open Event","type":"main","index":0}]]},"Send Email via Gmail":{"main":[[{"node":"Fetch Current Stats","type":"main","index":0}]]},"Generate Random Delay":{"main":[[{"node":"Wait Random Delay","type":"main","index":0}]]},"If Not Already Logged":{"main":[[],[{"node":"Increment Open Count","type":"main","index":0}]]},"Route by Sender Email":{"main":[[{"node":"Fetch Subscribed Leads","type":"main","index":0}]]},"Extract Unsubscribe ID":{"main":[[{"node":"Lookup Lead Record","type":"main","index":0}]]},"Fetch Subscribed Leads":{"main":[[{"node":"Cap Lead Count","type":"main","index":0}]]},"Check If Already Opened":{"main":[[{"node":"If Not Already Logged","type":"main","index":0}]]},"Extract Tracking Params":{"main":[[{"node":"Lookup Campaign Row","type":"main","index":0}]]},"Watch for New Campaigns":{"main":[[{"node":"If Status Is Draft","type":"main","index":0}]]},"Listen for Telegram Commands":{"main":[[{"node":"If Outreach Command","type":"main","index":0}]]},"Prompt Campaign via Telegram":{"main":[[{"node":"Map Campaign Fields","type":"main","index":0}]]}}} \ No newline at end of file