{ "nodes": [ { "id": "4dd52c72-9a9b-4db4-8de5-5b12b1e5c4be", "name": "Schedule Trigger", "type": "n8n-nodes-base.scheduleTrigger", "position": [ 180, 1480 ], "parameters": { "rule": { "interval": [ { "triggerAtHour": 9 } ] } }, "typeVersion": 1.2 }, { "id": "9226181c-b84c-4ea1-a5b4-eedb6c62037b", "name": "Search daily", "type": "n8n-nodes-base.airtable", "position": [ 440, 1480 ], "parameters": { "base": { "__rl": true, "mode": "list", "value": "appL3dptT6ZTSzY9v", "cachedResultUrl": "https://airtable.com/appL3dptT6ZTSzY9v", "cachedResultName": "Scheduled Emails" }, "table": { "__rl": true, "mode": "list", "value": "tblzR9vSuFUzlQNMI", "cachedResultUrl": "https://airtable.com/appL3dptT6ZTSzY9v/tblzR9vSuFUzlQNMI", "cachedResultName": "Table 1" }, "options": {}, "operation": "search", "filterByFormula": "AND({Status} = 'active', {Interval} = 'daily')" }, "credentials": { "airtableTokenApi": { "id": "Und0frCQ6SNVX3VV", "name": "Airtable Personal Access Token account" } }, "typeVersion": 2.1 }, { "id": "1a3b6224-2f66-41c6-8b3d-be286cf16370", "name": "Search weekly", "type": "n8n-nodes-base.airtable", "position": [ 440, 1660 ], "parameters": { "base": { "__rl": true, "mode": "list", "value": "appL3dptT6ZTSzY9v", "cachedResultUrl": "https://airtable.com/appL3dptT6ZTSzY9v", "cachedResultName": "Scheduled Emails" }, "table": { "__rl": true, "mode": "list", "value": "tblzR9vSuFUzlQNMI", "cachedResultUrl": "https://airtable.com/appL3dptT6ZTSzY9v/tblzR9vSuFUzlQNMI", "cachedResultName": "Table 1" }, "options": {}, "operation": "search", "filterByFormula": "=AND(\n {Status} = 'active', \n {Interval} = 'weekly', \n {Last Sent} <= DATEADD(TODAY(), -7, 'days')\n)" }, "credentials": { "airtableTokenApi": { "id": "Und0frCQ6SNVX3VV", "name": "Airtable Personal Access Token account" } }, "typeVersion": 2.1 }, { "id": "1ea47e14-0a28-4780-95c7-31e24eb724d5", "name": "confirmation email1", "type": "n8n-nodes-base.gmail", "position": [ 620, 820 ], "webhookId": "dd8bd6df-2013-4f8d-a2cc-cd9b3913e3d2", "parameters": { "sendTo": "={{ $('Subscribe Form').item.json.email }}", "message": "=This is to confirm your request to subscribe to \"Learn something every day!\" - a free service to send you facts about your favourite topics.\n\nTopic: {{ $('Subscribe Form').item.json.topic }}\nSchedule: {{ $('Subscribe Form').item.json.frequency }}", "options": { "appendAttribution": false }, "subject": "Learn something every day confirmation" }, "credentials": { "gmailOAuth2": { "id": "Sf5Gfl9NiFTNXFWb", "name": "Gmail account" } }, "typeVersion": 2.1 }, { "id": "d95262af-1b52-4f9c-8346-183b4eee8544", "name": "Execute Workflow", "type": "n8n-nodes-base.executeWorkflow", "position": [ 1140, 1480 ], "parameters": { "mode": "each", "options": { "waitForSubWorkflow": false }, "workflowId": { "__rl": true, "mode": "id", "value": "={{ $workflow.id }}" } }, "typeVersion": 1.1 }, { "id": "075292af-7a66-4275-ac2d-3c392189a10c", "name": "Create Event", "type": "n8n-nodes-base.set", "position": [ 980, 1480 ], "parameters": { "options": {}, "assignments": { "assignments": [ { "id": "b28a0142-a028-471a-8180-9883e930feea", "name": "email", "type": "string", "value": "={{ $json.Email }}" }, { "id": "970f5495-05df-42b6-a422-b2ac27f8eb95", "name": "topic", "type": "string", "value": "={{ $json.Topic }}" }, { "id": "e871c431-948f-4b80-aa17-1e4266674663", "name": "interval", "type": "string", "value": "={{ $json.Interval }}" }, { "id": "9b72597d-1446-4ef3-86e5-0a071c69155b", "name": "id", "type": "string", "value": "={{ $json.id }}" }, { "id": "b17039c2-14a2-4811-9528-88ae963e44f7", "name": "created_at", "type": "string", "value": "={{ $json.Created }}" } ] } }, "typeVersion": 3.4 }, { "id": "28776aaf-6bd9-4f9f-bcf0-3d4401a74219", "name": "Execute Workflow Trigger", "type": "n8n-nodes-base.executeWorkflowTrigger", "position": [ 1360, 1480 ], "parameters": {}, "typeVersion": 1 }, { "id": "0eb62e75-228b-452b-80ab-f9ef3ad33204", "name": "Unsubscribe Form", "type": "n8n-nodes-base.formTrigger", "position": [ 180, 1160 ], "webhookId": "e64db96d-5e61-40d5-88fb-761621a829ab", "parameters": { "options": { "path": "free-factoids-unsubscribe" }, "formTitle": "Unsubscribe from Learn Something Every Day", "formFields": { "values": [ { "fieldLabel": "ID", "requiredField": true }, { "fieldType": "dropdown", "fieldLabel": "Reason For Unsubscribe", "multiselect": true, "fieldOptions": { "values": [ { "option": "Emails not relevant" }, { "option": "Too many Emails" }, { "option": "I did not sign up to this service" } ] } } ] }, "formDescription": "We're sorry to see you go! Please take a moment to help us improve the service." }, "typeVersion": 2.2 }, { "id": "f889efe9-dc3c-428b-ad8e-4f7d17f23e75", "name": "Set Email Vars", "type": "n8n-nodes-base.set", "position": [ 2500, 1480 ], "parameters": { "options": {}, "assignments": { "assignments": [ { "id": "62a684fb-16f9-4326-8eeb-777d604b305a", "name": "to", "type": "string", "value": "={{ $('Execute Workflow Trigger').first().json.email }},jim@height.io" }, { "id": "4270849e-c805-4580-9088-e8d1c3ef2fb4", "name": "subject", "type": "string", "value": "=Your {{ $('Execute Workflow Trigger').first().json.interval }} factoid" }, { "id": "81d0e897-2496-4a3c-b16c-9319338f899f", "name": "message", "type": "string", "value": "=
\nYou asked about \"{{ $('Execution Data').first().json.topic.replace('\"','') }}\"\n
\n\n{{ $('Content Generation Agent').first().json.output }}\n
" }, { "id": "ee05de7b-5342-4deb-8118-edaf235d92cc", "name": "unsubscribe_link", "type": "string", "value": "=https://\nUnsubscribe\n
\n\n\n", "options": { "attachmentsUi": { "attachmentsBinary": [ {} ] }, "appendAttribution": false }, "subject": "={{ $json.subject }}" }, "credentials": { "gmailOAuth2": { "id": "Sf5Gfl9NiFTNXFWb", "name": "Gmail account" } }, "typeVersion": 2.1 }, { "id": "10b6ad35-fc1c-47a2-b234-5de3557d1164", "name": "Sticky Note4", "type": "n8n-nodes-base.stickyNote", "position": [ 1320, 1660 ], "parameters": { "color": 7, "width": 335, "height": 113, "content": "### 5. Use Execution Data to Filter Logs\nIf you've registered for community+ or are on n8n cloud, best practice is to use execution node to allow filtering of execution logs." }, "typeVersion": 1 }, { "id": "e3563fae-ff35-457b-9fb1-784eda637518", "name": "Sticky Note5", "type": "n8n-nodes-base.stickyNote", "position": [ 1780, 1280 ], "parameters": { "color": 7, "width": 340, "height": 140, "content": "### 6. Use AI to Generate Factoid and Image\nUse an AI agent to automate the generation of factoids as requested by the user. This is a simple example but we recommend a adding a unique touch to stand out from the crowd!" }, "typeVersion": 1 }, { "id": "d1016c5d-c855-44c5-8ad3-a534bedaa8cf", "name": "Sticky Note6", "type": "n8n-nodes-base.stickyNote", "position": [ 2500, 1040 ], "parameters": { "color": 7, "width": 460, "height": 400, "content": "### 7. Send Email to User\nFinally, send a message to the user with both text and image.\nLog the event in the Airtable for later analysis if required.\n\n" }, "typeVersion": 1 }, { "id": "773075fa-e5a2-4d4f-8527-eb07c7038b00", "name": "Sticky Note7", "type": "n8n-nodes-base.stickyNote", "position": [ -420, 680 ], "parameters": { "width": 480, "height": 900, "content": "## Try It Out!\n\n### This n8n templates demonstrates how to build a simple subscriber service entirely in n8n using n8n forms as a frontend, n8n generally as the backend and Airtable as the storage layer.\n\nThis template in particular shows a fully automated service to send automated messages containing facts about a topic the user requested for.\n\n### How it works\n* An n8n form is setup up to allow users to subscribe with a desired topic and interval of which to recieve messages via n8n forms which is then added to the Airtable.\n* A scheduled trigger is executed every morning and searches for subscribers to send messages for based on their desired intervals.\n* Once found, Subscribers are sent to a subworkflow which performs the text content generation via an AI agent and also uses a vision model to generate an image.\n* Both are attached to an email which is sent to the subscriber. This email also includes an unsubscribe link.\n* The unsubscribe flow works similarly via n8n form interface which when submitted disables further scheduled emails to the user.\n\n## How to use\n* Make a copy of sample Airtable here: https://airtable.com/appL3dptT6ZTSzY9v/shrLukHafy5bwDRfD\n* Make sure the workflow is \"activated\" and the forms are available and reachable by your audience.\n\n\n### Need Help?\nJoin the [Discord](https://discord.com/invite/XPKeKXeB7d) or ask in the [Forum](https://community.n8n.io/)!\n\nHappy Hacking!" }, "typeVersion": 1 } ], "pinData": {}, "connections": { "Wikipedia": { "ai_tool": [ [ { "node": "Content Generation Agent", "type": "ai_tool", "index": 0 } ] ] }, "Create Event": { "main": [ [ { "node": "Execute Workflow", "type": "main", "index": 0 } ] ] }, "Resize Image": { "main": [ [ { "node": "Set Email Vars", "type": "main", "index": 0 } ] ] }, "Search daily": { "main": [ [ { "node": "Create Event", "type": "main", "index": 0 } ] ] }, "Send Message": { "main": [ [ { "node": "Log Last Sent", "type": "main", "index": 0 } ] ] }, "Should Send?": { "main": [ [ { "node": "Should Send = True", "type": "main", "index": 0 } ] ] }, "Search weekly": { "main": [ [ { "node": "Create Event", "type": "main", "index": 0 } ] ] }, "Execution Data": { "main": [ [ { "node": "Content Generation Agent", "type": "main", "index": 0 } ] ] }, "Generate Image": { "main": [ [ { "node": "Resize Image", "type": "main", "index": 0 } ] ] }, "Set Email Vars": { "main": [ [ { "node": "Send Message", "type": "main", "index": 0 } ] ] }, "Subscribe Form": { "main": [ [ { "node": "Create Subscriber", "type": "main", "index": 0 } ] ] }, "Groq Chat Model": { "ai_languageModel": [ [ { "node": "Content Generation Agent", "type": "ai_languageModel", "index": 0 } ] ] }, "Search surprise": { "main": [ [ { "node": "Should Send?", "type": "main", "index": 0 } ] ] }, "Schedule Trigger": { "main": [ [ { "node": "Search surprise", "type": "main", "index": 0 }, { "node": "Search daily", "type": "main", "index": 0 }, { "node": "Search weekly", "type": "main", "index": 0 } ] ] }, "Unsubscribe Form": { "main": [ [ { "node": "Update Subscriber", "type": "main", "index": 0 } ] ] }, "Create Subscriber": { "main": [ [ { "node": "confirmation email1", "type": "main", "index": 0 } ] ] }, "Should Send = True": { "main": [ [ { "node": "Create Event", "type": "main", "index": 0 } ] ] }, "Window Buffer Memory": { "ai_memory": [ [ { "node": "Content Generation Agent", "type": "ai_memory", "index": 0 } ] ] }, "Content Generation Agent": { "main": [ [ { "node": "Generate Image", "type": "main", "index": 0 } ] ] }, "Execute Workflow Trigger": { "main": [ [ { "node": "Execution Data", "type": "main", "index": 0 } ] ] } } }