{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "6e2a3e6b-c472-4694-a736-ec6eecb11de8",
      "name": "Get many events",
      "type": "n8n-nodes-base.microsoftOutlook",
      "position": [
        -380,
        5400
      ],
      "parameters": {
        "fields": [
          "subject",
          "start"
        ],
        "output": "fields",
        "filters": {},
        "resource": "event"
      },
      "credentials": {
        "microsoftOutlookOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "ed8f3389-1915-4918-b552-764384777ca2",
      "name": "OpenAI Chat Model5",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        880,
        5420
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "a523d13f-653d-4a91-a672-b0bd5d558f27",
      "name": "Run Workflow",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -580,
        5400
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "16d77071-01f4-4839-bfc9-7b50009de7e8",
      "name": "Sticky Note14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -600,
        4720
      ],
      "parameters": {
        "color": 5,
        "width": 600,
        "height": 860,
        "content": "## 1\ufe0f\u20e3 Manual Trigger \u2014 *Run Workflow*\n| Why | Lets you click \u201cExecute\u201d in the n8n editor so you can test each change. |\n| --- | --- |\n\n---\n\n## 2\ufe0f\u20e3 Get Outlook Events \u2014 *Get many events*\n1. **Node type:** `Microsoft Outlook \u2192 Event \u2192 Get All`  \n2. **Fields selected:** `subject`, `start`  \n3. **API setup (inside this node):**  \n   - Click **Credentials \u25b8 Microsoft Outlook OAuth2 API**  \n   - If you haven\u2019t connected before:  \n     1. Choose **\u201cMicrosoft Outlook OAuth2 API\u201d \u2192 \u201cCreate New\u201d**.  \n     2. Sign in and grant the **Calendars.Read** permission.  \n     3. Save the credential (e.g., **\u201cMicrosoft Outlook account\u201d**).  \n4. **Output:** A list of events with the raw ISO start time.\n\n## 3\ufe0f\u20e3 Normalize Dates \u2014 *Convert to Date Format*  \n```js\n// Code node contents\nreturn $input.all().map(item => {\n  const startDateTime = new Date(item.json.start.dateTime);\n  const formattedDate = startDateTime.toISOString().split('T')[0]; // YYYY-MM-DD\n  return { json: { ...item.json, startDateFormatted: formattedDate } };\n});"
      },
      "typeVersion": 1
    },
    {
      "id": "c5c6f208-79c3-4c35-ba37-55401cd35d44",
      "name": "Sticky Note15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        20,
        4720
      ],
      "parameters": {
        "color": 6,
        "width": 1300,
        "height": 860,
        "content": "### 4\ufe0f\u20e3 Filter the Events Down to *This* Week  \nAfter we\u2019ve normalised the `start` date-time into a simple `YYYY-MM-DD` string, we drop in a **Filter** node.  \nAdd one rule for every day you want to keep\u2014for example `2025-08-07` **or** `2025-08-08`. Rows that match any of those dates will continue through the workflow; everything else is quietly discarded.  \n\n*Why we\u2019re doing this:* we only want to summarise tomorrow\u2019s and the following day\u2019s meetings, not the entire calendar.\n\n---\n\n### 5\ufe0f\u20e3 Roll All Subjects Into a Single Item  \nNext comes an **Aggregate** node. Tell it to aggregate the `subject` field and choose the option *\u201cOnly aggregated fields.\u201d*  \nThe result is one clean item whose `subject` property is now a tidy list of every meeting title. It\u2019s far easier (and cheaper) to pass one prompt to GPT than dozens of small ones.\n\n---\n\n### 6\ufe0f\u20e3 Turn That List Into Plain Text  \nInsert a small **Code** node right after the aggregation:\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "76f2b328-fd39-42a3-9497-56559b2ad89a",
      "name": "Sticky Note16",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -600,
        4540
      ],
      "parameters": {
        "width": 1920,
        "content": "## \ud83d\udcec Need Help or Want to Customize This?\n\ud83d\udce7 [robert@ynteractive.com](mailto:robert@ynteractive.com)  \n\ud83d\udd17 [LinkedIn](https://www.linkedin.com/in/robert-breen-29429625/)"
      },
      "typeVersion": 1
    },
    {
      "id": "a7f4764f-33d6-45f3-a906-c510656d3864",
      "name": "Convert to Date Format",
      "type": "n8n-nodes-base.code",
      "position": [
        -180,
        5400
      ],
      "parameters": {
        "jsCode": "return $input.all().map(item => {\n  const startDateTime = new Date(item.json.start.dateTime);\n  const formattedDate = startDateTime.toISOString().split('T')[0]; // 'YYYY-MM-DD'\n\n  return {\n    json: {\n      ...item.json,\n      startDateFormatted: formattedDate\n    }\n  };\n});\n"
      },
      "typeVersion": 2
    },
    {
      "id": "f771d488-de87-4925-8385-0fc53c89563f",
      "name": "Filter to This week",
      "type": "n8n-nodes-base.filter",
      "position": [
        80,
        5340
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "cd7ab9cd-ec1a-4cd0-99e3-de5850128da8",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.startDateFormatted }}",
              "rightValue": "2025-08-07"
            },
            {
              "id": "4bcc5653-1067-47ed-aaf9-2362ef113cdb",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.startDateFormatted }}",
              "rightValue": "2025-08-08"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "489fa514-8ca4-4bd6-b131-0d62500e0aa0",
      "name": "Combine to one Field",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        300,
        5440
      ],
      "parameters": {
        "options": {},
        "fieldsToAggregate": {
          "fieldToAggregate": [
            {
              "fieldToAggregate": "subject"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "08b33759-1de4-4135-9432-c30357abdb1d",
      "name": "Convert objects to text",
      "type": "n8n-nodes-base.code",
      "position": [
        480,
        5340
      ],
      "parameters": {
        "jsCode": "return [\n  {\n    json: {\n      text: items.map(item => JSON.stringify(item.json)).join('\\n'),\n    },\n  },\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "c4e3cdc9-4a3e-42ae-995c-a637cccd5023",
      "name": "Summarize Weekly Events",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "onError": "continueRegularOutput",
      "position": [
        800,
        5200
      ],
      "parameters": {
        "text": "={{ $json.text }}",
        "options": {
          "systemMessage": "Summarize the meetings I have this week. "
        },
        "promptType": "define"
      },
      "typeVersion": 2,
      "alwaysOutputData": true
    }
  ],
  "connections": {
    "Run Workflow": {
      "main": [
        [
          {
            "node": "Get many events",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get many events": {
      "main": [
        [
          {
            "node": "Convert to Date Format",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model5": {
      "ai_languageModel": [
        [
          {
            "node": "Summarize Weekly Events",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Filter to This week": {
      "main": [
        [
          {
            "node": "Combine to one Field",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Combine to one Field": {
      "main": [
        [
          {
            "node": "Convert objects to text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to Date Format": {
      "main": [
        [
          {
            "node": "Filter to This week",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert objects to text": {
      "main": [
        [
          {
            "node": "Summarize Weekly Events",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}