{ "meta": { "instanceId": "=", "templateCredsSetupCompleted": true }, "nodes": [ { "id": "10d2d97d-428e-4224-beae-e4ce4e090e4f", "name": "If", "type": "n8n-nodes-base.if", "position": [ 3220, 2500 ], "parameters": { "options": {}, "conditions": { "options": { "version": 2, "leftValue": "", "caseSensitive": true, "typeValidation": "strict" }, "combinator": "and", "conditions": [ { "id": "7f8ac804-088d-4dfa-a661-8b6b09a6e340", "operator": { "name": "filter.operator.equals", "type": "string", "operation": "equals" }, "leftValue": "={{ $json.date }}", "rightValue": "={{ $now.minus(5,\"day\").day }} {{ $now.minus(5,\"day\").monthLong }} {{ $now.minus(5,\"day\").year }}" }, { "id": "094bd21e-1d23-4f06-a286-501045a53c9b", "operator": { "name": "filter.operator.equals", "type": "string", "operation": "equals" }, "leftValue": "={{ $json.type }}", "rightValue": "News article" } ] } }, "typeVersion": 2.2 }, { "id": "968fac7c-48be-4fe1-a1d0-3c1fd828b0bc", "name": "OpenAI Chat Model3", "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi", "position": [ 3640, 2480 ], "parameters": { "model": { "__rl": true, "mode": "list", "value": "gpt-4o-mini" }, "options": {} }, "typeVersion": 1.2 }, { "id": "fde7d8e1-4124-4506-abb7-8e400ad2729b", "name": "Agent Classification", "type": "@n8n/n8n-nodes-langchain.agent", "position": [ 3660, 2300 ], "parameters": { "text": "=Title: {{$json.title}}\nDescription: {{$json.description}}\n\nIs this article about sustainability? Return only: true or false\n", "options": { "systemMessage": "=You are a classification assistant. \n\nYour role is to analyze the title and description of an article and determine if it is related to sustainability. \n\nYou must only return {\"answer\": true} if the article is clearly related to sustainability (e.g., environmental protection, renewable energy, sustainable development, climate action, green economy, etc.). \n\nIf it is not clearly related, return {\"answer\": false}.\n\nIf the description is empty or missing, rely only on the title. Your response must be only one of the two JSON options: {\"answer\": true} or {\"answer\": false}. Do not provide explanations.\n" }, "promptType": "define", "hasOutputParser": true }, "typeVersion": 1.8 }, { "id": "670c0877-008f-4943-9a6b-c5e543ae6482", "name": "Get Sustainability News", "type": "n8n-nodes-base.googleSheets", "position": [ 2380, 2880 ], "parameters": { "options": {}, "filtersUI": { "values": [ { "lookupValue": "true", "lookupColumn": "sustainability" } ] }, "sheetName": { "__rl": true, "mode": "list", "value": "gid=0", "cachedResultUrl": "=", "cachedResultName": "=" }, "documentId": { "__rl": true, "mode": "list", "value": "=", "cachedResultUrl": "=", "cachedResultName": "=" } }, "notesInFlow": true, "typeVersion": 4.5 }, { "id": "ba6605af-5b5f-44d1-b47d-4246c2b999f3", "name": "Send to your mailing list", "type": "n8n-nodes-base.gmail", "position": [ 2740, 2880 ], "webhookId": "=", "parameters": { "sendTo": "email@gmail.com", "message": "={{ $json.email_body }}", "options": { "appendAttribution": false }, "subject": "Your Sustainability News Digest from LogiGreen" }, "notesInFlow": true, "typeVersion": 2.1 }, { "id": "5d662a41-969a-49d8-a594-f0f962d51350", "name": "Generate Email HTML", "type": "n8n-nodes-base.code", "position": [ 2560, 2880 ], "parameters": { "jsCode": "const summary = `Welcome to the EU Sustainability News Digest provided by LogiGreen Consulting.`;\n\nconst articles = items.map(item => item.json); // each item is an article\n\nlet html = `\n
${summary}
\n${article.type} | ${article.date}
\n${article.description || ''}
\n ${article.read_time ? `${article.read_time}
` : ''}\nYou received this email as part of the EU Sustainability News Digest project.
\n \n