{
  "id": "93ihcyEANLY5cr77",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "AI Daily Personal Briefing Engine",
  "tags": [],
  "nodes": [
    {
      "id": "372040fa-b3fc-42da-808f-39b068f32132",
      "name": "Sticky Note - Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -320,
        160
      ],
      "parameters": {
        "width": 980,
        "height": 1044,
        "content": "## AI Daily Personal Briefing Engine\n\nThis workflow runs every morning to fetch your tasks, calendar events, emails, weather, and news \u2014 then uses AI to generate a clean, personalized daily briefing delivered via WhatsApp or Email.\n\n### Who's it for\n\u2022 Busy professionals who want a structured morning overview\n\u2022 Remote workers managing multiple tools (Todoist, Calendar, Gmail)\n\u2022 Anyone who wants an AI-powered daily digest\n\n### How it works / What it does\n1. Triggers every morning at your chosen time\n2. Fetches tasks from Todoist/Asana\n3. Pulls today's calendar events\n4. Reads unread/recent emails\n5. Gets current weather forecast\n6. Fetches top news headlines\n7. Aggregates all data into one context object\n8. AI generates a concise, human-friendly briefing\n9. Routes to WhatsApp or Email based on your preference\n10. Logs briefing summary to Google Sheets\n\n### How to set up\n1. Import this workflow into n8n\n2. Set up credentials: Todoist/Asana, Google Calendar, Gmail, OpenAI, SendGrid, Twilio (WhatsApp)\n3. Replace placeholder API keys and IDs\n4. Set your preferred delivery method in the Set node\n5. Activate the workflow\n\n### Requirements\n\u2022 Todoist or Asana account\n\u2022 Google Calendar + Gmail\n\u2022 OpenWeatherMap API key\n\u2022 NewsAPI key\n\u2022 OpenAI API key\n\u2022 Twilio (WhatsApp) or SendGrid (Email)\n\u2022 Google Sheets (for logging)\n\n### How to customize\n\u2022 Change cron time in the Schedule Trigger node\n\u2022 Adjust AI tone/length in the AI Briefing node\n\u2022 Add/remove data sources as needed\n\u2022 Toggle delivery method in the Set Delivery Preference node"
      },
      "typeVersion": 1
    },
    {
      "id": "afcd17f4-2fc4-4eec-9bc4-1dfb68e9dc31",
      "name": "Sticky Note - Section 1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        928,
        336
      ],
      "parameters": {
        "color": 4,
        "width": 568,
        "height": 500,
        "content": "## 1. Trigger & Preference Setup"
      },
      "typeVersion": 1
    },
    {
      "id": "984b7f51-1ca3-477d-9dad-f820409aed35",
      "name": "Sticky Note - Section 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1568,
        -32
      ],
      "parameters": {
        "color": 3,
        "width": 388,
        "height": 1292,
        "content": "## 2. Data Fetching (Parallel Sources)"
      },
      "typeVersion": 1
    },
    {
      "id": "dfbe67d8-c1ac-4dae-b2ec-774706f78b13",
      "name": "Sticky Note - Section 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2032,
        288
      ],
      "parameters": {
        "color": 5,
        "width": 836,
        "height": 720,
        "content": "## 3. Aggregation & AI Summarization"
      },
      "typeVersion": 1
    },
    {
      "id": "a5dc61d8-66b8-4ee5-9be4-6b4aebc603c5",
      "name": "Sticky Note - Section 4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2912,
        304
      ],
      "parameters": {
        "color": 6,
        "width": 864,
        "height": 620,
        "content": "## 4. Delivery & Logging"
      },
      "typeVersion": 1
    },
    {
      "id": "bd153445-f9c7-4b64-a774-1899eb9f53b7",
      "name": "Schedule Trigger - 7AM Daily",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        1072,
        624
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 7 * * *"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "19451001-3866-47be-89bd-393beb2a46d6",
      "name": "Set User Preferences",
      "type": "n8n-nodes-base.set",
      "position": [
        1344,
        624
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "name": "deliveryMethod",
              "type": "string",
              "value": "whatsapp"
            },
            {
              "name": "userPhone",
              "type": "string",
              "value": "+1234567890"
            },
            {
              "name": "userEmail",
              "type": "string",
              "value": "you@example.com"
            },
            {
              "name": "userName",
              "type": "string",
              "value": "Alex"
            },
            {
              "name": "city",
              "type": "string",
              "value": "New York"
            },
            {
              "name": "weatherApiKey",
              "type": "string",
              "value": "YOUR_OPENWEATHERMAP_API_KEY"
            },
            {
              "name": "newsApiKey",
              "type": "string",
              "value": "YOUR_NEWSAPI_KEY"
            },
            {
              "name": "newsTopics",
              "type": "string",
              "value": "technology,business"
            },
            {
              "name": "todayDate",
              "type": "string",
              "value": "={{ new Date().toISOString().split('T')[0] }}"
            },
            {
              "name": "tomorrowDate",
              "type": "string",
              "value": "={{ new Date(Date.now() + 86400000).toISOString().split('T')[0] }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "a238715b-98ba-4421-be51-6fa75af5f0cd",
      "name": "Fetch Todoist Tasks",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1728,
        240
      ],
      "parameters": {
        "url": "=https://api.todoist.com/rest/v2/tasks?filter=today",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "4afc1fb2-9616-45ce-9619-2fe009c18e77",
      "name": "Fetch Calendar Events",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1728,
        432
      ],
      "parameters": {
        "url": "=https://www.googleapis.com/calendar/v3/calendars/primary/events?timeMin={{ $json.todayDate }}T00:00:00Z&timeMax={{ $json.tomorrowDate }}T00:00:00Z&singleEvents=true&orderBy=startTime",
        "options": {},
        "authentication": "oAuth2"
      },
      "typeVersion": 4.2
    },
    {
      "id": "e02e363b-6825-43a8-810b-b8d86581e603",
      "name": "Fetch Unread Emails",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1728,
        624
      ],
      "parameters": {
        "url": "=https://gmail.googleapis.com/gmail/v1/users/me/messages?q=is:unread newer_than:1d&maxResults=10",
        "options": {},
        "authentication": "oAuth2"
      },
      "typeVersion": 4.2
    },
    {
      "id": "dd4afbc8-6ffd-4ff1-9515-26a1394c19d4",
      "name": "Fetch Weather Forecast",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1728,
        816
      ],
      "parameters": {
        "url": "=https://api.openweathermap.org/data/2.5/forecast?q={{ $('Set User Preferences').item.json.city }}&units=metric&cnt=8&appid={{ $('Set User Preferences').item.json.weatherApiKey }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "bcc7f55a-52cc-47e4-be31-225ee87e4713",
      "name": "Fetch Top News",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1728,
        1008
      ],
      "parameters": {
        "url": "=https://newsapi.org/v2/top-headlines?category={{ $('Set User Preferences').item.json.newsTopics.split(',')[0] }}&pageSize=5&apiKey={{ $('Set User Preferences').item.json.newsApiKey }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "9d4a1c6a-92f0-48bd-8eae-b70addec8cb2",
      "name": "JS - Aggregate All Data",
      "type": "n8n-nodes-base.code",
      "position": [
        2048,
        624
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "// Parse Todoist tasks\nconst tasks = $('Fetch Todoist Tasks').all();\nconst taskList = tasks.map(t => {\n  const j = t.json;\n  return `- ${j.content}${j.due ? ' (Due: ' + j.due.date + ')' : ''}${j.priority > 1 ? ' [P' + j.priority + ']' : ''}`;\n}).join('\\n') || 'No tasks due today.';\n\n// Parse Calendar Events\nconst calData = $('Fetch Calendar Events').first().json;\nconst events = (calData.items || []).map(e => {\n  const start = e.start?.dateTime || e.start?.date || 'All day';\n  const time = start.includes('T') ? new Date(start).toLocaleTimeString('en-US', {hour: '2-digit', minute:'2-digit'}) : 'All day';\n  return `- ${time}: ${e.summary || 'Untitled event'}`;\n}).join('\\n') || 'No events scheduled today.';\n\n// Parse Emails\nconst emailData = $('Fetch Unread Emails').first().json;\nconst emailCount = (emailData.messages || []).length;\nconst emailSummary = emailCount > 0 ? `${emailCount} unread email(s) waiting for your attention.` : 'Inbox is clear \u2014 no unread emails.';\n\n// Parse Weather\nconst weather = $('Fetch Weather Forecast').first().json;\nconst current = weather.list?.[0];\nconst weatherSummary = current\n  ? `${Math.round(current.main.temp)}\u00b0C, ${current.weather[0].description}. Feels like ${Math.round(current.main.feels_like)}\u00b0C. Humidity: ${current.main.humidity}%.`\n  : 'Weather data unavailable.';\nconst city = weather.city?.name || 'your city';\n\n// Parse News\nconst newsData = $('Fetch Top News').first().json;\nconst headlines = (newsData.articles || []).slice(0, 5).map((a, i) => `${i+1}. ${a.title} (${a.source?.name || 'Unknown'})`).join('\\n') || 'No news headlines available.';\n\n// Get preferences\nconst prefs = $('Set User Preferences').first().json;\n\nreturn {\n  json: {\n    userName: prefs.userName,\n    todayDate: prefs.todayDate,\n    deliveryMethod: prefs.deliveryMethod,\n    userPhone: prefs.userPhone,\n    userEmail: prefs.userEmail,\n    taskList,\n    calendarEvents: events,\n    emailSummary,\n    weatherSummary,\n    city,\n    headlines,\n    taskCount: tasks.length,\n    eventCount: (calData.items || []).length\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "ec92b416-5859-4ca7-8df4-883bc5de9d5a",
      "name": "AI - Generate Daily Briefing",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2240,
        624
      ],
      "parameters": {
        "text": "=You are a warm, smart personal assistant. Generate a concise, energizing daily morning briefing for {{ $json.userName }}.\n\nToday's Date: {{ $json.todayDate }}\n\n--- DATA ---\n\n\ud83c\udf24\ufe0f WEATHER in {{ $json.city }}:\n{{ $json.weatherSummary }}\n\n\ud83d\udcc5 CALENDAR TODAY ({{ $json.eventCount }} event(s)):\n{{ $json.calendarEvents }}\n\n\u2705 TASKS DUE TODAY ({{ $json.taskCount }} task(s)):\n{{ $json.taskList }}\n\n\ud83d\udce7 EMAILS:\n{{ $json.emailSummary }}\n\n\ud83d\udcf0 TOP NEWS HEADLINES:\n{{ $json.headlines }}\n\n--- INSTRUCTIONS ---\nWrite a friendly, motivating morning briefing that:\n1. Opens with a warm greeting using their name and today's date\n2. Gives a quick weather snapshot\n3. Highlights key calendar events\n4. Summarizes priority tasks with encouragement\n5. Notes email status briefly\n6. Shares 2\u20133 interesting news highlights\n7. Closes with a motivating send-off line\n\nKeep it under 350 words. Use short paragraphs and emoji headers for readability. Tone: warm, sharp, and human.",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 1.6
    },
    {
      "id": "1ce0f123-5845-41d8-8295-6b1b2c16d548",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        2256,
        848
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {
          "temperature": 0.7
        },
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "78b689a4-3e59-4dd1-a40a-4d4b0ca0ecde",
      "name": "JS - Format Briefing Output",
      "type": "n8n-nodes-base.code",
      "position": [
        2528,
        624
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "const item = $input.item.json;\nconst agentOutput = item.output || item.text || item.response || 'Good morning! Your briefing is ready.';\nreturn {\n  json: {\n    ...item,\n    briefingText: agentOutput,\n    briefingDate: new Date().toISOString().split('T')[0],\n    briefingTimestamp: new Date().toISOString(),\n    deliveryMethod: $('JS - Aggregate All Data').first().json.deliveryMethod,\n    userPhone: $('JS - Aggregate All Data').first().json.userPhone,\n    userEmail: $('JS - Aggregate All Data').first().json.userEmail,\n    userName: $('JS - Aggregate All Data').first().json.userName\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "7c90d517-4342-4143-a9f6-f451a8127538",
      "name": "Route - WhatsApp or Email?",
      "type": "n8n-nodes-base.if",
      "position": [
        2976,
        624
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "conditions": [
            {
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.deliveryMethod }}",
              "rightValue": "whatsapp"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "93b28666-d50f-4224-8a21-adc74e2d129a",
      "name": "Send via WhatsApp (Twilio)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3200,
        528
      ],
      "parameters": {
        "url": "https://api.twilio.com/2010-04-01/Accounts/YOUR_TWILIO_ACCOUNT_SID/Messages.json",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "specifyBody": "formUrlEncoded",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBasicAuth"
      },
      "credentials": {
        "httpBasicAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "017432b1-19f3-46f2-96a5-2268279e6655",
      "name": "Send via Email (SendGrid)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3200,
        720
      ],
      "parameters": {
        "url": "https://api.sendgrid.com/v3/mail/send",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"personalizations\": [{\n    \"to\": [{\"email\": \"{{ $json.userEmail }}\", \"name\": \"{{ $json.userName }}\"}]\n  }],\n  \"from\": {\"email\": \"briefing@yourdomain.com\", \"name\": \"Your AI Briefing\"},\n  \"subject\": \"\ud83c\udf05 Your Daily Briefing \u2014 {{ $json.briefingDate }}\",\n  \"content\": [{\n    \"type\": \"text/plain\",\n    \"value\": \"{{ $json.briefingText }}\"\n  }]\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer YOUR_TOKEN_HERE"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "981f1a9d-d2be-42fa-8ed6-a613a1bc6bf2",
      "name": "Log to Google Sheets",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3632,
        624
      ],
      "parameters": {
        "url": "https://sheets.googleapis.com/v4/spreadsheets/YOUR_GOOGLE_SHEET_ID/values/Briefings!A1:append?valueInputOption=USER_ENTERED",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"values\": [[\n    \"{{ $('JS - Format Briefing Output').item.json.briefingDate }}\",\n    \"{{ $('JS - Format Briefing Output').item.json.briefingTimestamp }}\",\n    \"{{ $('JS - Format Briefing Output').item.json.userName }}\",\n    \"{{ $('JS - Format Briefing Output').item.json.deliveryMethod }}\",\n    \"{{ $('JS - Aggregate All Data').first().json.taskCount }} tasks, {{ $('JS - Aggregate All Data').first().json.eventCount }} events\",\n    \"Delivered\"\n  ]]\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "oAuth2"
      },
      "typeVersion": 4.2
    },
    {
      "id": "38e2bd1e-e056-4d36-8b8d-e69aad4ba7d0",
      "name": "Wait For Data",
      "type": "n8n-nodes-base.wait",
      "position": [
        2688,
        624
      ],
      "parameters": {
        "amount": 15
      },
      "typeVersion": 1.1
    },
    {
      "id": "48cd895a-0bed-4af8-9afb-06cbc94b29f7",
      "name": "Wait For Sometime",
      "type": "n8n-nodes-base.wait",
      "position": [
        3408,
        528
      ],
      "parameters": {
        "amount": 10
      },
      "typeVersion": 1.1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "f888238f-0644-4bc7-9c5f-d34a3b80359a",
  "connections": {
    "Wait For Data": {
      "main": [
        [
          {
            "node": "Route - WhatsApp or Email?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Top News": {
      "main": [
        [
          {
            "node": "JS - Aggregate All Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI - Generate Daily Briefing",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Wait For Sometime": {
      "main": [
        [
          {
            "node": "Log to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Todoist Tasks": {
      "main": [
        [
          {
            "node": "JS - Aggregate All Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Unread Emails": {
      "main": [
        [
          {
            "node": "JS - Aggregate All Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set User Preferences": {
      "main": [
        [
          {
            "node": "Fetch Todoist Tasks",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch Calendar Events",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch Unread Emails",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch Weather Forecast",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch Top News",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Calendar Events": {
      "main": [
        [
          {
            "node": "JS - Aggregate All Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Weather Forecast": {
      "main": [
        [
          {
            "node": "JS - Aggregate All Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "JS - Aggregate All Data": {
      "main": [
        [
          {
            "node": "AI - Generate Daily Briefing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send via Email (SendGrid)": {
      "main": [
        [
          {
            "node": "Log to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route - WhatsApp or Email?": {
      "main": [
        [
          {
            "node": "Send via WhatsApp (Twilio)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send via Email (SendGrid)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send via WhatsApp (Twilio)": {
      "main": [
        [
          {
            "node": "Wait For Sometime",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "JS - Format Briefing Output": {
      "main": [
        [
          {
            "node": "Wait For Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI - Generate Daily Briefing": {
      "main": [
        [
          {
            "node": "JS - Format Briefing Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger - 7AM Daily": {
      "main": [
        [
          {
            "node": "Set User Preferences",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}