{
  "name": "Weekly AI Briefing",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks",
              "triggerAtHour": 18
            }
          ]
        }
      },
      "id": "8f9be618-00b6-4432-a60c-1b67f4c1ef81",
      "name": "Weekly Sunday Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.3,
      "position": [
        352,
        304
      ]
    },
    {
      "parameters": {
        "operation": "getAll",
        "calendar": {
          "__rl": true,
          "value": "david@goluda.ai",
          "mode": "list",
          "cachedResultName": "david@goluda.ai"
        },
        "returnAll": true,
        "options": {
          "orderBy": "startTime"
        }
      },
      "id": "0a5619db-72a5-47ce-8d5f-5c5369901b5a",
      "name": "Get This Week's Events",
      "type": "n8n-nodes-base.googleCalendar",
      "typeVersion": 1.3,
      "position": [
        608,
        208
      ],
      "credentials": {
        "googleCalendarOAuth2Api": {
          "id": "jHwA9AuYHundnCIX",
          "name": "DAVID@GOLUDA CALENDAR"
        }
      }
    },
    {
      "parameters": {},
      "id": "49dcd3de-b046-4c4c-9f64-5a8d06390fd3",
      "name": "Combine Calendar and Email",
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3.2,
      "position": [
        848,
        304
      ]
    },
    {
      "parameters": {
        "operation": "getAll",
        "returnAll": true,
        "filters": {
          "readStatus": "unread",
          "receivedAfter": "={{ $now.minus({ days: 7 }).toISO() }}"
        }
      },
      "id": "00400faa-6d67-465b-a8ff-77780e3da6ef",
      "name": "Get Unread Emails This Week",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.2,
      "position": [
        608,
        400
      ],
      "webhookId": "e6d25602-cf96-45bc-b219-775027423d4f",
      "credentials": {
        "gmailOAuth2": {
          "id": "M8IScAVBEX1i7C3D",
          "name": "GMAIL (SEND)"
        }
      }
    },
    {
      "parameters": {
        "mode": "raw",
        "jsonOutput": "={{ { \"weekSummaryText\": \"CALENDAR (past 7 days):\\n\" + $('Get This Week\\'s Events').all().map(i => \"- \" + (i.json.summary || \"Untitled event\") + \" (\" + (i.json.start && i.json.start.dateTime ? i.json.start.dateTime : \"no time\") + \")\").join(\"\\n\") + \"\\n\\nUNREAD EMAILS (past 7 days):\\n\" + $('Get Unread Emails This Week').all().map(i => \"- \" + (i.json.subject || \"No subject\") + \" from \" + (i.json.from && i.json.from.text ? i.json.from.text : \"unknown sender\")).join(\"\\n\") } }}",
        "options": {}
      },
      "id": "4d88e181-9308-4137-a215-201c6bd6f404",
      "name": "Format Week's Data as Text",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1040,
        304
      ],
      "executeOnce": true
    },
    {
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "claude-sonnet-4-5",
          "cachedResultName": "Claude Sonnet 4.5"
        },
        "messages": {
          "values": [
            {
              "content": "={{ $json.weekSummaryText }}"
            }
          ]
        },
        "options": {
          "system": "You write short, plain weekly briefings for one person based on their calendar and unread email. Be direct and specific, mention actual event names and email subjects where useful, keep it under 150 words, no filler, no motivational language, just what happened and what stands out. If a section is empty, say so in one line instead of skipping it silently.",
          "maxTokens": 400
        }
      },
      "id": "2c7c275d-a8d0-4b0b-a66f-e61a9eb72b88",
      "name": "Summarize the Week",
      "type": "@n8n/n8n-nodes-langchain.anthropic",
      "typeVersion": 1,
      "position": [
        1232,
        304
      ],
      "credentials": {
        "anthropicApi": {
          "id": "Mvk5Drutn4iBMGbt",
          "name": "Anthropic account 3"
        }
      }
    },
    {
      "parameters": {
        "chatId": "7235773771",
        "text": "={{ $json.content[0].text }}",
        "additionalFields": {
          "parse_mode": "Markdown"
        }
      },
      "id": "805faba5-6895-4cd0-aeb9-bf7cd888a836",
      "name": "Send Briefing to Telegram",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        1552,
        304
      ],
      "webhookId": "d6625725-660b-4bcc-8860-99704179fe43",
      "credentials": {
        "telegramApi": {
          "id": "c0QdedybTCg6luzy",
          "name": "DAVID TELEGRAM"
        }
      }
    }
  ],
  "pinData": {},
  "connections": {
    "Weekly Sunday Trigger": {
      "main": [
        [
          {
            "node": "Get This Week's Events",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get Unread Emails This Week",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get This Week's Events": {
      "main": [
        [
          {
            "node": "Combine Calendar and Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Combine Calendar and Email": {
      "main": [
        [
          {
            "node": "Format Week's Data as Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Unread Emails This Week": {
      "main": [
        [
          {
            "node": "Combine Calendar and Email",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Format Week's Data as Text": {
      "main": [
        [
          {
            "node": "Summarize the Week",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Summarize the Week": {
      "main": [
        [
          {
            "node": "Send Briefing to Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate",
    "availableInMCP": true
  },
  "versionId": "31234afa-4ba9-4d0f-b695-988b221e5a93",
  "meta": {
    "aiBuilderAssisted": true,
    "builderVariant": "mcp",
    "instanceId": "2272a3ccffef1239d1ef7e144f5b5077ff2aa44fec3b4aa552067a10be0f5eec"
  },
  "nodeGroups": [],
  "id": "YkZTuvKeZQ14GlLR",
  "tags": []
}