{ "id": "Glb4VNoQI44GT0p9", "meta": { "instanceId": "a1f3364de0f3da48758a2641efb07c3b0d216a3a7cc93596fbed2316d6dea4ad", "templateCredsSetupCompleted": true }, "name": "My workflow 4", "tags": [], "nodes": [ { "id": "909a08a4-4cec-4987-9379-d4cdc2d92a53", "name": "RSS Feed: Times of India", "type": "n8n-nodes-base.rssFeedRead", "position": [ 680, 240 ], "parameters": { "url": "https://timesofindia.indiatimes.com/rssfeeds/-2128936835.cms", "options": {} }, "typeVersion": 1.1 }, { "id": "471cc8ab-0074-4e25-b952-1899574398a9", "name": "Gmail: Fetch Emails", "type": "n8n-nodes-base.gmail", "position": [ 700, 440 ], "webhookId": "85735980-07e5-418b-b029-44bb9825ac9b", "parameters": { "filters": {}, "operation": "getAll" }, "credentials": { "gmailOAuth2": { "id": "WbGCG42FAaeECe0u", "name": "Gmail account" } }, "typeVersion": 2.1 }, { "id": "07a33739-0181-4ead-87bd-c1f0c3fc4999", "name": "TodoList: Fetch Tasks", "type": "n8n-nodes-base.todoist", "position": [ 700, 620 ], "parameters": { "limit": 5, "filters": {}, "operation": "getAll" }, "credentials": { "todoistApi": { "id": "q3NiAT93rPChns6G", "name": "Todoist account" } }, "typeVersion": 2.1 }, { "id": "af295aad-f7e7-4d38-80e5-b79b79637b5f", "name": "Format Digest: Merge & Style Data", "type": "n8n-nodes-base.code", "position": [ 1280, 440 ], "parameters": { "jsCode": "const newsItems = $input.all().map(item => item.json);\nconst emails = $(\"Gmail: Fetch Emails\").all().map(item => item.json);\nconst tasks = $(\"TodoList: Fetch Tasks\").all().map(item => item.json);\n\n// Select top 5 items from each\nconst topNews = newsItems.slice(0, 5).map(item => ({\n title: item.title,\n link: item.link\n}));\n\nconst latestEmails = emails.slice(0, 5).map(item => ({\n subject: item.Subject,\n snippet: item.snippet\n}));\n\nconst topTasks = tasks.slice(0, 5).map(task => ({\n content: task.content,\n url: task.url,\n emoji: task.emoji || '🔴',\n due: task.due\n}));\n\n// Create the final JSON object with email subject and a formatted email body with inline CSS\nconst result = {\n meta: {\n generated_at: new Date().toISOString(),\n time_emoji: \"🌞\"\n },\n email: {\n subject: `🌞 Daily Digest • 📋 ${topTasks.length} Tasks ⚠️ • 📰 ${topNews.length} News Updates`,\n body: `\n
Your automated daily summary
\n${email.snippet}
\nDigest generated at: ${new Date().toLocaleString()}
\n