[{"createdAt":"2025-08-19T19:33:49.355Z","updatedAt":"2025-09-11T23:48:54.000Z","id":"czqxETHdDwsxaQgs","name":"sync","active":false,"isArchived":true,"nodes":[{"parameters":{"calendar":{"__rl":true,"value":"={{ $json.Globals.calendarId }}","mode":"id"},"start":"={{ $json.notionDate.date.start }}","end":"={{ $json.endDateTime_Adjusted }}","additionalFields":{"allday":"yes","description":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>","summary":"={{ $json[\"notionName\"] }}"}},"id":"5367a15d-1b2f-4469-af83-0ef71b1ed080","name":"Google Calendar1","type":"n8n-nodes-base.googleCalendar","typeVersion":1,"position":[-208,2480],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $('Loop').item.json.notionID }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"GCal ID|rich_text","textContent":"={{ $json.id }}"}]},"options":{}},"id":"5fa24409-c734-4eb1-9476-cd5d88ca43e5","name":"Add GCal ID","type":"n8n-nodes-base.notion","typeVersion":2,"position":[208,2480],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{},"id":"2f7e5664-5a25-41e8-992f-716231a472f9","name":"No Operation, do nothing","type":"n8n-nodes-base.noOp","typeVersion":1,"position":[-1360,2400]},{"parameters":{"content":"# Create event","height":80,"width":288.259119644621,"color":7},"id":"7c4412c5-4e9e-4659-899b-6e29622c85ae","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-1888,2304]},{"parameters":{"content":"# Update Event","height":80,"width":299.54925745153224,"color":7},"id":"c24bac3c-f8ae-45ae-a761-195cb7830d99","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-2208,768]},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $('Loop3').item.json.notionID }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"GCal ID|rich_text"}]},"options":{}},"id":"0b7fe58d-ea0f-4669-ab95-9b108ecc16be","name":"Remove GCal ID2","type":"n8n-nodes-base.notion","typeVersion":2,"position":[208,1232],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"content":"## This flow deletes GCal ID and Date, when the event is cancelled in Google.","height":162.57090146831365,"width":256.72937811647864,"color":7},"id":"74c9f017-3b60-49ce-8221-71f05399c191","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4688,4464]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date }}","operation":"isNotEmpty"}]}},"id":"7143ca98-bdb3-49c9-a395-372cc0ef99b1","name":"Does it have a date?","type":"n8n-nodes-base.if","typeVersion":1,"position":[-1584,784]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date.start }}","operation":"contains","value2":"T"}]}},"id":"36c1872a-20d9-4d0f-bbb2-b263b98bbef7","name":"Does it have a time?","type":"n8n-nodes-base.if","typeVersion":1,"position":[-1184,688]},{"parameters":{"operation":"delete","calendar":{"__rl":true,"value":"={{ $json.Globals.calendarId }}","mode":"id"},"eventId":"={{ $json.GCal_ID }}","options":{}},"id":"e2fd0ad3-7eda-42cf-bdd2-25609228b7da","name":"Delete event1","type":"n8n-nodes-base.googleCalendar","typeVersion":1,"position":[0,1232],"alwaysOutputData":false,"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date }}","operation":"isNotEmpty"}]}},"id":"84980144-f13c-4dcd-83f9-5beffeb3abb6","name":"Does it have a date?1","type":"n8n-nodes-base.if","typeVersion":1,"position":[-1584,2304]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date.start }}","operation":"contains","value2":"T"}]}},"id":"5095ea38-6a31-4e78-b357-5046f07db8d5","name":"Does it have a time?1","type":"n8n-nodes-base.if","typeVersion":1,"position":[-1360,2240]},{"parameters":{"resource":"databasePage","operation":"getAll","databaseId":{"__rl":true,"value":"={{ $json.Globals.databaseId }}","mode":"id"},"returnAll":true,"filterType":"manual","filters":{"conditions":[{"key":"GCal ID|rich_text","condition":"equals","richTextValue":"={{ $json.id }}"}]},"options":{}},"id":"55d1051e-2195-45db-be8a-5f591cfb117f","name":"Find Task","type":"n8n-nodes-base.notion","typeVersion":2,"position":[-3264,4704],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $json.id }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"GCal ID|rich_text"},{"key":"Date|date"}]},"options":{}},"id":"ecfd6b99-1a20-4f7c-ab93-2f6f163f9c78","name":"Remove GCal ID and Date","type":"n8n-nodes-base.notion","typeVersion":2,"position":[-3024,4704],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"resource":"databasePage","operation":"getAll","databaseId":{"__rl":true,"value":"dad4835c-1acc-4209-aac2-11440b13c475","mode":"list","cachedResultName":"Tasks","cachedResultUrl":"https://www.notion.so/dad4835c1acc4209aac211440b13c475"},"returnAll":true,"simple":false,"filterType":"manual","matchType":"allFilters","filters":{"conditions":[{"key":"Data|date","condition":"is_not_empty"},{"key":"Status|status","condition":"does_not_equal","statusValue":"Done"},{"key":"Status|status","condition":"does_not_equal","statusValue":"Archived"}]},"options":{}},"id":"6ccb369c-7787-44fa-9e68-95c98c7c27d3","name":"Notion","type":"n8n-nodes-base.notion","typeVersion":2.1,"position":[-5376,1504],"disabled":true},{"parameters":{"calendar":{"__rl":true,"value":"={{ $json.Globals.calendarId }}","mode":"id"},"start":"={{ $json.notionDate.date.start }}","end":"={{ $json.defaultEndDate }}","additionalFields":{"allday":"no","description":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>","summary":"={{ $json.notionName }}"}},"id":"13efe102-8023-4b29-ac96-b0b5b7d61bf7","name":"Google Calendar3","type":"n8n-nodes-base.googleCalendar","typeVersion":1,"position":[-208,2128],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"calendar":{"__rl":true,"value":"={{ $json.Globals.calendarId }}","mode":"id"},"start":"={{ $json.notionDate.date.start }}","end":"={{ $json.notionDate.date.end }}","additionalFields":{"allday":"no","description":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>","summary":"={{ $json.notionName }}"}},"id":"9c6381b1-7632-423b-80aa-5d1277cdd29c","name":"Google Calendar","type":"n8n-nodes-base.googleCalendar","typeVersion":1,"position":[-208,1888],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $('Loop2').item.json.notionID }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"GCal ID|rich_text","textContent":"={{ $json.id }}"}]},"options":{}},"id":"03271d3e-0b79-4588-88dc-c68c20415ca4","name":"Add GCal ID3","type":"n8n-nodes-base.notion","typeVersion":2,"position":[208,1888],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date.end }}","operation":"isNotEmpty"}]}},"id":"237a3eca-d712-4ce6-bcfe-f0819643a95e","name":"Does it have an end date?","type":"n8n-nodes-base.if","typeVersion":1,"position":[-1040,2032]},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $('Loop1').item.json.notionID }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"GCal ID|rich_text","textContent":"={{ $json.id }}"}]},"options":{}},"id":"1dd27b86-e3f8-438e-a921-406db31ce5d8","name":"Add GCal ID1","type":"n8n-nodes-base.notion","typeVersion":2,"position":[208,2128],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"options":{"reset":false}},"id":"4645f007-bc25-4248-a1b7-9678da51f49b","name":"Loop","type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[-784,2480]},{"parameters":{"options":{"reset":false}},"id":"cc0dc89d-edca-4d71-a205-7399fe962a15","name":"Loop1","type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[-400,2128]},{"parameters":{"options":{"reset":false}},"id":"dba172e6-3c32-4888-ae36-8934ec561be6","name":"Loop2","type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[-400,1888]},{"parameters":{"options":{"reset":false}},"id":"24f66926-07a2-4513-b028-33a59b4374c3","name":"Loop3","type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[-208,1232]},{"parameters":{"content":"## Choose your default event duration\nWhen pushing an event from Notion to Google Calendar, what is going to be the default duration?","height":334.192512604689,"width":259.7926186615935},"id":"286542e3-5f67-4871-a5ea-5fc6c87c8c52","name":"Sticky Note11","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-2784,1472]},{"parameters":{"operation":"addToDate","magnitude":"={{ $json.notionDate.date.start }}","timeUnit":"hours","duration":1,"outputFieldName":"defaultEndDate","options":{"includeInputFields":true}},"id":"0d0cf407-a032-4bd6-97ba-c762609306d6","name":"Creates defaultEndDate with 1h duration","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-2704,1632]},{"parameters":{"content":"## Use these nodes for testing\nReplace the Notion \"Page Updated\" trigger by these 4 nodes to help simulate the behavior of the trigger.\n\nYou can create different filters and enable or disable the upper and lower nodes, depending on what tasks you need to test.\n\nThe only pages that won't work during testing are the deleted ones.","height":632.2029116375359,"width":880.8180923381184},"id":"ad87d20c-3d3d-478e-a0d2-984234b7a92b","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-5760,1264]},{"parameters":{"operation":"delete","calendar":{"__rl":true,"value":"={{ $json.Globals.calendarId }}","mode":"id"},"eventId":"={{ $json.GCal_ID }}","options":{}},"id":"86286946-86cb-4c6d-9faa-c77b03f3d118","name":"Delete event2","type":"n8n-nodes-base.googleCalendar","typeVersion":1,"position":[208,0],"alwaysOutputData":false,"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"options":{"reset":false}},"id":"0daa3122-69d6-4c2c-b807-10b54da0ec4f","name":"Loop4","type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[0,0]},{"parameters":{"resource":"databasePage","operation":"getAll","databaseId":{"__rl":true,"value":"dad4835c-1acc-4209-aac2-11440b13c475","mode":"list","cachedResultName":"Tasks","cachedResultUrl":"https://www.notion.so/dad4835c1acc4209aac211440b13c475"},"returnAll":true,"simple":false,"filterType":"manual","matchType":"allFilters","filters":{"conditions":[{"key":"GCal ID|rich_text","condition":"is_not_empty"},{"key":"Status|status","condition":"does_not_equal","statusValue":"Done"},{"key":"Status|status","condition":"does_not_equal","statusValue":"Archived"}]},"options":{}},"id":"677ec39f-5a46-497c-977d-ffb009084253","name":"Notion1","type":"n8n-nodes-base.notion","typeVersion":2.1,"position":[-5376,1664],"disabled":true},{"parameters":{"mode":"combine","mergeByFields":{"values":[{"field1":"id","field2":"id"}]},"joinMode":"keepEverything","options":{}},"id":"46ab85ef-5cca-4f51-b94f-e58ea7cf4501","name":"Merge","type":"n8n-nodes-base.merge","typeVersion":2.1,"position":[-5088,1584],"disabled":true},{"parameters":{"content":"## Add one trigger for each Notion database that you want to sync","height":702.7054859554116,"width":289.07844289683123},"id":"2ef8d733-60ea-4087-8a6f-1c6a451b4d8c","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4416,1200]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date.end }}","operation":"isNotEmpty"}]}},"id":"379faaad-7241-46cd-acea-7b2f7d02509c","name":"Does it have an end date?1","type":"n8n-nodes-base.if","typeVersion":1,"position":[-896,480]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date.end }}","operation":"isNotEmpty"}]}},"id":"951ae0f1-9094-40b6-8db7-3cb4ab9ac029","name":"Does it have an end date?2","type":"n8n-nodes-base.if","typeVersion":1,"position":[-1040,2624]},{"parameters":{"calendar":{"__rl":true,"value":"={{ $json.Globals.calendarId }}","mode":"id"},"start":"={{ $json.notionDate.date.start }}","end":"={{ $json.notionDate.date.start }}","additionalFields":{"allday":"yes","description":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>","summary":"={{ $json[\"notionName\"] }}"}},"id":"e9780c77-d775-4a01-ad61-e105c4faf07d","name":"Google Calendar2","type":"n8n-nodes-base.googleCalendar","typeVersion":1,"position":[-208,2720],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $('Loop5').item.json.notionID }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"GCal ID|rich_text","textContent":"={{ $json.id }}"}]},"options":{}},"id":"07c360cf-f438-4620-ad7f-03a6d2d5cb7e","name":"Add GCal ID2","type":"n8n-nodes-base.notion","typeVersion":2,"position":[208,2720],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"content":"## YYYY-MM-DD","height":80,"width":190.88107700739067,"color":7},"id":"d7c66718-55ce-4322-ada2-8b86659d2ffb","name":"Sticky Note18","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,2752]},{"parameters":{"options":{"reset":false}},"id":"da429e42-31d4-469f-b378-5340862be83c","name":"Loop5","type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[-400,2720]},{"parameters":{"content":"## YYYY-MM-DD\n## YYYY-MM-DD","height":96.35243080295625,"width":190.88107700739073,"color":7},"id":"89116b32-27eb-4841-8469-e7f25059e8bd","name":"Sticky Note19","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,2512]},{"parameters":{"content":"## YYYY-MM-DD T HH:MM:SS-Z\n## YYYY-MM-DD T HH:MM:SS-Z","height":96.35243080295625,"width":364.9229338011439,"color":7},"id":"484f8d49-e90b-4b50-b69d-c0174315e989","name":"Sticky Note20","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,1888]},{"parameters":{"content":"## YYYY-MM-DD T HH:MM:SS-Z","height":80,"width":359.18646169567,"color":7},"id":"df76034c-d96e-4d73-9b80-16199e067bc9","name":"Sticky Note21","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,2144]},{"parameters":{"content":"## YYYY-MM-DD","height":80,"width":190.88107700739067,"color":7},"id":"ef28cb2d-348b-4aae-9db0-8f962182ddc3","name":"Sticky Note26","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,960]},{"parameters":{"content":"## YYYY-MM-DD\n## YYYY-MM-DD","height":96.35243080295625,"width":190.88107700739073,"color":7},"id":"07b2e5f1-9dfc-4c60-921b-51bc22a996a5","name":"Sticky Note27","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,768]},{"parameters":{"content":"## YYYY-MM-DD T HH:MM:SS-Z\n## YYYY-MM-DD T HH:MM:SS-Z","height":109.18668977858542,"width":364.9229338011439,"color":7},"id":"c52b40b5-8961-4a5b-aac4-8af58aed3c9e","name":"Sticky Note28","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,352]},{"parameters":{"content":"## YYYY-MM-DD T HH:MM:SS-Z","height":83.20856474390726,"width":359.18646169567,"color":7},"id":"d330a691-32ad-43f7-a4c8-06a0c4dacc85","name":"Sticky Note29","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,544]},{"parameters":{"content":"## Runs when page is deleted in Notion","height":96.35243080295625,"width":364.9229338011439,"color":7},"id":"a0c18042-9d6f-4d34-8fba-6fbc05580cf8","name":"Sticky Note31","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,0]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.GCal_ID }}","operation":"isNotEmpty"}]}},"id":"5168afdc-7a6f-4715-ba8b-5ad455004c59","name":"GCal_ID exists in Notion?","type":"n8n-nodes-base.if","typeVersion":1,"position":[-2400,1632]},{"parameters":{"conditions":{"boolean":[{"value1":"={{ $json.in_trash }}","value2":"={{ true }}"}]}},"id":"eb9c7a8d-1157-4e68-9b7a-78d68bf68612","name":"Is the page deleted?","type":"n8n-nodes-base.if","typeVersion":1,"position":[-1888,768]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date.end }}","operation":"isNotEmpty"}]}},"id":"44859708-f9f4-4a7f-bd3a-e34a8768b50c","name":"Does it have an end date?3","type":"n8n-nodes-base.if","typeVersion":1,"position":[-896,784]},{"parameters":{"content":"## Runs when date is cleared in Notion","height":96.35243080295625,"width":364.9229338011439,"color":7},"id":"18091cdb-2e4e-443b-93f5-1845191e86d2","name":"Sticky Note33","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,1232]},{"parameters":{"operation":"addToDate","magnitude":"={{ $json.notionDate.date.end.toDateTime() }}","duration":1,"outputFieldName":"endDateTime_Adjusted","options":{"includeInputFields":true}},"id":"d91f5140-28d9-459e-9325-91f8807a23e4","name":"Add 1 day to end date","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-400,768],"notesInFlow":true,"notes":"Google Calendar and Notion handle end dates differently, when there's no time set.\n\nIf a date in Notion is from Nov-10 to Nov-12, in Google it will show \"Nov-10 at 00:00\" to \"Nov-12 at 00:00\".\nMeaning the event would end at the beggining of the day in Nov-12, not lasting all day.\n\nSo to make an event last all day in Nov-12 you have to make the end_date \"Nov-13 at 00:00\"."},{"parameters":{"operation":"formatDate","date":"={{ $json.endDateTime_Adjusted }}","format":"yyyy-MM-dd","outputFieldName":"endDate_Adjusted","options":{"includeInputFields":true}},"id":"ce6f8739-25a5-41d6-bb0a-3db77fa66945","name":"Format date","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-208,768]},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $json.Globals.calendarId }}/events/{{ $json.GCal_ID }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"bodyParameters":{"parameters":[{"name":"start","value":"={{ {\n  \"dateTime\": null,\n  \"date\": $json.notionDate.date.start\n} }}"},{"name":"end","value":"={{ {\n  \"dateTime\": null,\n  \"date\": $json.endDate_Adjusted\n} }}"},{"name":"summary","value":"={{ $json.notionName }}"},{"name":"status","value":"confirmed"},{"name":"description","value":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>"}]},"options":{}},"id":"2e61b53c-da96-4dd1-9a76-b6742380d3f5","name":"Update to All Day event","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[0,768],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $json.Globals.calendarId }}/events/{{ $json.GCal_ID }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"bodyParameters":{"parameters":[{"name":"start","value":"={{ {\n  \"dateTime\": null,\n  \"date\": $json.notionDate.date.start\n} }}"},{"name":"end","value":"={{ {\n  \"dateTime\": null,\n  \"date\": $json.notionDate.date.start\n} }}"},{"name":"summary","value":"={{ $json.notionName }}"},{"name":"status","value":"confirmed"},{"name":"description","value":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>"}]},"options":{}},"id":"b57fbd05-9db6-43cc-a94b-91e1f21d1e04","name":"Update to All Day event2","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[0,960],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $json.Globals.calendarId }}/events/{{ $json.GCal_ID }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"bodyParameters":{"parameters":[{"name":"start","value":"={{ {\n  \"dateTime\": $json.notionDate.date.start,\n  \"date\": null\n} }}"},{"name":"end","value":"={{ {\n  \"dateTime\": $json.defaultEndDate,\n  \"date\": null\n} }}"},{"name":"summary","value":"={{ $json.notionName }}"},{"name":"status","value":"confirmed"},{"name":"description","value":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>"}]},"options":{}},"id":"5cdca01c-ae25-4f09-add5-efdf79b0082c","name":"Update dateTime event1","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[0,528],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"operation":"addToDate","magnitude":"={{ $json.notionDate.date.end.toDateTime() }}","duration":1,"outputFieldName":"endDateTime_Adjusted","options":{"includeInputFields":true}},"id":"7ecbe279-9055-414b-964e-c7bb7e6cf771","name":"Add 1 day to end date1","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-576,2480],"notesInFlow":true,"notes":"Google Calendar and Notion handle end dates differently, when there's no time set.\n\nIf a date in Notion is from Nov-10 to Nov-12, in Google it will show \"Nov-10 at 00:00\" to \"Nov-12 at 00:00\".\nMeaning the event would end at the beggining of the day in Nov-12, not lasting all day.\n\nSo to make an event last all day in Nov-12 you have to make the end_date \"Nov-13 at 00:00\"."},{"parameters":{"operation":"formatDate","date":"={{ $json.endDateTime_Adjusted }}","format":"yyyy-MM-dd","outputFieldName":"endDate_Adjusted","options":{"includeInputFields":true}},"id":"9fdb920f-aeb2-4c9f-af08-b27fc6f49118","name":"Format date1","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-400,2480]},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":1},"conditions":[{"id":"7bcd3c8e-bdae-43d7-9023-a089298db558","leftValue":"={{ $json.last_edited_by.id }}","rightValue":"={{ $json.Globals.n8nConnectionUserId }}","operator":{"type":"string","operation":"equals"}}],"combinator":"and"},"options":{}},"id":"7cda98bf-3625-40f5-b9a5-5d13d4c16b85","name":"Page edited by a user?","type":"n8n-nodes-base.if","typeVersion":2,"position":[-3216,1648],"notesInFlow":true,"notes":"This prevents infinite loops of pages being edited by n8n and triggering the workflow again and again.\nIt will only update Google Calendar events when a user edits the Notion pages."},{"parameters":{},"id":"23075e66-90bd-46fa-a582-a8e66b377a1b","name":"Do nothing","type":"n8n-nodes-base.noOp","typeVersion":1,"position":[-2976,1824]},{"parameters":{"operation":"getAll","calendar":{"__rl":true,"value":"72fb857fe78a97c9ad2d361a2b433518df6549ac7149192c8cca38c73b919eca@group.calendar.google.com","mode":"list","cachedResultName":"Notion Tasks"},"returnAll":true,"options":{"timeMin":"={{ $today.minus(1, 'days') }}"}},"id":"a0a3c4d4-4710-4357-8079-95b2282e8a80","name":"Get future events + yesterday","type":"n8n-nodes-base.googleCalendar","typeVersion":1.1,"position":[-5344,3392],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}},"disabled":true},{"parameters":{"content":"# Notion ➡ Google","height":80,"width":339.3724182117961,"color":7},"id":"f2d64ee8-d34c-475b-895b-29117cd64f48","name":"Sticky Note9","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4448,1104]},{"parameters":{"content":"# Google ➡ Notion","height":87.25811154533459,"width":329.84653344771755,"color":7},"id":"7628a33b-49f1-42ec-8086-4c579ab26ce3","name":"Sticky Note10","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4416,3168]},{"parameters":{"operation":"getTimeBetweenDates","startDate":"={{ $json.extendedProperties.shared.lastUpdatedByAutomation }}","endDate":"={{ $json.updated }}","units":["second"],"options":{"includeInputFields":true}},"id":"679dd37f-dd45-4226-bd97-8cbb42afabdc","name":"Calculate timeDifference between Google's updated_at  and our own updated_at fields","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-2784,3904]},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"b2b768dd-1682-42c2-9b6a-cd30a25415ba","leftValue":"={{ $json.timeDifference.seconds }}","rightValue":2,"operator":{"type":"number","operation":"gt"}}],"combinator":"and"},"options":{}},"id":"8befe296-d191-440c-bcfa-9f9b41be2f3e","name":"Only events that were edited 2s after the last update","type":"n8n-nodes-base.filter","typeVersion":2,"position":[-2576,3904],"notesInFlow":true,"notes":"This prevents an infinite loop.\n\nWhen you edit your Notion page, our automation edits the Google event. This would activate the Google trigger again and again.\n\nUsing the field \"lastUpdatedByAutomation\" we can check if the update happened after our automation ran. Meaning the user was the one that edited the event."},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.start.dateTime }}","operation":"contains","value2":"T"}]}},"id":"4e80b520-468b-4d14-a9f7-93be5668151a","name":"Does it have a time?2","type":"n8n-nodes-base.if","typeVersion":1,"position":[-2368,3904]},{"parameters":{"operation":"subtractFromDate","magnitude":"={{ $json.end.date }}","duration":1,"outputFieldName":"notionDateTimeEnd","options":{"includeInputFields":true}},"id":"8379faa4-5904-4e45-ac0f-dc2ea6a6e6fc","name":"Subtract 1 day from end_date","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-2144,4000],"notesInFlow":true,"notes":"Google Calendar and Notion handle end dates differently, when there's no time set.\n\nIf a date in Notion is from Nov-10 to Nov-12, in Google it will show \"Nov-10 at 00:00\" to \"Nov-12 at 00:00\".\n\nWhen you set an event in Google from Nov-12 to Nov-13, it sets the end date to \"Nov-14 at 00:00\" behind the scenes.\nMeaning the event would end at the beggining of Nov-14, lasting all day long during Nov-13.\n\nBut Notion considers Nov-12 to Nov-13 already as all day dates.\nSo Nov-14 in Google must be Nov-13 in Notion."},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"817652c4-64ad-45d7-800a-c58e2e23f9cc","leftValue":"={{ $json.extendedProperties.shared.lastUpdatedByAutomation }}","rightValue":"","operator":{"type":"string","operation":"notExists","singleValue":true}}],"combinator":"and"},"options":{}},"id":"589b30a2-6afb-4c5a-a29b-6b9cbe5a3f2e","name":"Is it a new event?","type":"n8n-nodes-base.if","typeVersion":2,"position":[-3040,3744]},{"parameters":{"operation":"formatDate","date":"={{ $json.notionDateTimeEnd }}","format":"yyyy-MM-dd","outputFieldName":"notiondEndDate","options":{"includeInputFields":true}},"id":"cca803af-d4ff-4303-9bde-4cc5e1854b56","name":"Format end_date","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-1936,4000]},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"e10b5ca3-c90a-4203-b174-277c2cd23469","name":"Add extendedProperties to Google event","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[208,352],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"4d015a29-0e40-4117-9aac-2d095994f3dd","name":"Add extendedProperties to Google event1","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[208,528],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"f2373131-843a-4769-a73d-7de81d294459","name":"Add extendedProperties to Google event2","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[208,768],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"1954dee4-1c29-47e9-882e-5b2ccec4c340","name":"Add extendedProperties to Google event3","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[208,960],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"32eef5bb-ab7d-4572-b009-1adc97bd3b03","name":"Add extendedProperties to Google event4","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[0,1888],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"8a57a689-6892-4fef-8434-4357fb57facf","name":"Add extendedProperties to Google event5","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[0,2128],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"4b7183dc-6998-4614-bf09-3cc9a7d66f56","name":"Add extendedProperties to Google event6","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[0,2480],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"d05501bd-db3f-4568-844c-5d2c92367092","name":"Add extendedProperties to Google event7","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[0,2720],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"a16200de-0d2b-4144-a5ea-77d52e1eed42","leftValue":"={{ $json.start.date }}","rightValue":"={{ $json.notiondEndDate }}","operator":{"type":"string","operation":"notRegex"}}],"combinator":"and"},"options":{}},"id":"24a43347-f8fa-4ded-bbe3-0f04acf6ef25","name":"Does it really have an end_date?","type":"n8n-nodes-base.if","typeVersion":2,"position":[-1744,4000]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.start.dateTime }}","operation":"contains","value2":"T"}]}},"id":"62b4cf59-f36b-47d5-a360-c435762cfbc6","name":"Does it have a time?3","type":"n8n-nodes-base.if","typeVersion":1,"position":[-2800,3408]},{"parameters":{"operation":"subtractFromDate","magnitude":"={{ $json.end.date }}","duration":1,"outputFieldName":"notionDateTimeEnd","options":{"includeInputFields":true}},"id":"84079375-8b14-425b-9fba-1b35895e51c8","name":"Subtract 1 day from end_date1","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-2576,3504],"notesInFlow":true,"notes":"Google Calendar and Notion handle end dates differently, when there's no time set.\n\nIf a date in Notion is from Nov-10 to Nov-12, in Google it will show \"Nov-10 at 00:00\" to \"Nov-12 at 00:00\".\n\nWhen you set an event in Google from Nov-12 to Nov-13, it sets the end date to \"Nov-14 at 00:00\" behind the scenes.\nMeaning the event would end at the beggining of Nov-14, lasting all day long during Nov-13.\n\nBut Notion considers Nov-12 to Nov-13 already as all day dates.\nSo Nov-14 in Google must be Nov-13 in Notion."},{"parameters":{"operation":"formatDate","date":"={{ $json.notionDateTimeEnd }}","format":"yyyy-MM-dd","outputFieldName":"notiondEndDate","options":{"includeInputFields":true}},"id":"705b09c8-cf2e-4153-9f5b-291ca32dfdd2","name":"Format end_date1","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-2384,3504]},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":1},"conditions":[{"id":"a16200de-0d2b-4144-a5ea-77d52e1eed42","leftValue":"={{ $json.start.date }}","rightValue":"={{ $json.notiondEndDate }}","operator":{"type":"string","operation":"notRegex"}}],"combinator":"and"},"options":{}},"id":"7b910805-a463-450d-bcc2-912a1ffe94bb","name":"Does it really have an end_date?1","type":"n8n-nodes-base.if","typeVersion":2,"position":[-2176,3504]},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"={{ $json.Globals.databaseId }}","mode":"id"},"title":"={{ $json.summary }}","propertiesUi":{"propertyValues":[{"key":"Date|date","range":true,"includeTime":false,"dateStart":"={{ $json.start.date }}","dateEnd":"={{ $json.notiondEndDate }}"},{"key":"GCal ID|rich_text","textContent":"={{ $json.id }}"}]},"options":{}},"id":"f21ff198-4c52-40b4-b096-8b97fdfd69ba","name":"Create page1","type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-1968,3408],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"={{ $json.Globals.databaseId }}","mode":"id"},"title":"={{ $json.summary }}","propertiesUi":{"propertyValues":[{"key":"Date|date","includeTime":false,"date":"={{ $json.start.date }}"},{"key":"GCal ID|rich_text","textContent":"={{ $json.id }}"}]},"options":{}},"id":"a87e5b86-99ab-42df-965d-4b3e09199ac7","name":"Create page2","type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-1968,3600],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs1').item.json.Globals.calendarId }}/events/{{ $('Globals1').item.json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $json.id }}\"\n    }\n  },\n  \"description\": \"👉 <a href=https://www.notion.so/{{ $json.id.replaceAll(\"-\", \"\") }} target=_blank><b>View in Notion</b></a>\"\n}","options":{}},"id":"f7895cdb-2238-41d3-88a7-9252aae29639","name":"Add extendedProperties to Google event8","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[-2384,3312],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs1').item.json.Globals.calendarId }}/events/{{ $('Globals1').item.json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $json.id }}\"\n    }\n  },\n  \"description\": \"👉 <a href=https://www.notion.so/{{ $json.id.replaceAll(\"-\", \"\") }} target=_blank><b>View in Notion</b></a>\"\n}","options":{}},"id":"d3e81289-c020-4698-b949-ea6b6b6e2560","name":"Add extendedProperties to Google event9","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[-1776,3408],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs1').item.json.Globals.calendarId }}/events/{{ $('Globals1').item.json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $json.id }}\"\n    }\n  },\n  \"description\": \"👉 <a href=https://www.notion.so/{{ $json.id.replaceAll(\"-\", \"\") }} target=_blank><b>View in Notion</b></a>\"\n}","options":{}},"id":"d2966ca6-a625-496b-afdd-9622858f4406","name":"Add extendedProperties to Google event10","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[-1776,3600],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"mode":"raw","jsonOutput":"{\n  \"Globals\": {\n    \n    \"n8nConnectionUserId\": \"a07174da-0c76-4695-a1e1-ceab14e1c47e\",\n    \n    \"Todo\": {\n      \"databaseId\": \"218dcbfd-8835-8008-a2bd-c164ab084ed3\",\n      \"calendarId\": \"b0fdadc0038eaed12fbcdb9a4130a3ae4c1ffd36c1ce9ce62221cd77b6196164@group.calendar.google.com\"\n    },\n\n    \"Meetings\": {\n      \"databaseId\": \"24ddcbfd-8835-80fe-ab1d-fa7270343d5b\",\n      \"calendarId\": \"293ead77ad5a26298e15cd8a36e87b3c22311f4f15b3e783ce1ace367ce04911@group.calendar.google.com\"\n    }\n  }\n}","includeOtherFields":true,"options":{}},"id":"15e17c60-3a03-4cad-a93a-498db2691495","name":"Globals","type":"n8n-nodes-base.set","typeVersion":3.4,"position":[-3808,1648]},{"parameters":{"content":"# Set some variables here\n## 1️⃣ n8nConnectionUserId\nWhen a page is edited in Notion it registers the ID of the user that made the change.\n\nTo find out what's the ID for your n8n user, use a Notion node to create a database page and check the 'last_edited_by' field.\n\n\n\n\n## 2️⃣ Database and Calendar IDs\nFor each database you want to sync, you have to add the Notion **databaseId** and Google **calendarId** in JSON objects like this:\n\nTasks: {\n   databaseId: \"`72fb8-57fe78a-sgf976`\",\n   calendarId: \"`73b919eca@group.calendar.google.com`\"\n },\n\nMeetings: {\n    databaseId: \"`157fe-78a23f-dfs978`\",\n    calendarId: \"`2a384hfy@group.calendar.google.com`\"\n  }\n\n## 🚨🚨🚨 ATTENTION 🚨🚨🚨\nThe databaseId must include the hyphens, like this:\n`d6e15d95-c538-4795-b1d8-0e5gc778c03c`\n\nThe pattern is:\n8 characters - 4 characters - 4 characters - 4 characters - 12 characters.","height":1341,"width":399},"id":"c31c2827-f4e2-40d1-b4af-a0aaa399035c","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-3952,832]},{"parameters":{"jsCode":"const items = $input.all();\nconst updatedItems = items.map(item => {\n  const databaseId = item.json.parent.database_id;\n  let currentCalendarId = null;\n\n  // Searches the Globals object to find the matching field\n  for (const key in item.json.Globals) {\n    if (item.json.Globals[key].databaseId === databaseId) {\n      currentCalendarId = item.json.Globals[key].calendarId;\n      break;\n    }\n  }\n\n  // Rebuild the Globals object with only the desired fields\n  item.json.Globals = {\n    n8nConnectionUserId: item.json.Globals.n8nConnectionUserId,\n    calendarId: currentCalendarId,\n    databaseId: databaseId\n  };\n  \n  return item;\n});\n\nreturn updatedItems;"},"id":"8f3c1f20-2d60-45d2-8e94-deb1e5b5dc99","name":"Set the current database and calendar IDs","type":"n8n-nodes-base.code","typeVersion":2,"position":[-3488,1648]},{"parameters":{"content":"# Copy the Globals from above and paste here","height":388.29901720463954,"width":319.61007431942534},"id":"ae9fa173-451b-4f01-b075-d288dae494ab","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-3904,3552]},{"parameters":{"mode":"raw","jsonOutput":"{\n  \"Globals\": {\n    \n    \"n8nConnectionUserId\": \"a07174da-0c76-4695-a1e1-ceab14e1c47e\",\n    \n    \"Todo\": {\n      \"databaseId\": \"218dcbfd-8835-8008-a2bd-c164ab084ed3\",\n      \"calendarId\": \"b0fdadc0038eaed12fbcdb9a4130a3ae4c1ffd36c1ce9ce62221cd77b6196164@group.calendar.google.com\"\n    },\n\n    \"Meetings\": {\n      \"databaseId\": \"24ddcbfd-8835-80fe-ab1d-fa7270343d5b\",\n      \"calendarId\": \"293ead77ad5a26298e15cd8a36e87b3c22311f4f15b3e783ce1ace367ce04911@group.calendar.google.com\"\n    }\n  }\n}","includeOtherFields":true,"options":{}},"id":"97df49b3-51ba-449d-82e2-2a2e433eba1b","name":"Globals1","type":"n8n-nodes-base.set","typeVersion":3.4,"position":[-3808,3744]},{"parameters":{"content":"# Copy the Globals from above and paste here","height":380.06310703196385,"width":319.61007431942534},"id":"f35664b1-7dfb-4f12-8a31-6a0e13567105","name":"Sticky Note14","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-3904,4512]},{"parameters":{"mode":"raw","jsonOutput":"{\n  \"Globals\": {\n    \n    \"n8nConnectionUserId\": \"a07174da-0c76-4695-a1e1-ceab14e1c47e\",\n    \n    \"Todo\": {\n      \"databaseId\": \"218dcbfd-8835-8008-a2bd-c164ab084ed3\",\n      \"calendarId\": \"b0fdadc0038eaed12fbcdb9a4130a3ae4c1ffd36c1ce9ce62221cd77b6196164@group.calendar.google.com\"\n    },\n\n    \"Meetings\": {\n      \"databaseId\": \"24ddcbfd-8835-80fe-ab1d-fa7270343d5b\",\n      \"calendarId\": \"293ead77ad5a26298e15cd8a36e87b3c22311f4f15b3e783ce1ace367ce04911@group.calendar.google.com\"\n    }\n  }\n}","includeOtherFields":true,"options":{}},"id":"1f2edb5e-7450-4366-b465-d633d9531fba","name":"Globals2","type":"n8n-nodes-base.set","typeVersion":3.4,"position":[-3808,4704]},{"parameters":{"jsCode":"const items = $input.all();\nconst updatedItems = items.map(item => {\n  const calendarId = item.json.organizer.email;\n  let currentDatabaseId = null;\n\n  // Searches the Globals object to find the matching field\n  for (const key in item.json.Globals) {\n    if (item.json.Globals[key].calendarId === calendarId) {\n      currentDatabaseId = item.json.Globals[key].databaseId;\n      break;\n    }\n  }\n\n  // Rebuild the Globals object with only the desired fields\n  item.json.Globals = {\n    n8nConnectionUserId: item.json.Globals.n8nConnectionUserId,\n    calendarId: calendarId,\n    databaseId: currentDatabaseId\n  };\n  \n  return item;\n});\n\nreturn updatedItems;"},"id":"9d023c64-19b5-4c65-ad85-47ca868e8546","name":"Set the current database and calendar IDs2","type":"n8n-nodes-base.code","typeVersion":2,"position":[-3504,4704]},{"parameters":{"content":"## Use this node for testing\nReplace the Event Updated trigger by this node","height":305.14255210487977,"width":315.66399727154976},"id":"1a99a62c-6db7-4f4c-8835-89dad1a40e1c","name":"Sticky Note16","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-5408,3264]},{"parameters":{"content":"## Add two triggers for each Google Calendar that you want to sync","height":665.1419819421769,"width":365.7122508375314},"id":"2faa5ae2-27de-4bf7-a011-d1a6dbe37d31","name":"Sticky Note17","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4448,3264]},{"parameters":{"content":"## Add one trigger for each Google Calendar that you want to sync","height":641.5966864244806,"width":283.9419368038477},"id":"8a0c782a-19ce-44bb-8415-14a47645da14","name":"Sticky Note34","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4400,4240]},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"calendarId":{"__rl":true,"value":"b0fdadc0038eaed12fbcdb9a4130a3ae4c1ffd36c1ce9ce62221cd77b6196164@group.calendar.google.com","mode":"list","cachedResultName":"TodoCal"},"triggerOn":"eventUpdated","options":{}},"id":"9865eb3c-e3bf-4256-b2eb-e29d8e1c3c44","name":"Event Updated","type":"n8n-nodes-base.googleCalendarTrigger","typeVersion":1,"position":[-4240,3392],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{},"id":"2d422e00-9faf-4731-a908-cbefbe0cd65e","name":"When clicking \"Test workflow\"","type":"n8n-nodes-base.manualTrigger","typeVersion":1,"position":[-5696,1584],"disabled":true},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"calendarId":{"__rl":true,"value":"b0fdadc0038eaed12fbcdb9a4130a3ae4c1ffd36c1ce9ce62221cd77b6196164@group.calendar.google.com","mode":"list","cachedResultName":"TodoCal"},"triggerOn":"eventCreated","options":{}},"id":"a2108a81-6f4b-4b49-b0f7-249910cbe1ae","name":"Event Created","type":"n8n-nodes-base.googleCalendarTrigger","typeVersion":1,"position":[-4400,3392],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"content":"# Todo","height":99.22146266772059,"width":196.39800582684305,"color":7},"id":"e092c432-865a-48e0-a245-77b2505d20bc","name":"Sticky Note35","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4656,3392]},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $json.extendedProperties.shared.notionPageId }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"Data|date","includeTime":false,"date":"={{ $json.start.date }}"},{"key":"Task name|title","title":"={{ $json.summary }}"}]},"options":{}},"id":"75415d9d-c1f7-4bee-bf31-5cb426707908","name":"Update page1 - continue on error","type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-1520,4112],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}},"onError":"continueRegularOutput"},{"parameters":{"content":"### Allowing these Notion nodes to continue on error prevents deleted pages from stopping the workflow.\n\nThe deleted pages go to another branch to be deleted in Google Calendar.","height":324.9384888466118,"color":7},"id":"7b6e885b-a4a2-43ad-8775-03d2584f3854","name":"Sticky Note36","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-1344,3920]},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"186dc8f2-4a6d-416c-9900-1b4ee8e7418b","leftValue":"={{ $json.in_trash }}","rightValue":"true","operator":{"type":"boolean","operation":"true","singleValue":true}}],"combinator":"and"},"options":{}},"id":"ab4e0cca-0111-474f-922e-d90ee673dd77","name":"Find deleted pages1","type":"n8n-nodes-base.filter","typeVersion":2,"position":[-2576,2352]},{"parameters":{"operation":"delete","calendar":{"__rl":true,"value":"={{ $('Only calendarId').item.json.calendarId }}","mode":"id"},"eventId":"={{ $json.properties['GCal ID'].rich_text[0].text.content }}","options":{}},"id":"118cb100-56ae-4fa0-993f-abc56eb04392","name":"Delete event3","type":"n8n-nodes-base.googleCalendar","typeVersion":1,"position":[-2400,2352],"alwaysOutputData":false,"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"content":"## This flow checks if any Notion page was deleted and deletes the event\nWe have to do this because there's no way to retrieve deleted pages using the Notion API.\n\nAnd the \"page updated\" trigger uses the Notion API to check for updates, so it never detects when a page was deleted.","height":306.9481514579442,"width":286.9846072927019,"color":7},"id":"ac8dcc70-c078-4495-92d2-260a186bced2","name":"Sticky Note38","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4416,2224]},{"parameters":{"operation":"getAll","calendar":{"__rl":true,"value":"={{ $json.calendarId }}","mode":"id"},"returnAll":true,"options":{"timeMin":"={{ $today.minus(1, 'days') }}"}},"id":"4206f15c-8cf3-42dc-a880-fad2ad9b568c","name":"Get future events1","type":"n8n-nodes-base.googleCalendar","typeVersion":1.1,"position":[-3120,2352],"alwaysOutputData":false,"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"resource":"databasePage","operation":"get","pageId":{"__rl":true,"value":"={{ $json.extendedProperties.shared.notionPageId }}","mode":"id"},"simple":false},"id":"b2a6c845-ecc6-4640-929d-67104d2583b9","name":"Find related pages1","type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-2768,2352],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"7a2065ef-7d16-4d67-aea0-e2d9185562cd","leftValue":"={{ $json.extendedProperties.shared.notionPageId }}","rightValue":"","operator":{"type":"string","operation":"exists","singleValue":true}}],"combinator":"and"},"options":{}},"id":"944867b4-ff63-483d-8cee-84e3fe914bda","name":"extendedProperties exist?","type":"n8n-nodes-base.filter","typeVersion":2,"position":[-2944,2352]},{"parameters":{"jsCode":"const items = $input.all();\nconst updatedItems = items.map(item => {\n  const calendarId = item.json.organizer.email;\n  let currentDatabaseId = null;\n\n  // Searches the Globals object to find the matching field\n  for (const key in item.json.Globals) {\n    if (item.json.Globals[key].calendarId === calendarId) {\n      currentDatabaseId = item.json.Globals[key].databaseId;\n      break;\n    }\n  }\n\n  // Rebuild the Globals object with only the desired fields\n  item.json.Globals = {\n    n8nConnectionUserId: item.json.Globals.n8nConnectionUserId,\n    calendarId: calendarId,\n    databaseId: currentDatabaseId\n  };\n  \n  return item;\n});\n\nreturn updatedItems;"},"id":"63589180-2b4b-404d-8b50-aaee3a8f5c8b","name":"Set the current database and calendar IDs1","type":"n8n-nodes-base.code","typeVersion":2,"position":[-3504,3744]},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $json.extendedProperties.shared.notionPageId }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"Date|date","range":true,"dateStart":"={{ $json.start.dateTime }}","dateEnd":"={{ $json.end.dateTime }}"},{"key":"Name|title","title":"={{ $json.summary }}"}]},"options":{}},"id":"4b10b1bd-7560-4fa6-904f-89bd050f9d95","name":"Update page2 - continue on error","type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-2144,3808],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}},"onError":"continueRegularOutput"},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $json.extendedProperties.shared.notionPageId }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"Date|date","range":true,"includeTime":false,"dateStart":"={{ $json.start.date }}","dateEnd":"={{ $json.notiondEndDate }}"},{"key":"Name|title","title":"={{ $json.summary }}"}]},"options":{}},"id":"02b2fe1e-4120-4fa8-afb1-79216b9e244c","name":"Update page - continue on error","type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-1520,3920],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}},"onError":"continueRegularOutput"},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"={{ $json.Globals.databaseId }}","mode":"id"},"title":"={{ $json.summary }}","propertiesUi":{"propertyValues":[{"key":"Date|date","range":true,"dateStart":"={{ $json.start.dateTime }}","dateEnd":"={{ $json.end.dateTime }}"},{"key":"GCal ID|rich_text","textContent":"={{ $json.id }}"}]},"options":{}},"id":"40b47ec7-f24d-4ff4-bd8b-0165e0313dd0","name":"Create page","type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-2576,3312],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $json.Globals.calendarId }}/events/{{ $json.GCal_ID }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"bodyParameters":{"parameters":[{"name":"start","value":"={{ {\n  \"dateTime\": $json.notionDate.date.start,\n  \"date\": null\n} }}"},{"name":"end","value":"={{ {\n  \"dateTime\": $json.notionDate.date.end,\n  \"date\": null\n} }}"},{"name":"summary","value":"={{ $json.notionName }}"},{"name":"status","value":"confirmed"},{"name":"description","value":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>"}]},"options":{}},"id":"8c5bd82f-a171-4125-b56e-550de66f7901","name":"Update dateTime event","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[0,352],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"fields":{"values":[{"name":"notionID","stringValue":"={{ $json.id }}"},{"name":"notionName","stringValue":"={{ $json.properties['Name'].title[0].text.content }}"},{"name":"notionDate","type":"objectValue","objectValue":"={{ $json.properties.Date }}"},{"name":"GCal_ID","stringValue":"={{ $json.properties['GCal ID'].rich_text[0].text.content }}"}]},"include":"selected","includeFields":"archived,Globals","options":{}},"id":"96fc921a-6776-4bdb-991d-b0cf98c2f32e","name":"Set some fields","type":"n8n-nodes-base.set","typeVersion":3.2,"position":[-2976,1632]},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"event":"pagedUpdatedInDatabase","databaseId":{"__rl":true,"value":"24ddcbfd-8835-80fe-ab1d-fa7270343d5b","mode":"list","cachedResultName":"Meetings","cachedResultUrl":"https://www.notion.so/24ddcbfd883580feab1dfa7270343d5b"},"simple":false},"id":"694b49d6-80e7-4a81-99a3-ba2e0ae850fd","name":"Page Updated - Meetings","type":"n8n-nodes-base.notionTrigger","typeVersion":1,"position":[-4336,1520],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"calendarId":{"__rl":true,"value":"293ead77ad5a26298e15cd8a36e87b3c22311f4f15b3e783ce1ace367ce04911@group.calendar.google.com","mode":"list","cachedResultName":"MeetingsCal"},"triggerOn":"eventUpdated","options":{}},"id":"95e780ec-2154-458a-8050-8ce5fc663887","name":"Event Updated1","type":"n8n-nodes-base.googleCalendarTrigger","typeVersion":1,"position":[-4240,3584],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"calendarId":{"__rl":true,"value":"293ead77ad5a26298e15cd8a36e87b3c22311f4f15b3e783ce1ace367ce04911@group.calendar.google.com","mode":"list","cachedResultName":"MeetingsCal"},"triggerOn":"eventCreated","options":{}},"id":"c2c8e03e-6c7e-4114-a1a3-51f91210f5e8","name":"Event Created1","type":"n8n-nodes-base.googleCalendarTrigger","typeVersion":1,"position":[-4400,3584],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"content":"# Meetings","height":99.22146266772059,"width":196.39800582684305,"color":7},"id":"46d54fac-934a-4b47-95c7-228be63e41ea","name":"Sticky Note37","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4656,3584]},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"calendarId":{"__rl":true,"value":"293ead77ad5a26298e15cd8a36e87b3c22311f4f15b3e783ce1ace367ce04911@group.calendar.google.com","mode":"list","cachedResultName":"MeetingsCal"},"triggerOn":"eventCancelled","options":{}},"id":"3c8df78c-9e7e-4535-a340-212e012b64ff","name":"Deleted - Meetings","type":"n8n-nodes-base.googleCalendarTrigger","typeVersion":1,"position":[-4320,4560],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"mode":"raw","jsonOutput":"{\n  \"Globals\": {\n    \n    \"n8nConnectionUserId\": \"a07174da-0c76-4695-a1e1-ceab14e1c47e\",\n    \n    \"Todo\": {\n      \"databaseId\": \"218dcbfd-8835-8008-a2bd-c164ab084ed3\",\n      \"calendarId\": \"b0fdadc0038eaed12fbcdb9a4130a3ae4c1ffd36c1ce9ce62221cd77b6196164@group.calendar.google.com\"\n    },\n\n    \"Meetings\": {\n      \"databaseId\": \"24ddcbfd-8835-80fe-ab1d-fa7270343d5b\",\n      \"calendarId\": \"293ead77ad5a26298e15cd8a36e87b3c22311f4f15b3e783ce1ace367ce04911@group.calendar.google.com\"\n    }\n  }\n}","includeOtherFields":true,"options":{}},"id":"99ceed77-708e-4a3e-b97d-c3b80b1d3dfc","name":"Globals3","type":"n8n-nodes-base.set","typeVersion":3.4,"position":[-3808,2352]},{"parameters":{"fieldToSplitOut":"Globals","options":{}},"id":"53da7db6-0dff-4287-afc2-a3e7bb630410","name":"Split fields","type":"n8n-nodes-base.splitOut","typeVersion":1,"position":[-3552,2336]},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"b2a5f692-c6c4-4691-b5cf-fcf57bcd2523","leftValue":"={{ $json.calendarId }}","rightValue":"","operator":{"type":"string","operation":"exists","singleValue":true}}],"combinator":"and"},"options":{}},"id":"527c12b2-54e8-45a4-8d1d-9f40529c14e9","name":"Only calendarId","type":"n8n-nodes-base.filter","typeVersion":2,"position":[-3296,2352]},{"parameters":{"content":"# Copy the Globals from above and paste here","height":388.29901720463954,"width":319.61007431942534},"id":"e88aa2f5-c9c0-4474-8795-6b7234e61a87","name":"Sticky Note41","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-3904,2144]},{"parameters":{"rule":{"interval":[{"field":"minutes","minutesInterval":3}]}},"id":"e4638873-6cc8-4f3b-ad55-c5eb1dd162ca","name":"Every 3min","type":"n8n-nodes-base.scheduleTrigger","typeVersion":1.2,"position":[-4080,2352]},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"event":"pagedUpdatedInDatabase","databaseId":{"__rl":true,"value":"218dcbfd-8835-8008-a2bd-c164ab084ed3","mode":"list","cachedResultName":"TODO ","cachedResultUrl":"https://www.notion.so/218dcbfd88358008a2bdc164ab084ed3"},"simple":false},"id":"bece8ee4-9df0-4f5a-b72c-17da9e26918d","name":"Page Updated - Todo","type":"n8n-nodes-base.notionTrigger","typeVersion":1,"position":[-4336,1344],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"calendarId":{"__rl":true,"value":"b0fdadc0038eaed12fbcdb9a4130a3ae4c1ffd36c1ce9ce62221cd77b6196164@group.calendar.google.com","mode":"list","cachedResultName":"TodoCal"},"triggerOn":"eventCancelled","options":{}},"id":"55a28917-7bb8-4a6c-a471-7a9951cd8002","name":"Deleted - Todo","type":"n8n-nodes-base.googleCalendarTrigger","typeVersion":1,"position":[-4320,4384],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}}],"connections":{"Google Calendar1":{"main":[[{"node":"Add extendedProperties to Google event6","type":"main","index":0}]]},"Add GCal ID":{"main":[[{"node":"Loop","type":"main","index":0}]]},"Remove GCal ID2":{"main":[[{"node":"Loop3","type":"main","index":0}]]},"Does it have a date?":{"main":[[{"node":"Does it have a time?","type":"main","index":0}],[{"node":"Loop3","type":"main","index":0}]]},"Does it have a time?":{"main":[[{"node":"Does it have an end date?1","type":"main","index":0}],[{"node":"Does it have an end date?3","type":"main","index":0}]]},"Delete event1":{"main":[[{"node":"Remove GCal ID2","type":"main","index":0}]]},"Does it have a date?1":{"main":[[{"node":"Does it have a time?1","type":"main","index":0}],[{"node":"No Operation, do nothing","type":"main","index":0}]]},"Does it have a time?1":{"main":[[{"node":"Does it have an end date?","type":"main","index":0}],[{"node":"Does it have an end date?2","type":"main","index":0}]]},"Find Task":{"main":[[{"node":"Remove GCal ID and Date","type":"main","index":0}]]},"Notion":{"main":[[{"node":"Merge","type":"main","index":0}]]},"Google Calendar3":{"main":[[{"node":"Add extendedProperties to Google event5","type":"main","index":0}]]},"Google Calendar":{"main":[[{"node":"Add extendedProperties to Google event4","type":"main","index":0}]]},"Add GCal ID3":{"main":[[{"node":"Loop2","type":"main","index":0}]]},"Does it have an end date?":{"main":[[{"node":"Loop2","type":"main","index":0}],[{"node":"Loop1","type":"main","index":0}]]},"Add GCal ID1":{"main":[[{"node":"Loop1","type":"main","index":0}]]},"Loop":{"main":[[],[{"node":"Add 1 day to end date1","type":"main","index":0}]]},"Loop1":{"main":[[],[{"node":"Google Calendar3","type":"main","index":0}]]},"Loop2":{"main":[[],[{"node":"Google Calendar","type":"main","index":0}]]},"Loop3":{"main":[[],[{"node":"Delete event1","type":"main","index":0}]]},"Creates defaultEndDate with 1h duration":{"main":[[{"node":"GCal_ID exists in Notion?","type":"main","index":0}]]},"Delete event2":{"main":[[{"node":"Loop4","type":"main","index":0}]]},"Loop4":{"main":[[],[{"node":"Delete event2","type":"main","index":0}]]},"Notion1":{"main":[[{"node":"Merge","type":"main","index":1}]]},"Does it have an end date?1":{"main":[[{"node":"Update dateTime event","type":"main","index":0}],[{"node":"Update dateTime event1","type":"main","index":0}]]},"Does it have an end date?2":{"main":[[{"node":"Loop","type":"main","index":0}],[{"node":"Loop5","type":"main","index":0}]]},"Google Calendar2":{"main":[[{"node":"Add extendedProperties to Google event7","type":"main","index":0}]]},"Add GCal ID2":{"main":[[{"node":"Loop5","type":"main","index":0}]]},"Loop5":{"main":[[],[{"node":"Google Calendar2","type":"main","index":0}]]},"GCal_ID exists in Notion?":{"main":[[{"node":"Is the page deleted?","type":"main","index":0}],[{"node":"Does it have a date?1","type":"main","index":0}]]},"Is the page deleted?":{"main":[[{"node":"Loop4","type":"main","index":0}],[{"node":"Does it have a date?","type":"main","index":0}]]},"Does it have an end date?3":{"main":[[{"node":"Add 1 day to end date","type":"main","index":0}],[{"node":"Update to All Day event2","type":"main","index":0}]]},"Add 1 day to end date":{"main":[[{"node":"Format date","type":"main","index":0}]]},"Format date":{"main":[[{"node":"Update to All Day event","type":"main","index":0}]]},"Update to All Day event":{"main":[[{"node":"Add extendedProperties to Google event2","type":"main","index":0}]]},"Update to All Day event2":{"main":[[{"node":"Add extendedProperties to Google event3","type":"main","index":0}]]},"Update dateTime event1":{"main":[[{"node":"Add extendedProperties to Google event1","type":"main","index":0}]]},"Add 1 day to end date1":{"main":[[{"node":"Format date1","type":"main","index":0}]]},"Format date1":{"main":[[{"node":"Google Calendar1","type":"main","index":0}]]},"Page edited by a user?":{"main":[[{"node":"Set some fields","type":"main","index":0}],[{"node":"Do nothing","type":"main","index":0}]]},"Calculate timeDifference between Google's updated_at  and our own updated_at fields":{"main":[[{"node":"Only events that were edited 2s after the last update","type":"main","index":0}]]},"Only events that were edited 2s after the last update":{"main":[[{"node":"Does it have a time?2","type":"main","index":0}]]},"Does it have a time?2":{"main":[[{"node":"Update page2 - continue on error","type":"main","index":0}],[{"node":"Subtract 1 day from end_date","type":"main","index":0}]]},"Subtract 1 day from end_date":{"main":[[{"node":"Format end_date","type":"main","index":0}]]},"Is it a new event?":{"main":[[{"node":"Does it have a time?3","type":"main","index":0}],[{"node":"Calculate timeDifference between Google's updated_at  and our own updated_at fields","type":"main","index":0}]]},"Format end_date":{"main":[[{"node":"Does it really have an end_date?","type":"main","index":0}]]},"Add extendedProperties to Google event4":{"main":[[{"node":"Add GCal ID3","type":"main","index":0}]]},"Add extendedProperties to Google event5":{"main":[[{"node":"Add GCal ID1","type":"main","index":0}]]},"Add extendedProperties to Google event6":{"main":[[{"node":"Add GCal ID","type":"main","index":0}]]},"Add extendedProperties to Google event7":{"main":[[{"node":"Add GCal ID2","type":"main","index":0}]]},"Does it really have an end_date?":{"main":[[{"node":"Update page - continue on error","type":"main","index":0}],[{"node":"Update page1 - continue on error","type":"main","index":0}]]},"Does it have a time?3":{"main":[[{"node":"Create page","type":"main","index":0}],[{"node":"Subtract 1 day from end_date1","type":"main","index":0}]]},"Subtract 1 day from end_date1":{"main":[[{"node":"Format end_date1","type":"main","index":0}]]},"Format end_date1":{"main":[[{"node":"Does it really have an end_date?1","type":"main","index":0}]]},"Does it really have an end_date?1":{"main":[[{"node":"Create page1","type":"main","index":0}],[{"node":"Create page2","type":"main","index":0}]]},"Create page1":{"main":[[{"node":"Add extendedProperties to Google event9","type":"main","index":0}]]},"Create page2":{"main":[[{"node":"Add extendedProperties to Google event10","type":"main","index":0}]]},"Globals":{"main":[[{"node":"Set the current database and calendar IDs","type":"main","index":0}]]},"Set the current database and calendar IDs":{"main":[[{"node":"Page edited by a user?","type":"main","index":0}]]},"Globals1":{"main":[[{"node":"Set the current database and calendar IDs1","type":"main","index":0}]]},"Globals2":{"main":[[{"node":"Set the current database and calendar IDs2","type":"main","index":0}]]},"Set the current database and calendar IDs2":{"main":[[{"node":"Find Task","type":"main","index":0}]]},"Event Updated":{"main":[[{"node":"Globals1","type":"main","index":0}]]},"When clicking \"Test workflow\"":{"main":[[{"node":"Notion1","type":"main","index":0},{"node":"Notion","type":"main","index":0}]]},"Event Created":{"main":[[{"node":"Globals1","type":"main","index":0}]]},"Find deleted pages1":{"main":[[{"node":"Delete event3","type":"main","index":0}]]},"Get future events1":{"main":[[{"node":"extendedProperties exist?","type":"main","index":0}]]},"Find related pages1":{"main":[[{"node":"Find deleted pages1","type":"main","index":0}]]},"extendedProperties exist?":{"main":[[{"node":"Find related pages1","type":"main","index":0}]]},"Set the current database and calendar IDs1":{"main":[[{"node":"Is it a new event?","type":"main","index":0}]]},"Create page":{"main":[[{"node":"Add extendedProperties to Google event8","type":"main","index":0}]]},"Update dateTime event":{"main":[[{"node":"Add extendedProperties to Google event","type":"main","index":0}]]},"Set some fields":{"main":[[{"node":"Creates defaultEndDate with 1h duration","type":"main","index":0}]]},"Event Updated1":{"main":[[{"node":"Globals1","type":"main","index":0}]]},"Event Created1":{"main":[[{"node":"Globals1","type":"main","index":0}]]},"Deleted - Meetings":{"main":[[{"node":"Globals2","type":"main","index":0}]]},"Globals3":{"main":[[{"node":"Split fields","type":"main","index":0}]]},"Split fields":{"main":[[{"node":"Only calendarId","type":"main","index":0}]]},"Only calendarId":{"main":[[{"node":"Get future events1","type":"main","index":0}]]},"Every 3min":{"main":[[{"node":"Globals3","type":"main","index":0}]]},"Page Updated - Meetings":{"main":[[{"node":"Globals","type":"main","index":0}]]},"Page Updated - Todo":{"main":[[{"node":"Globals","type":"main","index":0}]]},"Deleted - Todo":{"main":[[{"node":"Globals2","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":{"node:Every 3min":{"recurrenceRules":[]},"node:Event Updated":{"lastTimeChecked":"2025-08-20T11:53:49Z"},"node:Event Created":{"lastTimeChecked":"2025-08-20T11:53:59Z"},"node:Page Updated - Meetings":{"lastTimeChecked":"2025-08-20T11:53:00.000Z"},"node:Event Updated1":{"lastTimeChecked":"2025-08-20T11:53:32Z"},"node:Event Created1":{"lastTimeChecked":"2025-08-20T11:54:08Z"},"node:Deleted - Meetings":{"lastTimeChecked":"2025-08-20T11:53:35Z"},"node:Page Updated - Todo":{"lastTimeChecked":"2025-08-20T11:54:00.000Z"},"node:Deleted - Todo":{"lastTimeChecked":"2025-08-20T11:53:29Z"}},"meta":null,"pinData":{},"versionId":"a7dda5ed-e9ce-46a7-8be6-d1acd3751eb2","triggerCount":9,"tags":[],"shared":[{"createdAt":"2025-08-19T19:33:49.358Z","updatedAt":"2025-08-19T19:33:49.358Z","role":"workflow:owner","workflowId":"czqxETHdDwsxaQgs","projectId":"DQC8ik4pLkhZ4ZDm","project":{"createdAt":"2025-08-19T19:25:16.723Z","updatedAt":"2025-08-19T19:26:16.591Z","id":"DQC8ik4pLkhZ4ZDm","name":"Ben Hex <bhochster@gmail.com>","type":"personal","icon":null,"description":null}}]},{"createdAt":"2025-08-19T19:34:54.312Z","updatedAt":"2025-09-11T23:48:59.000Z","id":"swmMiBbBEtE8tBQj","name":"My workflow","active":false,"isArchived":true,"nodes":[{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $('GCal ID?').item.json.id }}","mode":"id"},"simple":false,"propertiesUi":{"propertyValues":[{"key":"GCal ID|rich_text","richText":true,"text":{"text":[{"text":"={{ $('Create done event').item.json.id }}","annotationUi":{}}]}},{"key":"Status|status","statusValue":"Done"}]},"options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[2192,688],"id":"25606257-2a5c-4d79-a437-dbcb5680bb4d","name":"Update a database page"},{"parameters":{"jsCode":"// For global static data:\nconst globalData = $getWorkflowStaticData('global');\n\n// Last run or default (24h ago)\nconst previous = globalData.lastRun\n  ? new Date(globalData.lastRun)\n  : new Date(Date.now() - 24 * 60 * 60 * 1000);\n\n// Add overlap (2 min)\nconst overlapMs = 2 * 60 * 1000;\nconst since = new Date(previous.getTime() - overlapMs);\n\n// --- helper: ISO with timezone offset (e.g. +03:00) ---\nfunction toLocalISO(d, timeZone = 'Asia/Jerusalem') {\n  const parts = new Intl.DateTimeFormat('sv-SE', {\n    timeZone, year: 'numeric', month: '2-digit', day: '2-digit',\n    hour: '2-digit', minute: '2-digit', second: '2-digit',\n    hour12: false\n  }).formatToParts(d).reduce((o, p) => (o[p.type] = p.value, o), {});\n  const local = `${parts.year}-${parts.month}-${parts.day}T${parts.hour}:${parts.minute}:${parts.second}`;\n\n  // compute offset of that zone at instant d\n  const offsetMin = Math.round((new Date(local + 'Z') - d) / 60000);\n  const sign = offsetMin <= 0 ? '+' : '-';\n  const abs = Math.abs(offsetMin);\n  const hh = String(Math.floor(abs / 60)).padStart(2, '0');\n  const mm = String(abs % 60).padStart(2, '0');\n  return `${local}${sign}${hh}:${mm}`;\n}\n\n// Output with SAME variable names as before:\nreturn [{\n  json: {\n    sinceISO: toLocalISO(since, 'Asia/Jerusalem'),\n    nowISO:   toLocalISO(new Date(), 'Asia/Jerusalem'),\n\n    // (optional for debugging)\n    // sinceUTC: since.toISOString(),\n    // nowUTC:   new Date().toISOString(),\n  }\n}];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[304,80],"id":"5da2eb3e-0672-4957-b1b5-c2033a984832","name":"Code"},{"parameters":{"resource":"databasePage","operation":"getAll","databaseId":{"__rl":true,"value":"24ddcbfd-8835-80fe-ab1d-fa7270343d5b","mode":"list","cachedResultName":"Meetings","cachedResultUrl":"https://www.notion.so/24ddcbfd883580feab1dfa7270343d5b"},"returnAll":true,"simple":false,"filterType":"json","filterJson":"={{ JSON.stringify({   timestamp: \"last_edited_time\",   last_edited_time: { on_or_after: $json.sinceISO } }) }}","options":{"sort":{"sortValue":[{"key":"Last edited time|last_edited_time","direction":"descending"}]}}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[96,480],"id":"0f768712-1b3d-4592-b998-7788d66cc859","name":"Get many database pages","credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"5286fd08-8b40-4e5b-9071-a7f264b1793a","leftValue":"={{ $json.last_edited_time }}","rightValue":"=2025-08-18T22:43:26","operator":{"type":"dateTime","operation":"after"}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[304,528],"id":"2d7750ca-7bf3-42d2-af12-a7fcf36b802f","name":"If"},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"8aee86fb-6ca2-4ed1-ac00-88413fcea64d","leftValue":"={{ $json.properties.Done.checkbox }}","rightValue":"","operator":{"type":"boolean","operation":"true","singleValue":true}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[960,560],"id":"fab2d11b-5900-4d29-b98d-d17b5651c1ad","name":"if UnDone"},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"9b1fc4f3-459b-49bb-b5bc-a906edfb2cf9","leftValue":"={{ $json.properties.Status.status.name }}","rightValue":"Done","operator":{"type":"string","operation":"notEquals"}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[960,816],"id":"5b22d6b4-2913-41c5-a232-a49880bbd14f","name":"if DONE"},{"parameters":{"calendar":{"__rl":true,"value":"e6902c0e03b7317fdd098a2256babe01abf439b3b62252c16a2379599371a636@group.calendar.google.com","mode":"list","cachedResultName":"testtt"},"start":"={{ $json.properties.Date.date.start }}","end":"={{ $json.properties.Date.date.end }}","additionalFields":{"summary":"={{ $json.properties.Name.title[0].text.content }}"}},"type":"n8n-nodes-base.googleCalendar","typeVersion":1.3,"position":[1696,688],"id":"19052333-e334-4f35-99bd-8fcda572a81a","name":"Create done event"},{"parameters":{"operation":"delete","calendar":{"__rl":true,"value":"85e8d827fde536807e1317e061a1fa3310c72c6050c933ec0e5d6e4df7bb96ee@group.calendar.google.com","mode":"list","cachedResultName":"todott"},"eventId":"={{ $('GCal ID?').item.json.properties['GCal ID'].rich_text[0].text.content }}","options":{}},"type":"n8n-nodes-base.googleCalendar","typeVersion":1.3,"position":[1872,688],"id":"b0325a4c-a248-4a59-9583-9fa3a8b044c7","name":"Delete undone event"},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"d2a2424b-0777-4d6a-baf8-dc6f1631af25","leftValue":"={{ $json.properties.Status.status.name }}","rightValue":"Done","operator":{"type":"string","operation":"notEquals"}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[1200,384],"id":"06436279-b708-42f6-bdc7-9a65965475f9","name":"If not \"DONE\""},{"parameters":{"calendar":{"__rl":true,"value":"85e8d827fde536807e1317e061a1fa3310c72c6050c933ec0e5d6e4df7bb96ee@group.calendar.google.com","mode":"list","cachedResultName":"todott"},"start":"={{ $json.properties.Date.date.start }}","end":"={{ $json.properties.Date.date.end }}","additionalFields":{"summary":"={{ $json.properties.Name.title[0].text.content }}"}},"type":"n8n-nodes-base.googleCalendar","typeVersion":1.3,"position":[1504,416],"id":"20251697-ea14-430b-8dd7-70665dd80631","name":"Create undone event"},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $('GCal ID?').item.json.id }}","mode":"id"},"simple":false,"propertiesUi":{"propertyValues":[{"key":"GCal ID|rich_text","richText":true,"text":{"text":[{"text":"={{ $('Create undone event').item.json.id }}","annotationUi":{}}]}},{"key":"Status|status","statusValue":"Not started"},{"key":"Status|status","statusValue":"Not started"}]},"options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[1904,464],"id":"26832f1b-a130-45bc-8995-94b6140ff726","name":"Update a database page1"},{"parameters":{"operation":"delete","calendar":{"__rl":true,"value":"e6902c0e03b7317fdd098a2256babe01abf439b3b62252c16a2379599371a636@group.calendar.google.com","mode":"list","cachedResultName":"testtt"},"eventId":"={{ $('GCal ID?').item.json.properties['GCal ID'].rich_text[0].text.content }}","options":{}},"type":"n8n-nodes-base.googleCalendar","typeVersion":1.3,"position":[1696,416],"id":"80673191-ff39-48d7-8b35-3175fb0252b4","name":"Delete done event"},{"parameters":{"inputSource":"passthrough"},"type":"n8n-nodes-base.executeWorkflowTrigger","typeVersion":1.1,"position":[48,64],"id":"3f1cbb90-f0b7-4883-bc92-d85ca274d52c","name":"When Executed by Another Workflow"},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"a6208732-600b-4649-b339-2f37723a97e8","leftValue":"={{ $json.properties['GCal ID']?.rich_text?.[0]?.plain_text || '' }}","rightValue":"","operator":{"type":"string","operation":"notEmpty","singleValue":true}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[1376,192],"id":"94ec7f44-79b6-4708-99c6-3b169e9af23a","name":"GCal ID?1"},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"a6208732-600b-4649-b339-2f37723a97e8","leftValue":"={{ $json.properties['GCal ID']?.rich_text?.[0]?.plain_text || '' }}","rightValue":"","operator":{"type":"string","operation":"notEmpty","singleValue":true}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[1536,880],"id":"53b9a447-814d-434a-966f-d91aba410acc","name":"GCal ID?2"},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"a6208732-600b-4649-b339-2f37723a97e8","leftValue":"={{ $json.properties['GCal ID']?.rich_text?.[0]?.plain_text || '' }}","rightValue":"","operator":{"type":"string","operation":"notEmpty","singleValue":true}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[704,480],"id":"f3bef083-6e61-4784-8c1b-f78f9b8878d2","name":"GCal ID?"},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $json.id }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"Status|status","statusValue":"Done"}]},"options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[1744,976],"id":"d65761e6-f73f-4a40-80f3-57094852809d","name":"Update a database page2"},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $json.id }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"Status|status","statusValue":"Not started"}]},"options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[1648,192],"id":"37979ebb-1d7f-4f88-b2ea-d9992e08fc5f","name":"Update a database page3"},{"parameters":{"jsCode":"const globalData = $getWorkflowStaticData('global');\n\n// We assume all items share the same nowISO from Init node\nif (items.length > 0 && items[0].json.nowISO) {\n  globalData.lastRun = items[0].json.nowISO;\n} else {\n  globalData.lastRun = new Date().toISOString();\n}\n\nreturn items;"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[2320,448],"id":"57358df7-9f1f-4530-99ea-3813efe5b354","name":"Save lastrun"}],"connections":{"Code":{"main":[[{"node":"Get many database pages","type":"main","index":0}]]},"Get many database pages":{"main":[[]]},"Update a database page":{"main":[[{"node":"Save lastrun","type":"main","index":0}]]},"If":{"main":[[{"node":"GCal ID?","type":"main","index":0}]]},"if UnDone":{"main":[[{"node":"if DONE","type":"main","index":0}],[{"node":"If not \"DONE\"","type":"main","index":0}]]},"if DONE":{"main":[[{"node":"GCal ID?2","type":"main","index":0}]]},"Create done event":{"main":[[{"node":"Delete undone event","type":"main","index":0}]]},"Delete undone event":{"main":[[{"node":"Update a database page","type":"main","index":0}]]},"If not \"DONE\"":{"main":[[],[{"node":"GCal ID?1","type":"main","index":0}]]},"Create undone event":{"main":[[{"node":"Delete done event","type":"main","index":0}]]},"Update a database page1":{"main":[[{"node":"Save lastrun","type":"main","index":0}]]},"Delete done event":{"main":[[{"node":"Update a database page1","type":"main","index":0}]]},"When Executed by Another Workflow":{"main":[[{"node":"Code","type":"main","index":0}]]},"GCal ID?1":{"main":[[{"node":"Create undone event","type":"main","index":0}],[{"node":"Update a database page3","type":"main","index":0}]]},"GCal ID?2":{"main":[[{"node":"Create done event","type":"main","index":0}],[{"node":"Update a database page2","type":"main","index":0}]]},"GCal ID?":{"main":[[{"node":"if UnDone","type":"main","index":0}],[{"node":"if UnDone","type":"main","index":0}]]},"Update a database page2":{"main":[[{"node":"Save lastrun","type":"main","index":0}]]},"Update a database page3":{"main":[[{"node":"Save lastrun","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":null,"pinData":{},"versionId":"3b032c68-1ed7-4ce0-8ed8-2da33c4fd4f2","triggerCount":0,"tags":[],"shared":[{"createdAt":"2025-08-19T19:34:54.314Z","updatedAt":"2025-08-19T19:34:54.314Z","role":"workflow:owner","workflowId":"swmMiBbBEtE8tBQj","projectId":"DQC8ik4pLkhZ4ZDm","project":{"createdAt":"2025-08-19T19:25:16.723Z","updatedAt":"2025-08-19T19:26:16.591Z","id":"DQC8ik4pLkhZ4ZDm","name":"Ben Hex <bhochster@gmail.com>","type":"personal","icon":null,"description":null}}]},{"createdAt":"2025-08-19T22:46:56.689Z","updatedAt":"2025-08-20T11:43:27.000Z","id":"4NOULgaJ9JlTz9ft","name":"From Todo to done","active":false,"isArchived":true,"nodes":[{"parameters":{"operation":"archive","pageId":{"__rl":true,"value":"={{ $json.id }}","mode":"id"},"simple":false},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[144,0],"id":"324df821-8eb6-4aaf-a4a2-d3b66f5c3508","name":"Archive page","credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"resource":"databasePage","operation":"getAll","databaseId":{"__rl":true,"value":"254dcbfd-8835-80f1-8b1e-c6a6b722693d","mode":"list","cachedResultName":"TodoTEST","cachedResultUrl":"https://www.notion.so/254dcbfd883580f18b1ec6a6b722693d"},"returnAll":true,"simple":false,"options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-352,0],"id":"d17250c6-b01d-4b9a-8751-45543467803c","name":"Get many database pages","credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"rule":{"interval":[{}]}},"type":"n8n-nodes-base.scheduleTrigger","typeVersion":1.2,"position":[-544,0],"id":"3dad95fc-8361-41d6-ba36-620177767f0d","name":"Schedule Trigger"},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"03bb513c-4bd9-4806-b1da-f7b6f1f82021","leftValue":"={{ $json.properties.Done.checkbox }}","rightValue":"","operator":{"type":"boolean","operation":"true","singleValue":true}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[-144,0],"id":"869f790c-7ecb-4ead-9e98-4b7197cba191","name":"If"},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"254dcbfd-8835-8097-bdbc-da4d65758e26","mode":"list","cachedResultName":"Done","cachedResultUrl":"https://www.notion.so/254dcbfd88358097bdbcda4d65758e26"},"simple":false,"propertiesUi":{"propertyValues":[{"key":"Name|title","title":"={{ $json.properties.Name.title[0].plain_text }}"},{"key":"Done|checkbox","checkboxValue":true},{"key":"Date|date","range":true,"dateStart":"={{ $json.properties.Date.date.start }}","dateEnd":"={{ $json.properties.Date.date.end }}"}]},"options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[352,0],"id":"e70df7b8-0622-4def-bf25-d3c6be549fbf","name":"Create a database page","credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}}],"connections":{"Get many database pages":{"main":[[{"node":"If","type":"main","index":0}]]},"Schedule Trigger":{"main":[[{"node":"Get many database pages","type":"main","index":0}]]},"If":{"main":[[{"node":"Archive page","type":"main","index":0}]]},"Archive page":{"main":[[{"node":"Create a database page","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":{"templateCredsSetupCompleted":true},"pinData":{},"versionId":"b6d26116-8d93-42a1-8734-d2d659987046","triggerCount":0,"tags":[],"shared":[{"createdAt":"2025-08-19T22:46:56.692Z","updatedAt":"2025-08-19T22:46:56.692Z","role":"workflow:owner","workflowId":"4NOULgaJ9JlTz9ft","projectId":"DQC8ik4pLkhZ4ZDm","project":{"createdAt":"2025-08-19T19:25:16.723Z","updatedAt":"2025-08-19T19:26:16.591Z","id":"DQC8ik4pLkhZ4ZDm","name":"Ben Hex <bhochster@gmail.com>","type":"personal","icon":null,"description":null}}]},{"createdAt":"2025-08-20T11:44:13.310Z","updatedAt":"2025-09-11T23:48:56.000Z","id":"JFLHWzg1W7bcjZD9","name":"My workflow 2","active":false,"isArchived":true,"nodes":[{"parameters":{},"type":"n8n-nodes-base.manualTrigger","typeVersion":1,"position":[0,0],"id":"50c0c105-5c70-493d-b2c5-4c920627090c","name":"When clicking ‘Execute workflow’"},{"parameters":{"resource":"database","databaseId":{"__rl":true,"value":"255dcbfd-8835-8070-8923-f4087fa4226a","mode":"list","cachedResultName":"Todo Dummy","cachedResultUrl":"https://www.notion.so/255dcbfd883580708923f4087fa4226a"}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[208,0],"id":"1166d75a-355e-4b5a-ace9-8bc6f8c434c2","name":"Get a database","credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}}],"connections":{"When clicking ‘Execute workflow’":{"main":[[{"node":"Get a database","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":{"templateCredsSetupCompleted":true},"pinData":{},"versionId":"fa07be79-0eb8-4d7b-b29c-652eefcea587","triggerCount":0,"tags":[],"shared":[{"createdAt":"2025-08-20T11:44:13.313Z","updatedAt":"2025-08-20T11:44:13.313Z","role":"workflow:owner","workflowId":"JFLHWzg1W7bcjZD9","projectId":"DQC8ik4pLkhZ4ZDm","project":{"createdAt":"2025-08-19T19:25:16.723Z","updatedAt":"2025-08-19T19:26:16.591Z","id":"DQC8ik4pLkhZ4ZDm","name":"Ben Hex <bhochster@gmail.com>","type":"personal","icon":null,"description":null}}]},{"createdAt":"2025-08-20T12:46:36.339Z","updatedAt":"2025-08-28T10:19:51.000Z","id":"B0rji0ynpsVFh0p9","name":"My workflow 3","active":false,"isArchived":true,"nodes":[{"parameters":{"calendar":{"__rl":true,"value":"={{ $json.properties['GCal Calendar ID']?.rich_text?.[0]?.plain_text || $json.Globals.calendarId }}","mode":"id"},"start":"={{ $json.notionDate.date.start }}","end":"={{ $json.endDateTime_Adjusted }}","additionalFields":{"allday":"yes","description":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>","summary":"={{ $json[\"notionName\"] }}"}},"id":"e5776232-a61f-443c-804c-d51610227706","name":"Google Calendar1","type":"n8n-nodes-base.googleCalendar","typeVersion":1,"position":[-208,2480],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $('Loop').item.json.notionID }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"GCal ID|rich_text","textContent":"={{ $json.id }}"}]},"options":{}},"id":"1bc239a1-8a11-46a0-a87e-61c44f112840","name":"Add GCal ID","type":"n8n-nodes-base.notion","typeVersion":2,"position":[208,2480],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{},"id":"2cee0e44-b513-4c68-8a17-53b6cf6b6ec1","name":"No Operation, do nothing","type":"n8n-nodes-base.noOp","typeVersion":1,"position":[-1360,2400]},{"parameters":{"content":"# Create event","height":80,"width":288.259119644621,"color":7},"id":"50b6bddc-be31-417e-9808-f507ee8de448","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-1888,2304]},{"parameters":{"content":"# Update Event","height":80,"width":299.54925745153224,"color":7},"id":"a4b05f97-3ccc-421f-b104-e0618ba931a8","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-2208,768]},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $('Loop3').item.json.notionID }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"GCal ID|rich_text"}]},"options":{}},"id":"2d6e5b31-b46a-44e5-ae5d-0568a21be420","name":"Remove GCal ID2","type":"n8n-nodes-base.notion","typeVersion":2,"position":[208,1232],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"content":"## This flow deletes GCal ID and Date, when the event is cancelled in Google.","height":162.57090146831365,"width":256.72937811647864,"color":7},"id":"164a8da1-1635-4d79-b91a-5ea4b1f5347d","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4688,4464]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date }}","operation":"isNotEmpty"}]}},"id":"926a94f2-3571-49fc-9806-1bcde2d6984c","name":"Does it have a date?","type":"n8n-nodes-base.if","typeVersion":1,"position":[-1584,784]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date.start }}","operation":"contains","value2":"T"}]}},"id":"f9404247-0cba-4ca3-a054-81800ac43e39","name":"Does it have a time?","type":"n8n-nodes-base.if","typeVersion":1,"position":[-1184,688]},{"parameters":{"operation":"delete","calendar":{"__rl":true,"value":"={{ $json.properties['GCal Calendar ID']?.rich_text?.[0]?.plain_text || $json.Globals.calendarId }}","mode":"id"},"eventId":"={{ $json.GCal_ID }}","options":{}},"id":"7e0effb4-0c21-4d16-b47b-df843eace99a","name":"Delete event1","type":"n8n-nodes-base.googleCalendar","typeVersion":1,"position":[0,1232],"alwaysOutputData":false,"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date }}","operation":"isNotEmpty"}]}},"id":"a5d69a83-f01a-44a9-bb33-ec16f200b3c2","name":"Does it have a date?1","type":"n8n-nodes-base.if","typeVersion":1,"position":[-1584,2304]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date.start }}","operation":"contains","value2":"T"}]}},"id":"db27f3d7-d63e-40d1-91f4-5803f85959ba","name":"Does it have a time?1","type":"n8n-nodes-base.if","typeVersion":1,"position":[-1360,2240]},{"parameters":{"resource":"databasePage","operation":"getAll","databaseId":{"__rl":true,"value":"={{ $json.Globals.databaseId }}","mode":"id"},"returnAll":true,"filterType":"manual","filters":{"conditions":[{"key":"GCal ID|rich_text","condition":"equals","richTextValue":"={{ $json.id }}"}]},"options":{}},"id":"253a6181-bd9d-4cdb-b287-3aca5f5746cb","name":"Find Task","type":"n8n-nodes-base.notion","typeVersion":2,"position":[-3264,4704],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $json.id }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"GCal ID|rich_text"},{"key":"Date|date"}]},"options":{}},"id":"520c2f7a-1997-4865-a766-102aaae86a6b","name":"Remove GCal ID and Date","type":"n8n-nodes-base.notion","typeVersion":2,"position":[-3024,4704],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"resource":"databasePage","operation":"getAll","databaseId":{"__rl":true,"value":"dad4835c-1acc-4209-aac2-11440b13c475","mode":"list","cachedResultName":"Tasks","cachedResultUrl":"https://www.notion.so/dad4835c1acc4209aac211440b13c475"},"returnAll":true,"simple":false,"filterType":"manual","matchType":"allFilters","filters":{"conditions":[{"key":"Data|date","condition":"is_not_empty"},{"key":"Status|status","condition":"does_not_equal","statusValue":"Done"},{"key":"Status|status","condition":"does_not_equal","statusValue":"Archived"}]},"options":{}},"id":"b9ca38d4-4b26-4add-9c7d-4f7df386a77a","name":"Notion","type":"n8n-nodes-base.notion","typeVersion":2.1,"position":[-5376,1504],"disabled":true},{"parameters":{"calendar":{"__rl":true,"value":"={{ $json.properties['GCal Calendar ID']?.rich_text?.[0]?.plain_text || $json.Globals.calendarId }}","mode":"id"},"start":"={{ $json.notionDate.date.start }}","end":"={{ $json.defaultEndDate }}","additionalFields":{"allday":"no","description":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>","summary":"={{ $json.notionName }}"}},"id":"583e141f-22b4-4a0c-bd72-dfef65f9992f","name":"Google Calendar3","type":"n8n-nodes-base.googleCalendar","typeVersion":1,"position":[-208,2128],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"calendar":{"__rl":true,"value":"={{ $json.properties['GCal Calendar ID']?.rich_text?.[0]?.plain_text || $json.Globals.calendarId }}","mode":"id"},"start":"={{ $json.notionDate.date.start }}","end":"={{ $json.notionDate.date.end }}","additionalFields":{"allday":"no","description":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>","summary":"={{ $json.notionName }}"}},"id":"3f56c229-830d-4e71-b603-1aff0ca2492d","name":"Google Calendar","type":"n8n-nodes-base.googleCalendar","typeVersion":1,"position":[-208,1888],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $('Loop2').item.json.notionID }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"GCal ID|rich_text","textContent":"={{ $json.id }}"}]},"options":{}},"id":"99df3f0b-3a79-46ba-a70d-bafaccacb1e3","name":"Add GCal ID3","type":"n8n-nodes-base.notion","typeVersion":2,"position":[208,1888],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date.end }}","operation":"isNotEmpty"}]}},"id":"3840e5af-f658-432f-b250-3b7ad16904af","name":"Does it have an end date?","type":"n8n-nodes-base.if","typeVersion":1,"position":[-1040,2032]},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $('Loop1').item.json.notionID }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"GCal ID|rich_text","textContent":"={{ $json.id }}"}]},"options":{}},"id":"5b42fc7f-afaf-45b5-8fe9-e4a0f4d7b88d","name":"Add GCal ID1","type":"n8n-nodes-base.notion","typeVersion":2,"position":[208,2128],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"options":{"reset":false}},"id":"12d79092-730d-4cbd-a179-e376a20e3389","name":"Loop","type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[-784,2480]},{"parameters":{"options":{"reset":false}},"id":"5dcff09d-a7fb-42a9-a11d-73769140d1c7","name":"Loop1","type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[-400,2128]},{"parameters":{"options":{"reset":false}},"id":"d1908cb4-a8db-4614-b260-acba721b8924","name":"Loop2","type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[-400,1888]},{"parameters":{"options":{"reset":false}},"id":"49ca331a-335a-4b29-a999-f5d78f559b4f","name":"Loop3","type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[-208,1232]},{"parameters":{"content":"## Choose your default event duration\nWhen pushing an event from Notion to Google Calendar, what is going to be the default duration?","height":334.192512604689,"width":259.7926186615935},"id":"1d44683c-5f8c-4648-ad55-f501d890dbe2","name":"Sticky Note11","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-2784,1472]},{"parameters":{"operation":"addToDate","magnitude":"={{ $json.notionDate.date.start }}","timeUnit":"hours","duration":1,"outputFieldName":"defaultEndDate","options":{"includeInputFields":true}},"id":"d8c0208c-350c-48fe-8aee-72bccc75d3c9","name":"Creates defaultEndDate with 1h duration","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-2704,1632]},{"parameters":{"content":"## Use these nodes for testing\nReplace the Notion \"Page Updated\" trigger by these 4 nodes to help simulate the behavior of the trigger.\n\nYou can create different filters and enable or disable the upper and lower nodes, depending on what tasks you need to test.\n\nThe only pages that won't work during testing are the deleted ones.","height":632.2029116375359,"width":880.8180923381184},"id":"7cdeb1f2-9aa4-481d-ae9e-77d8c251e5b1","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-5760,1264]},{"parameters":{"operation":"delete","calendar":{"__rl":true,"value":"={{ $json.properties['GCal Calendar ID']?.rich_text?.[0]?.plain_text || $json.Globals.calendarId }}","mode":"id"},"eventId":"={{ $json.GCal_ID }}","options":{}},"id":"b1c97113-a7ca-4978-94db-e3371d1df470","name":"Delete event2","type":"n8n-nodes-base.googleCalendar","typeVersion":1,"position":[208,0],"alwaysOutputData":false,"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"options":{"reset":false}},"id":"76fb89ee-e07f-4d76-993e-e24fb1962c60","name":"Loop4","type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[0,0]},{"parameters":{"resource":"databasePage","operation":"getAll","databaseId":{"__rl":true,"value":"dad4835c-1acc-4209-aac2-11440b13c475","mode":"list","cachedResultName":"Tasks","cachedResultUrl":"https://www.notion.so/dad4835c1acc4209aac211440b13c475"},"returnAll":true,"simple":false,"filterType":"manual","matchType":"allFilters","filters":{"conditions":[{"key":"GCal ID|rich_text","condition":"is_not_empty"},{"key":"Status|status","condition":"does_not_equal","statusValue":"Done"},{"key":"Status|status","condition":"does_not_equal","statusValue":"Archived"}]},"options":{}},"id":"a09fd245-a378-4497-a8e8-c07d363594a1","name":"Notion1","type":"n8n-nodes-base.notion","typeVersion":2.1,"position":[-5376,1664],"disabled":true},{"parameters":{"mode":"combine","mergeByFields":{"values":[{"field1":"id","field2":"id"}]},"joinMode":"keepEverything","options":{}},"id":"ffe30ffc-d0ca-460b-8be3-6409d671e1c6","name":"Merge","type":"n8n-nodes-base.merge","typeVersion":2.1,"position":[-5088,1584],"disabled":true},{"parameters":{"content":"## Add one trigger for each Notion database that you want to sync","height":702.7054859554116,"width":289.07844289683123},"id":"1f14412c-9917-4d11-8674-a4f69d85ee49","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4416,1200]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date.end }}","operation":"isNotEmpty"}]}},"id":"0aedd66d-7e02-4eb5-bfac-fb7cc2264f1a","name":"Does it have an end date?1","type":"n8n-nodes-base.if","typeVersion":1,"position":[-896,480]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date.end }}","operation":"isNotEmpty"}]}},"id":"18bf5ae3-35ee-45c5-af80-415eedc6c475","name":"Does it have an end date?2","type":"n8n-nodes-base.if","typeVersion":1,"position":[-1040,2624]},{"parameters":{"calendar":{"__rl":true,"value":"={{ $json.properties['GCal Calendar ID']?.rich_text?.[0]?.plain_text || $json.Globals.calendarId }}","mode":"id"},"start":"={{ $json.notionDate.date.start }}","end":"={{ $json.notionDate.date.start }}","additionalFields":{"allday":"yes","description":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>","summary":"={{ $json[\"notionName\"] }}"}},"id":"453637c9-c15f-4141-9c9d-c82b691edadf","name":"Google Calendar2","type":"n8n-nodes-base.googleCalendar","typeVersion":1,"position":[-208,2720],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $('Loop5').item.json.notionID }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"GCal ID|rich_text","textContent":"={{ $json.id }}"}]},"options":{}},"id":"cca23546-1002-4048-b174-beaafc52cff0","name":"Add GCal ID2","type":"n8n-nodes-base.notion","typeVersion":2,"position":[208,2720],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"content":"## YYYY-MM-DD","height":80,"width":190.88107700739067,"color":7},"id":"81598405-2019-4200-918b-087b127ed147","name":"Sticky Note18","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,2752]},{"parameters":{"options":{"reset":false}},"id":"378fe2af-a20f-4398-ac6a-694815e931af","name":"Loop5","type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[-400,2720]},{"parameters":{"content":"## YYYY-MM-DD\n## YYYY-MM-DD","height":96.35243080295625,"width":190.88107700739073,"color":7},"id":"f3ccfc78-520f-400f-a9bf-35f8c9abb1c8","name":"Sticky Note19","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,2512]},{"parameters":{"content":"## YYYY-MM-DD T HH:MM:SS-Z\n## YYYY-MM-DD T HH:MM:SS-Z","height":96.35243080295625,"width":364.9229338011439,"color":7},"id":"d33c6200-7b75-40f5-945b-6076a1ee44c6","name":"Sticky Note20","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,1888]},{"parameters":{"content":"## YYYY-MM-DD T HH:MM:SS-Z","height":80,"width":359.18646169567,"color":7},"id":"61564e8e-d6c1-4d1b-aae0-4970f9078e26","name":"Sticky Note21","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,2144]},{"parameters":{"content":"## YYYY-MM-DD","height":80,"width":190.88107700739067,"color":7},"id":"73e52a92-8192-4ca5-837f-cdca097a88c5","name":"Sticky Note26","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,960]},{"parameters":{"content":"## YYYY-MM-DD\n## YYYY-MM-DD","height":96.35243080295625,"width":190.88107700739073,"color":7},"id":"69251fd9-79b2-4911-b518-6d6e59768c8a","name":"Sticky Note27","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,768]},{"parameters":{"content":"## YYYY-MM-DD T HH:MM:SS-Z\n## YYYY-MM-DD T HH:MM:SS-Z","height":109.18668977858542,"width":364.9229338011439,"color":7},"id":"4906ec1c-a1cb-41f0-8e0e-086582648f53","name":"Sticky Note28","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,352]},{"parameters":{"content":"## YYYY-MM-DD T HH:MM:SS-Z","height":83.20856474390726,"width":359.18646169567,"color":7},"id":"b1cc0404-8d83-4738-96da-b748ff6ddc88","name":"Sticky Note29","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,544]},{"parameters":{"content":"## Runs when page is deleted in Notion","height":96.35243080295625,"width":364.9229338011439,"color":7},"id":"2499fa73-36a8-4565-824f-a8a9ff82ff91","name":"Sticky Note31","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,0]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.GCal_ID }}","operation":"isNotEmpty"}]}},"id":"9b7b0834-6868-4ffd-8601-d3cfbe8d16a0","name":"GCal_ID exists in Notion?","type":"n8n-nodes-base.if","typeVersion":1,"position":[-2400,1632]},{"parameters":{"conditions":{"boolean":[{"value1":"={{ $json.in_trash }}","value2":"={{ true }}"}]}},"id":"5fe3563b-ea99-42ed-aed5-96ce18fccf18","name":"Is the page deleted?","type":"n8n-nodes-base.if","typeVersion":1,"position":[-1888,768]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date.end }}","operation":"isNotEmpty"}]}},"id":"1a0ce999-e480-4499-9632-024d49435fe1","name":"Does it have an end date?3","type":"n8n-nodes-base.if","typeVersion":1,"position":[-896,784]},{"parameters":{"content":"## Runs when date is cleared in Notion","height":96.35243080295625,"width":364.9229338011439,"color":7},"id":"fc69ca5f-3661-4f9d-8953-61d166cacecc","name":"Sticky Note33","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,1232]},{"parameters":{"operation":"addToDate","magnitude":"={{ $json.notionDate.date.end.toDateTime() }}","duration":1,"outputFieldName":"endDateTime_Adjusted","options":{"includeInputFields":true}},"id":"9f3f1dc9-cac2-4f88-87d1-0313753ffbf8","name":"Add 1 day to end date","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-400,768],"notesInFlow":true,"notes":"Google Calendar and Notion handle end dates differently, when there's no time set.\n\nIf a date in Notion is from Nov-10 to Nov-12, in Google it will show \"Nov-10 at 00:00\" to \"Nov-12 at 00:00\".\nMeaning the event would end at the beggining of the day in Nov-12, not lasting all day.\n\nSo to make an event last all day in Nov-12 you have to make the end_date \"Nov-13 at 00:00\"."},{"parameters":{"operation":"formatDate","date":"={{ $json.endDateTime_Adjusted }}","format":"yyyy-MM-dd","outputFieldName":"endDate_Adjusted","options":{"includeInputFields":true}},"id":"d87e6380-e5d5-462c-9a5b-459c40597e3c","name":"Format date","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-208,768]},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $json.Globals.calendarId }}/events/{{ $json.GCal_ID }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"bodyParameters":{"parameters":[{"name":"start","value":"={{ {\n  \"dateTime\": null,\n  \"date\": $json.notionDate.date.start\n} }}"},{"name":"end","value":"={{ {\n  \"dateTime\": null,\n  \"date\": $json.endDate_Adjusted\n} }}"},{"name":"summary","value":"={{ $json.notionName }}"},{"name":"status","value":"confirmed"},{"name":"description","value":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>"}]},"options":{}},"id":"aeb610dd-14a9-406d-b8d9-7e59cfe758c2","name":"Update to All Day event","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[0,768],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $json.Globals.calendarId }}/events/{{ $json.GCal_ID }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"bodyParameters":{"parameters":[{"name":"start","value":"={{ {\n  \"dateTime\": null,\n  \"date\": $json.notionDate.date.start\n} }}"},{"name":"end","value":"={{ {\n  \"dateTime\": null,\n  \"date\": $json.notionDate.date.start\n} }}"},{"name":"summary","value":"={{ $json.notionName }}"},{"name":"status","value":"confirmed"},{"name":"description","value":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>"}]},"options":{}},"id":"5c2ba5c8-441d-4379-91c7-51e1bc220c23","name":"Update to All Day event2","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[0,960],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $json.Globals.calendarId }}/events/{{ $json.GCal_ID }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"bodyParameters":{"parameters":[{"name":"start","value":"={{ {\n  \"dateTime\": $json.notionDate.date.start,\n  \"date\": null\n} }}"},{"name":"end","value":"={{ {\n  \"dateTime\": $json.defaultEndDate,\n  \"date\": null\n} }}"},{"name":"summary","value":"={{ $json.notionName }}"},{"name":"status","value":"confirmed"},{"name":"description","value":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>"}]},"options":{}},"id":"877a78ac-755f-4d1b-bb7e-a895ccf86ee9","name":"Update dateTime event1","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[0,528],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"operation":"addToDate","magnitude":"={{ $json.notionDate.date.end.toDateTime() }}","duration":1,"outputFieldName":"endDateTime_Adjusted","options":{"includeInputFields":true}},"id":"d988ca7d-9ed1-4882-920d-e55ac55db228","name":"Add 1 day to end date1","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-576,2480],"notesInFlow":true,"notes":"Google Calendar and Notion handle end dates differently, when there's no time set.\n\nIf a date in Notion is from Nov-10 to Nov-12, in Google it will show \"Nov-10 at 00:00\" to \"Nov-12 at 00:00\".\nMeaning the event would end at the beggining of the day in Nov-12, not lasting all day.\n\nSo to make an event last all day in Nov-12 you have to make the end_date \"Nov-13 at 00:00\"."},{"parameters":{"operation":"formatDate","date":"={{ $json.endDateTime_Adjusted }}","format":"yyyy-MM-dd","outputFieldName":"endDate_Adjusted","options":{"includeInputFields":true}},"id":"54efd18d-bee1-44b3-94c2-b8a24b675450","name":"Format date1","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-400,2480]},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":1},"conditions":[{"id":"7bcd3c8e-bdae-43d7-9023-a089298db558","leftValue":"={{ $json.last_edited_by.id }}","rightValue":"={{ $json.Globals.n8nConnectionUserId }}","operator":{"type":"string","operation":"equals"}}],"combinator":"and"},"options":{}},"id":"a989d4aa-2268-437b-ac96-43a9d7148178","name":"Page edited by a user?","type":"n8n-nodes-base.if","typeVersion":2,"position":[-3216,1648],"notesInFlow":true,"notes":"This prevents infinite loops of pages being edited by n8n and triggering the workflow again and again.\nIt will only update Google Calendar events when a user edits the Notion pages."},{"parameters":{},"id":"80b2c29f-5db7-4863-a266-3031f717530a","name":"Do nothing","type":"n8n-nodes-base.noOp","typeVersion":1,"position":[-2976,1824]},{"parameters":{"operation":"getAll","calendar":{"__rl":true,"value":"72fb857fe78a97c9ad2d361a2b433518df6549ac7149192c8cca38c73b919eca@group.calendar.google.com","mode":"list","cachedResultName":"Notion Tasks"},"returnAll":true,"options":{"timeMin":"={{ $today.minus(1, 'days') }}"}},"id":"41853d08-955c-4994-866b-a803067ff8cc","name":"Get future events + yesterday","type":"n8n-nodes-base.googleCalendar","typeVersion":1.1,"position":[-5344,3392],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}},"disabled":true},{"parameters":{"content":"# Notion ➡ Google","height":80,"width":339.3724182117961,"color":7},"id":"604622a9-4e29-481e-97ad-84a2cb943785","name":"Sticky Note9","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4448,1104]},{"parameters":{"content":"# Google ➡ Notion","height":87.25811154533459,"width":329.84653344771755,"color":7},"id":"610cf50a-6e05-4119-9fcb-95101a973317","name":"Sticky Note10","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4416,3168]},{"parameters":{"operation":"getTimeBetweenDates","startDate":"={{ $json.extendedProperties.shared.lastUpdatedByAutomation }}","endDate":"={{ $json.updated }}","units":["second"],"options":{"includeInputFields":true}},"id":"dc205973-4b46-4c3a-91fa-efcd34999d33","name":"Calculate timeDifference between Google's updated_at  and our own updated_at fields","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-2784,3904]},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"b2b768dd-1682-42c2-9b6a-cd30a25415ba","leftValue":"={{ $json.timeDifference.seconds }}","rightValue":2,"operator":{"type":"number","operation":"gt"}}],"combinator":"and"},"options":{}},"id":"d4583456-f93c-45ff-8503-6103a3d23b9d","name":"Only events that were edited 2s after the last update","type":"n8n-nodes-base.filter","typeVersion":2,"position":[-2576,3904],"notesInFlow":true,"notes":"This prevents an infinite loop.\n\nWhen you edit your Notion page, our automation edits the Google event. This would activate the Google trigger again and again.\n\nUsing the field \"lastUpdatedByAutomation\" we can check if the update happened after our automation ran. Meaning the user was the one that edited the event."},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.start.dateTime }}","operation":"contains","value2":"T"}]}},"id":"8f23e48f-42f3-4a1b-ba46-1fbd9484dcf7","name":"Does it have a time?2","type":"n8n-nodes-base.if","typeVersion":1,"position":[-2368,3904]},{"parameters":{"operation":"subtractFromDate","magnitude":"={{ $json.end.date }}","duration":1,"outputFieldName":"notionDateTimeEnd","options":{"includeInputFields":true}},"id":"bb40aaf2-60eb-45ae-af0a-10d8c8500633","name":"Subtract 1 day from end_date","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-2144,4000],"notesInFlow":true,"notes":"Google Calendar and Notion handle end dates differently, when there's no time set.\n\nIf a date in Notion is from Nov-10 to Nov-12, in Google it will show \"Nov-10 at 00:00\" to \"Nov-12 at 00:00\".\n\nWhen you set an event in Google from Nov-12 to Nov-13, it sets the end date to \"Nov-14 at 00:00\" behind the scenes.\nMeaning the event would end at the beggining of Nov-14, lasting all day long during Nov-13.\n\nBut Notion considers Nov-12 to Nov-13 already as all day dates.\nSo Nov-14 in Google must be Nov-13 in Notion."},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"817652c4-64ad-45d7-800a-c58e2e23f9cc","leftValue":"={{ $json.extendedProperties.shared.lastUpdatedByAutomation }}","rightValue":"","operator":{"type":"string","operation":"notExists","singleValue":true}}],"combinator":"and"},"options":{}},"id":"2a7e94c9-33ca-4d5f-8db8-5e5b4a62e678","name":"Is it a new event?","type":"n8n-nodes-base.if","typeVersion":2,"position":[-3040,3744]},{"parameters":{"operation":"formatDate","date":"={{ $json.notionDateTimeEnd }}","format":"yyyy-MM-dd","outputFieldName":"notiondEndDate","options":{"includeInputFields":true}},"id":"0dc230ac-4050-4f3f-b929-87ff43d393dd","name":"Format end_date","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-1936,4000]},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"f1cfd445-3297-4865-8c6d-7baf0c807ef1","name":"Add extendedProperties to Google event","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[208,352],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"b1a7c207-92de-44b8-a996-a08d3dd885ff","name":"Add extendedProperties to Google event1","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[208,528],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"9c3d708e-ecc2-40e7-a9c9-6778cb706259","name":"Add extendedProperties to Google event2","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[208,768],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"0e7ec0f5-9b29-400b-8c89-fc41985cd352","name":"Add extendedProperties to Google event3","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[208,960],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"d43827e2-d66f-424a-ae53-22eb2029af35","name":"Add extendedProperties to Google event4","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[0,1888],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"b1353051-8c8c-4d40-a3e7-3fb0360315a2","name":"Add extendedProperties to Google event5","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[0,2128],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"6f2712e8-c000-43f1-985e-79b3ac6534dc","name":"Add extendedProperties to Google event6","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[0,2480],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"0dd6db1d-40f3-471c-84ee-7b0fb67b5df4","name":"Add extendedProperties to Google event7","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[0,2720],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"a16200de-0d2b-4144-a5ea-77d52e1eed42","leftValue":"={{ $json.start.date }}","rightValue":"={{ $json.notiondEndDate }}","operator":{"type":"string","operation":"notRegex"}}],"combinator":"and"},"options":{}},"id":"423e43fd-0f30-4390-9317-426c78ce11b8","name":"Does it really have an end_date?","type":"n8n-nodes-base.if","typeVersion":2,"position":[-1744,4000]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.start.dateTime }}","operation":"contains","value2":"T"}]}},"id":"0ba9630a-dc91-4cd1-a05a-ba1a77ce83cd","name":"Does it have a time?3","type":"n8n-nodes-base.if","typeVersion":1,"position":[-2800,3408]},{"parameters":{"operation":"subtractFromDate","magnitude":"={{ $json.end.date }}","duration":1,"outputFieldName":"notionDateTimeEnd","options":{"includeInputFields":true}},"id":"2810a1f3-8924-4bd6-b692-79e5461aa0c3","name":"Subtract 1 day from end_date1","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-2576,3504],"notesInFlow":true,"notes":"Google Calendar and Notion handle end dates differently, when there's no time set.\n\nIf a date in Notion is from Nov-10 to Nov-12, in Google it will show \"Nov-10 at 00:00\" to \"Nov-12 at 00:00\".\n\nWhen you set an event in Google from Nov-12 to Nov-13, it sets the end date to \"Nov-14 at 00:00\" behind the scenes.\nMeaning the event would end at the beggining of Nov-14, lasting all day long during Nov-13.\n\nBut Notion considers Nov-12 to Nov-13 already as all day dates.\nSo Nov-14 in Google must be Nov-13 in Notion."},{"parameters":{"operation":"formatDate","date":"={{ $json.notionDateTimeEnd }}","format":"yyyy-MM-dd","outputFieldName":"notiondEndDate","options":{"includeInputFields":true}},"id":"3d6b8215-8719-4e59-85c6-a5611a66c2a8","name":"Format end_date1","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-2384,3504]},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":1},"conditions":[{"id":"a16200de-0d2b-4144-a5ea-77d52e1eed42","leftValue":"={{ $json.start.date }}","rightValue":"={{ $json.notiondEndDate }}","operator":{"type":"string","operation":"notRegex"}}],"combinator":"and"},"options":{}},"id":"c5c17c21-e5b6-4c6a-99a0-cdd24edaca34","name":"Does it really have an end_date?1","type":"n8n-nodes-base.if","typeVersion":2,"position":[-2176,3504]},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"={{ $json.Globals.databaseId }}","mode":"id"},"title":"={{ $json.summary }}","propertiesUi":{"propertyValues":[{"key":"Date|date","range":true,"includeTime":false,"dateStart":"={{ $json.start.date }}","dateEnd":"={{ $json.notiondEndDate }}"},{"key":"GCal ID|rich_text","textContent":"={{ $json.id }}"}]},"options":{}},"id":"404547dd-abb7-4770-a343-426b40a9abba","name":"Create page1","type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-1968,3408],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"={{ $json.Globals.databaseId }}","mode":"id"},"title":"={{ $json.summary }}","propertiesUi":{"propertyValues":[{"key":"Date|date","includeTime":false,"date":"={{ $json.start.date }}"},{"key":"GCal ID|rich_text","textContent":"={{ $json.id }}"}]},"options":{}},"id":"d68d5545-54e3-4921-b3aa-ea1f867184db","name":"Create page2","type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-1968,3600],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs1').item.json.Globals.calendarId }}/events/{{ $('Globals1').item.json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $json.id }}\"\n    }\n  },\n  \"description\": \"👉 <a href=https://www.notion.so/{{ $json.id.replaceAll(\"-\", \"\") }} target=_blank><b>View in Notion</b></a>\"\n}","options":{}},"id":"309e7109-1a16-401a-9f23-69a889fa9367","name":"Add extendedProperties to Google event8","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[-2384,3312],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs1').item.json.Globals.calendarId }}/events/{{ $('Globals1').item.json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $json.id }}\"\n    }\n  },\n  \"description\": \"👉 <a href=https://www.notion.so/{{ $json.id.replaceAll(\"-\", \"\") }} target=_blank><b>View in Notion</b></a>\"\n}","options":{}},"id":"28b55275-7091-4786-be0d-bcb9ecbd1414","name":"Add extendedProperties to Google event9","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[-1776,3408],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs1').item.json.Globals.calendarId }}/events/{{ $('Globals1').item.json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $json.id }}\"\n    }\n  },\n  \"description\": \"👉 <a href=https://www.notion.so/{{ $json.id.replaceAll(\"-\", \"\") }} target=_blank><b>View in Notion</b></a>\"\n}","options":{}},"id":"be3e8f06-dcac-4e78-981a-f723df9e2153","name":"Add extendedProperties to Google event10","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[-1776,3600],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"mode":"raw","jsonOutput":"{\n  \"Globals\": {\n    \"n8nConnectionUserId\": \"a07174da-0c76-4695-a1e1-ceab14e1c47e\",\n    \"Todo\": {\n      \"databaseId\": \"255dcbfd-8835-8070-8923-f4087fa4226a\",\n      \"calendarId\": \"d7afc03f1a29ce0d1793fd03ab5f158fccfb713200200231ff9e0281cb3706cf@group.calendar.google.com\",\n      \"doneCalendarId\": \"4b26294ff8d58ee378b5a88e2cf6ef9e9e25e58bb05cc859f283b2c529498c2d@group.calendar.google.com\"\n    },\n    \"Meetings\": {\n      \"databaseId\": \"255dcbfd-8835-808e-b1fa-f4f15a0eb95c\",\n      \"calendarId\": \"156d652f3f6ace3103a6cf207083a8ae6b01239f6de4872e94e397db65386ec6@group.calendar.google.com\",\n      \"doneCalendarId\": \"4c52182ce72d7b62aeeed9f865f455ca9de60c37b3ad56802d054c4e5a4fab17@group.calendar.google.com\"\n    }\n  }\n}","includeOtherFields":true,"options":{}},"id":"02709e48-b2e2-43fb-a53a-057e9db68751","name":"Globals","type":"n8n-nodes-base.set","typeVersion":3.4,"position":[-3808,1648]},{"parameters":{"content":"# Set some variables here\n## 1️⃣ n8nConnectionUserId\nWhen a page is edited in Notion it registers the ID of the user that made the change.\n\nTo find out what's the ID for your n8n user, use a Notion node to create a database page and check the 'last_edited_by' field.\n\n\n\n\n## 2️⃣ Database and Calendar IDs\nFor each database you want to sync, you have to add the Notion **databaseId** and Google **calendarId** in JSON objects like this:\n\nTasks: {\n   databaseId: \"`72fb8-57fe78a-sgf976`\",\n   calendarId: \"`73b919eca@group.calendar.google.com`\"\n },\n\nMeetings: {\n    databaseId: \"`157fe-78a23f-dfs978`\",\n    calendarId: \"`2a384hfy@group.calendar.google.com`\"\n  }\n\n## 🚨🚨🚨 ATTENTION 🚨🚨🚨\nThe databaseId must include the hyphens, like this:\n`d6e15d95-c538-4795-b1d8-0e5gc778c03c`\n\nThe pattern is:\n8 characters - 4 characters - 4 characters - 4 characters - 12 characters.","height":1341,"width":399},"id":"62e9cef0-6b7c-4a0c-a5a7-8bfbf59e78c2","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-3952,832]},{"parameters":{"jsCode":"const items = $input.all();\nconst updatedItems = items.map(item => {\n  const databaseId = item.json.parent.database_id;\n  let currentCalendarId = null;\n\n  // Searches the Globals object to find the matching field\n  for (const key in item.json.Globals) {\n    if (item.json.Globals[key].databaseId === databaseId) {\n      currentCalendarId = item.json.Globals[key].calendarId;\n      break;\n    }\n  }\n\n  // Rebuild the Globals object with only the desired fields\n  item.json.Globals = {\n    n8nConnectionUserId: item.json.Globals.n8nConnectionUserId,\n    calendarId: currentCalendarId,\n    databaseId: databaseId\n  };\n  \n  return item;\n});\n\nreturn updatedItems;"},"id":"af700be1-b031-490d-b5ed-755a77254704","name":"Set the current database and calendar IDs","type":"n8n-nodes-base.code","typeVersion":2,"position":[-3488,1648]},{"parameters":{"content":"# Copy the Globals from above and paste here","height":388.29901720463954,"width":319.61007431942534},"id":"423e35fd-d134-4c44-94ac-89d93a98d82e","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-3904,3552]},{"parameters":{"mode":"raw","jsonOutput":"{\n  \"Globals\": {\n    \"n8nConnectionUserId\": \"a07174da-0c76-4695-a1e1-ceab14e1c47e\",\n    \"Todo\": {\n      \"databaseId\": \"255dcbfd-8835-8070-8923-f4087fa4226a\",\n      \"calendarId\": \"d7afc03f1a29ce0d1793fd03ab5f158fccfb713200200231ff9e0281cb3706cf@group.calendar.google.com\",\n      \"doneCalendarId\": \"4b26294ff8d58ee378b5a88e2cf6ef9e9e25e58bb05cc859f283b2c529498c2d@group.calendar.google.com\"\n    },\n    \"Meetings\": {\n      \"databaseId\": \"255dcbfd-8835-808e-b1fa-f4f15a0eb95c\",\n      \"calendarId\": \"156d652f3f6ace3103a6cf207083a8ae6b01239f6de4872e94e397db65386ec6@group.calendar.google.com\",\n      \"doneCalendarId\": \"4c52182ce72d7b62aeeed9f865f455ca9de60c37b3ad56802d054c4e5a4fab17@group.calendar.google.com\"\n    }\n  }\n}","includeOtherFields":true,"options":{}},"id":"31bc2c1d-19e8-48f8-ac55-2f32c609611a","name":"Globals1","type":"n8n-nodes-base.set","typeVersion":3.4,"position":[-3808,3744]},{"parameters":{"content":"# Copy the Globals from above and paste here","height":380.06310703196385,"width":319.61007431942534},"id":"3194d46a-96e7-4800-a658-a87a4bdcc55a","name":"Sticky Note14","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-3904,4512]},{"parameters":{"mode":"raw","jsonOutput":"{\n  \"Globals\": {\n    \"n8nConnectionUserId\": \"a07174da-0c76-4695-a1e1-ceab14e1c47e\",\n    \"Todo\": {\n      \"databaseId\": \"255dcbfd-8835-8070-8923-f4087fa4226a\",\n      \"calendarId\": \"d7afc03f1a29ce0d1793fd03ab5f158fccfb713200200231ff9e0281cb3706cf@group.calendar.google.com\",\n      \"doneCalendarId\": \"4b26294ff8d58ee378b5a88e2cf6ef9e9e25e58bb05cc859f283b2c529498c2d@group.calendar.google.com\"\n    },\n    \"Meetings\": {\n      \"databaseId\": \"255dcbfd-8835-808e-b1fa-f4f15a0eb95c\",\n      \"calendarId\": \"156d652f3f6ace3103a6cf207083a8ae6b01239f6de4872e94e397db65386ec6@group.calendar.google.com\",\n      \"doneCalendarId\": \"4c52182ce72d7b62aeeed9f865f455ca9de60c37b3ad56802d054c4e5a4fab17@group.calendar.google.com\"\n    }\n  }\n}","includeOtherFields":true,"options":{}},"id":"f2f46b68-bb4f-4355-8cf5-13fff4ca7d79","name":"Globals2","type":"n8n-nodes-base.set","typeVersion":3.4,"position":[-3808,4704]},{"parameters":{"jsCode":"const items = $input.all();\nconst updatedItems = items.map(item => {\n  const calendarId = item.json.organizer.email;\n  let currentDatabaseId = null;\n\n  // Searches the Globals object to find the matching field\n  for (const key in item.json.Globals) {\n    if (item.json.Globals[key].calendarId === calendarId) {\n      currentDatabaseId = item.json.Globals[key].databaseId;\n      break;\n    }\n  }\n\n  // Rebuild the Globals object with only the desired fields\n  item.json.Globals = {\n    n8nConnectionUserId: item.json.Globals.n8nConnectionUserId,\n    calendarId: calendarId,\n    databaseId: currentDatabaseId\n  };\n  \n  return item;\n});\n\nreturn updatedItems;"},"id":"ed34a782-4e86-4918-9437-018a20ff759e","name":"Set the current database and calendar IDs2","type":"n8n-nodes-base.code","typeVersion":2,"position":[-3504,4704]},{"parameters":{"content":"## Use this node for testing\nReplace the Event Updated trigger by this node","height":305.14255210487977,"width":315.66399727154976},"id":"9779e71c-6412-4577-9dae-3366e4cc5227","name":"Sticky Note16","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-5408,3264]},{"parameters":{"content":"## Add two triggers for each Google Calendar that you want to sync","height":665.1419819421769,"width":365.7122508375314},"id":"03487829-f4d8-444e-a772-690863ed22df","name":"Sticky Note17","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4448,3264]},{"parameters":{"content":"## Add one trigger for each Google Calendar that you want to sync","height":641.5966864244806,"width":283.9419368038477},"id":"f355655f-2d3d-435d-9c67-7284880731c1","name":"Sticky Note34","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4400,4240]},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"calendarId":{"__rl":true,"value":"b0fdadc0038eaed12fbcdb9a4130a3ae4c1ffd36c1ce9ce62221cd77b6196164@group.calendar.google.com","mode":"list","cachedResultName":"TodoCal"},"triggerOn":"eventUpdated","options":{}},"id":"441cfbc0-d484-4733-817d-85643171b78d","name":"Event Updated","type":"n8n-nodes-base.googleCalendarTrigger","typeVersion":1,"position":[-4240,3392],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{},"id":"a2208179-51d3-4e1b-b5c8-d4d692256037","name":"When clicking \"Test workflow\"","type":"n8n-nodes-base.manualTrigger","typeVersion":1,"position":[-5696,1584],"disabled":true},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"calendarId":{"__rl":true,"value":"b0fdadc0038eaed12fbcdb9a4130a3ae4c1ffd36c1ce9ce62221cd77b6196164@group.calendar.google.com","mode":"list","cachedResultName":"TodoCal"},"triggerOn":"eventCreated","options":{}},"id":"501c7cb5-b20e-45a0-8877-1c132684441e","name":"Event Created","type":"n8n-nodes-base.googleCalendarTrigger","typeVersion":1,"position":[-4400,3392],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"content":"# Todo","height":99.22146266772059,"width":196.39800582684305,"color":7},"id":"5a1698d8-5c77-4274-87b8-c63151fe3535","name":"Sticky Note35","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4656,3392]},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $json.extendedProperties.shared.notionPageId }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"Data|date","includeTime":false,"date":"={{ $json.start.date }}"},{"key":"Task name|title","title":"={{ $json.summary }}"}]},"options":{}},"id":"f926ed72-8468-4c18-ab3a-455ab040b664","name":"Update page1 - continue on error","type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-1520,4112],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}},"onError":"continueRegularOutput"},{"parameters":{"content":"### Allowing these Notion nodes to continue on error prevents deleted pages from stopping the workflow.\n\nThe deleted pages go to another branch to be deleted in Google Calendar.","height":324.9384888466118,"color":7},"id":"ec619d31-6409-40f5-b2de-508a0290546f","name":"Sticky Note36","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-1344,3920]},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"186dc8f2-4a6d-416c-9900-1b4ee8e7418b","leftValue":"={{ $json.in_trash }}","rightValue":"true","operator":{"type":"boolean","operation":"true","singleValue":true}}],"combinator":"and"},"options":{}},"id":"df116486-c480-41a8-8720-4e54b548ac4d","name":"Find deleted pages1","type":"n8n-nodes-base.filter","typeVersion":2,"position":[-2576,2352]},{"parameters":{"operation":"delete","calendar":{"__rl":true,"value":"={{ $('Only calendarId').item.json.calendarId }}","mode":"id"},"eventId":"={{ $json.properties['GCal ID'].rich_text[0].text.content }}","options":{}},"id":"2a4cb92a-da05-4725-8862-0330f5430f4d","name":"Delete event3","type":"n8n-nodes-base.googleCalendar","typeVersion":1,"position":[-2400,2352],"alwaysOutputData":false,"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"content":"## This flow checks if any Notion page was deleted and deletes the event\nWe have to do this because there's no way to retrieve deleted pages using the Notion API.\n\nAnd the \"page updated\" trigger uses the Notion API to check for updates, so it never detects when a page was deleted.","height":306.9481514579442,"width":286.9846072927019,"color":7},"id":"b9fef09c-e519-443d-a722-ab3ba47d8e79","name":"Sticky Note38","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4416,2224]},{"parameters":{"operation":"getAll","calendar":{"__rl":true,"value":"={{ $json.calendarId }}","mode":"id"},"returnAll":true,"options":{"timeMin":"={{ $today.minus(1, 'days') }}"}},"id":"287322c4-ce44-4615-876d-baad9b8355f1","name":"Get future events1","type":"n8n-nodes-base.googleCalendar","typeVersion":1.1,"position":[-3120,2352],"alwaysOutputData":false,"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"resource":"databasePage","operation":"get","pageId":{"__rl":true,"value":"={{ $json.extendedProperties.shared.notionPageId }}","mode":"id"},"simple":false},"id":"3344282c-581a-4b40-9f91-966ae0ef78ab","name":"Find related pages1","type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-2768,2352],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"7a2065ef-7d16-4d67-aea0-e2d9185562cd","leftValue":"={{ $json.extendedProperties.shared.notionPageId }}","rightValue":"","operator":{"type":"string","operation":"exists","singleValue":true}}],"combinator":"and"},"options":{}},"id":"461fb1e4-2e7e-4f73-b821-eaab769447e0","name":"extendedProperties exist?","type":"n8n-nodes-base.filter","typeVersion":2,"position":[-2944,2352]},{"parameters":{"jsCode":"const items = $input.all();\nconst updatedItems = items.map(item => {\n  const calendarId = item.json.organizer.email;\n  let currentDatabaseId = null;\n\n  // Searches the Globals object to find the matching field\n  for (const key in item.json.Globals) {\n    if (item.json.Globals[key].calendarId === calendarId) {\n      currentDatabaseId = item.json.Globals[key].databaseId;\n      break;\n    }\n  }\n\n  // Rebuild the Globals object with only the desired fields\n  item.json.Globals = {\n    n8nConnectionUserId: item.json.Globals.n8nConnectionUserId,\n    calendarId: calendarId,\n    databaseId: currentDatabaseId\n  };\n  \n  return item;\n});\n\nreturn updatedItems;"},"id":"62824ee0-c909-4ec9-a9b4-e20ee9e2b79c","name":"Set the current database and calendar IDs1","type":"n8n-nodes-base.code","typeVersion":2,"position":[-3504,3744]},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $json.extendedProperties.shared.notionPageId }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"Date|date","range":true,"dateStart":"={{ $json.start.dateTime }}","dateEnd":"={{ $json.end.dateTime }}"},{"key":"Name|title","title":"={{ $json.summary }}"}]},"options":{}},"id":"e3705a4d-519c-4e19-a8ad-61919984618b","name":"Update page2 - continue on error","type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-2144,3808],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}},"onError":"continueRegularOutput"},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $json.extendedProperties.shared.notionPageId }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"Date|date","range":true,"includeTime":false,"dateStart":"={{ $json.start.date }}","dateEnd":"={{ $json.notiondEndDate }}"},{"key":"Name|title","title":"={{ $json.summary }}"}]},"options":{}},"id":"0f570742-a4ac-47bf-a7d2-b84133a5a1a7","name":"Update page - continue on error","type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-1520,3920],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}},"onError":"continueRegularOutput"},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"={{ $json.Globals.databaseId }}","mode":"id"},"title":"={{ $json.summary }}","propertiesUi":{"propertyValues":[{"key":"Date|date","range":true,"dateStart":"={{ $json.start.dateTime }}","dateEnd":"={{ $json.end.dateTime }}"},{"key":"GCal ID|rich_text","textContent":"={{ $json.id }}"}]},"options":{}},"id":"24f3a1ed-66a4-49a0-8655-185344c14da1","name":"Create page","type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-2576,3312],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $json.Globals.calendarId }}/events/{{ $json.GCal_ID }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"bodyParameters":{"parameters":[{"name":"start","value":"={{ {\n  \"dateTime\": $json.notionDate.date.start,\n  \"date\": null\n} }}"},{"name":"end","value":"={{ {\n  \"dateTime\": $json.notionDate.date.end,\n  \"date\": null\n} }}"},{"name":"summary","value":"={{ $json.notionName }}"},{"name":"status","value":"confirmed"},{"name":"description","value":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>"}]},"options":{}},"id":"3c13977f-456a-492e-b491-33b50307e751","name":"Update dateTime event","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[0,352],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"fields":{"values":[{"name":"notionID","stringValue":"={{ $json.id }}"},{"name":"notionName","stringValue":"={{ $json.properties['Name'].title[0].text.content }}"},{"name":"notionDate","type":"objectValue","objectValue":"={{ $json.properties.Date }}"},{"name":"GCal_ID","stringValue":"={{ $json.properties['GCal ID'].rich_text[0].text.content }}"}]},"include":"selected","includeFields":"archived,Globals","options":{}},"id":"f9a2bf3b-45bb-4a9e-b68a-6953a9cb9668","name":"Set some fields","type":"n8n-nodes-base.set","typeVersion":3.2,"position":[-2976,1632]},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"event":"pagedUpdatedInDatabase","databaseId":{"__rl":true,"value":"255dcbfd-8835-808e-b1fa-f4f15a0eb95c","mode":"list","cachedResultName":"Meetings Dummy","cachedResultUrl":"https://www.notion.so/24ddcbfd883580feab1dfa7270343d5b"},"simple":false},"id":"55ca548b-3362-416a-ba60-30fabaf75431","name":"Page Updated - Meetings","type":"n8n-nodes-base.notionTrigger","typeVersion":1,"position":[-4336,1520],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"calendarId":{"__rl":true,"value":"293ead77ad5a26298e15cd8a36e87b3c22311f4f15b3e783ce1ace367ce04911@group.calendar.google.com","mode":"list","cachedResultName":"MeetingsCal"},"triggerOn":"eventUpdated","options":{}},"id":"f425b1c1-a91a-4395-bb43-360aab004a7d","name":"Event Updated1","type":"n8n-nodes-base.googleCalendarTrigger","typeVersion":1,"position":[-4240,3584],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"calendarId":{"__rl":true,"value":"293ead77ad5a26298e15cd8a36e87b3c22311f4f15b3e783ce1ace367ce04911@group.calendar.google.com","mode":"list","cachedResultName":"MeetingsCal"},"triggerOn":"eventCreated","options":{}},"id":"4838ba73-e9d1-4cb0-86a9-5ec5959889ec","name":"Event Created1","type":"n8n-nodes-base.googleCalendarTrigger","typeVersion":1,"position":[-4400,3584],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"content":"# Meetings","height":99.22146266772059,"width":196.39800582684305,"color":7},"id":"d420052f-a783-4673-92fa-7e026cbfabb5","name":"Sticky Note37","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4656,3584]},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"calendarId":{"__rl":true,"value":"293ead77ad5a26298e15cd8a36e87b3c22311f4f15b3e783ce1ace367ce04911@group.calendar.google.com","mode":"list","cachedResultName":"MeetingsCal"},"triggerOn":"eventCancelled","options":{}},"id":"01c43d97-de2f-43bc-afaf-b4fa35026417","name":"Deleted - Meetings","type":"n8n-nodes-base.googleCalendarTrigger","typeVersion":1,"position":[-4320,4560],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"mode":"raw","jsonOutput":"{\n  \"Globals\": {\n    \"n8nConnectionUserId\": \"a07174da-0c76-4695-a1e1-ceab14e1c47e\",\n    \"Todo\": {\n      \"databaseId\": \"255dcbfd-8835-8070-8923-f4087fa4226a\",\n      \"calendarId\": \"d7afc03f1a29ce0d1793fd03ab5f158fccfb713200200231ff9e0281cb3706cf@group.calendar.google.com\",\n      \"doneCalendarId\": \"4b26294ff8d58ee378b5a88e2cf6ef9e9e25e58bb05cc859f283b2c529498c2d@group.calendar.google.com\"\n    },\n    \"Meetings\": {\n      \"databaseId\": \"255dcbfd-8835-808e-b1fa-f4f15a0eb95c\",\n      \"calendarId\": \"156d652f3f6ace3103a6cf207083a8ae6b01239f6de4872e94e397db65386ec6@group.calendar.google.com\",\n      \"doneCalendarId\": \"4c52182ce72d7b62aeeed9f865f455ca9de60c37b3ad56802d054c4e5a4fab17@group.calendar.google.com\"\n    }\n  }\n}","includeOtherFields":true,"options":{}},"id":"acead159-3ad9-47bb-8a07-98ddd9775f8f","name":"Globals3","type":"n8n-nodes-base.set","typeVersion":3.4,"position":[-3808,2352]},{"parameters":{"fieldToSplitOut":"Globals","options":{}},"id":"557807ab-d130-48c6-92c3-fc78063738ed","name":"Split fields","type":"n8n-nodes-base.splitOut","typeVersion":1,"position":[-3552,2336]},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"b2a5f692-c6c4-4691-b5cf-fcf57bcd2523","leftValue":"={{ $json.calendarId }}","rightValue":"","operator":{"type":"string","operation":"exists","singleValue":true}}],"combinator":"and"},"options":{}},"id":"8f2d465d-80ef-4824-9e9e-d0911ca950e1","name":"Only calendarId","type":"n8n-nodes-base.filter","typeVersion":2,"position":[-3296,2352]},{"parameters":{"content":"# Copy the Globals from above and paste here","height":388.29901720463954,"width":319.61007431942534},"id":"9bbe96e9-eaf7-4176-a79a-4b44349b8878","name":"Sticky Note41","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-3904,2144]},{"parameters":{"rule":{"interval":[{"field":"minutes","minutesInterval":3}]}},"id":"acdedc86-9778-4a9a-9cb5-950cb4d60140","name":"Every 3min","type":"n8n-nodes-base.scheduleTrigger","typeVersion":1.2,"position":[-4080,2352]},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"event":"pagedUpdatedInDatabase","databaseId":{"__rl":true,"value":"255dcbfd-8835-8070-8923-f4087fa4226a","mode":"list","cachedResultName":"Todo Dummy","cachedResultUrl":"https://www.notion.so/218dcbfd88358008a2bdc164ab084ed3"},"simple":false},"id":"970d78ca-f6a1-49bc-a4aa-b6cca40c1caf","name":"Page Updated - Todo","type":"n8n-nodes-base.notionTrigger","typeVersion":1,"position":[-4336,1344],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"calendarId":{"__rl":true,"value":"b0fdadc0038eaed12fbcdb9a4130a3ae4c1ffd36c1ce9ce62221cd77b6196164@group.calendar.google.com","mode":"list","cachedResultName":"TodoCal"},"triggerOn":"eventCancelled","options":{}},"id":"2dffa43b-123e-4114-a9a1-f2b6ed74445e","name":"Deleted - Todo","type":"n8n-nodes-base.googleCalendarTrigger","typeVersion":1,"position":[-4320,4384],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"options":{}},"id":"5180afe4-397d-4c7c-aa32-8890375a7cd2","name":"Compute calendar targets (TEST)","type":"n8n-nodes-base.set","typeVersion":3.2,"position":[-2736,1632]},{"parameters":{"conditions":{"string":[{"value1":"{{ $json.currentCal }}","operation":"notEqual","value2":"{{ $json.desiredCal }}"}],"multi":[{"value1":"{{ $json.eventId }}","operation":"isEmpty","value2":false}]},"options":{}},"id":"2a653700-5f26-4c8e-9e9c-c3d70d6df443","name":"Need to move calendar? (TEST)","type":"n8n-nodes-base.if","typeVersion":2,"position":[-2464,1632]},{"parameters":{"url":"https://www.googleapis.com/calendar/v3/calendars/{{ $json.currentCal }}/events/{{ $json.eventId }}/move","authentication":"oAuth2","options":{}},"id":"12aa2f38-6372-4983-9b85-15587bdd11ff","name":"Move event (Google) (TEST)","type":"n8n-nodes-base.httpRequest","typeVersion":4.2,"position":[-2800,1408]},{"parameters":{"resource":"databasePage","operation":"update","pageId":"={{ $json.id }}","propertiesUi":{"propertyValues":[{"key":"GCal Calendar ID|rich_text","textContent":"{{ $json.desiredCal }}"}]},"options":{}},"id":"b3389dea-c530-499f-b488-4075c0f2a700","name":"Set GCal Calendar ID (TEST)","type":"n8n-nodes-base.notion","typeVersion":2,"position":[-2608,1408]}],"connections":{"Google Calendar1":{"main":[[{"node":"Add extendedProperties to Google event6","type":"main","index":0}]]},"Add GCal ID":{"main":[[{"node":"Loop","type":"main","index":0}]]},"Remove GCal ID2":{"main":[[{"node":"Loop3","type":"main","index":0}]]},"Does it have a date?":{"main":[[{"node":"Does it have a time?","type":"main","index":0}],[{"node":"Loop3","type":"main","index":0}]]},"Does it have a time?":{"main":[[{"node":"Does it have an end date?1","type":"main","index":0}],[{"node":"Does it have an end date?3","type":"main","index":0}]]},"Delete event1":{"main":[[{"node":"Remove GCal ID2","type":"main","index":0}]]},"Does it have a date?1":{"main":[[{"node":"Does it have a time?1","type":"main","index":0}],[{"node":"No Operation, do nothing","type":"main","index":0}]]},"Does it have a time?1":{"main":[[{"node":"Does it have an end date?","type":"main","index":0}],[{"node":"Does it have an end date?2","type":"main","index":0}]]},"Find Task":{"main":[[{"node":"Remove GCal ID and Date","type":"main","index":0}]]},"Notion":{"main":[[{"node":"Merge","type":"main","index":0}]]},"Google Calendar3":{"main":[[{"node":"Add extendedProperties to Google event5","type":"main","index":0}]]},"Google Calendar":{"main":[[{"node":"Add extendedProperties to Google event4","type":"main","index":0}]]},"Add GCal ID3":{"main":[[{"node":"Loop2","type":"main","index":0}]]},"Does it have an end date?":{"main":[[{"node":"Loop2","type":"main","index":0}],[{"node":"Loop1","type":"main","index":0}]]},"Add GCal ID1":{"main":[[{"node":"Loop1","type":"main","index":0}]]},"Loop":{"main":[[],[{"node":"Add 1 day to end date1","type":"main","index":0}]]},"Loop1":{"main":[[],[{"node":"Google Calendar3","type":"main","index":0}]]},"Loop2":{"main":[[],[{"node":"Google Calendar","type":"main","index":0}]]},"Loop3":{"main":[[],[{"node":"Delete event1","type":"main","index":0}]]},"Creates defaultEndDate with 1h duration":{"main":[[{"node":"GCal_ID exists in Notion?","type":"main","index":0}]]},"Delete event2":{"main":[[{"node":"Loop4","type":"main","index":0}]]},"Loop4":{"main":[[],[{"node":"Delete event2","type":"main","index":0}]]},"Notion1":{"main":[[{"node":"Merge","type":"main","index":1}]]},"Does it have an end date?1":{"main":[[{"node":"Update dateTime event","type":"main","index":0}],[{"node":"Update dateTime event1","type":"main","index":0}]]},"Does it have an end date?2":{"main":[[{"node":"Loop","type":"main","index":0}],[{"node":"Loop5","type":"main","index":0}]]},"Google Calendar2":{"main":[[{"node":"Add extendedProperties to Google event7","type":"main","index":0}]]},"Add GCal ID2":{"main":[[{"node":"Loop5","type":"main","index":0}]]},"Loop5":{"main":[[],[{"node":"Google Calendar2","type":"main","index":0}]]},"GCal_ID exists in Notion?":{"main":[[{"node":"Is the page deleted?","type":"main","index":0}],[{"node":"Does it have a date?1","type":"main","index":0}]]},"Is the page deleted?":{"main":[[{"node":"Loop4","type":"main","index":0}],[{"node":"Does it have a date?","type":"main","index":0}]]},"Does it have an end date?3":{"main":[[{"node":"Add 1 day to end date","type":"main","index":0}],[{"node":"Update to All Day event2","type":"main","index":0}]]},"Add 1 day to end date":{"main":[[{"node":"Format date","type":"main","index":0}]]},"Format date":{"main":[[{"node":"Update to All Day event","type":"main","index":0}]]},"Update to All Day event":{"main":[[{"node":"Add extendedProperties to Google event2","type":"main","index":0}]]},"Update to All Day event2":{"main":[[{"node":"Add extendedProperties to Google event3","type":"main","index":0}]]},"Update dateTime event1":{"main":[[{"node":"Add extendedProperties to Google event1","type":"main","index":0}]]},"Add 1 day to end date1":{"main":[[{"node":"Format date1","type":"main","index":0}]]},"Format date1":{"main":[[{"node":"Google Calendar1","type":"main","index":0}]]},"Page edited by a user?":{"main":[[{"node":"Set some fields","type":"main","index":0}],[{"node":"Do nothing","type":"main","index":0}]]},"Calculate timeDifference between Google's updated_at  and our own updated_at fields":{"main":[[{"node":"Only events that were edited 2s after the last update","type":"main","index":0}]]},"Only events that were edited 2s after the last update":{"main":[[{"node":"Does it have a time?2","type":"main","index":0}]]},"Does it have a time?2":{"main":[[{"node":"Update page2 - continue on error","type":"main","index":0}],[{"node":"Subtract 1 day from end_date","type":"main","index":0}]]},"Subtract 1 day from end_date":{"main":[[{"node":"Format end_date","type":"main","index":0}]]},"Is it a new event?":{"main":[[{"node":"Does it have a time?3","type":"main","index":0}],[{"node":"Calculate timeDifference between Google's updated_at  and our own updated_at fields","type":"main","index":0}]]},"Format end_date":{"main":[[{"node":"Does it really have an end_date?","type":"main","index":0}]]},"Add extendedProperties to Google event4":{"main":[[{"node":"Add GCal ID3","type":"main","index":0}]]},"Add extendedProperties to Google event5":{"main":[[{"node":"Add GCal ID1","type":"main","index":0}]]},"Add extendedProperties to Google event6":{"main":[[{"node":"Add GCal ID","type":"main","index":0}]]},"Add extendedProperties to Google event7":{"main":[[{"node":"Add GCal ID2","type":"main","index":0}]]},"Does it really have an end_date?":{"main":[[{"node":"Update page - continue on error","type":"main","index":0}],[{"node":"Update page1 - continue on error","type":"main","index":0}]]},"Does it have a time?3":{"main":[[{"node":"Create page","type":"main","index":0}],[{"node":"Subtract 1 day from end_date1","type":"main","index":0}]]},"Subtract 1 day from end_date1":{"main":[[{"node":"Format end_date1","type":"main","index":0}]]},"Format end_date1":{"main":[[{"node":"Does it really have an end_date?1","type":"main","index":0}]]},"Does it really have an end_date?1":{"main":[[{"node":"Create page1","type":"main","index":0}],[{"node":"Create page2","type":"main","index":0}]]},"Create page1":{"main":[[{"node":"Add extendedProperties to Google event9","type":"main","index":0}]]},"Create page2":{"main":[[{"node":"Add extendedProperties to Google event10","type":"main","index":0}]]},"Globals":{"main":[[{"node":"Set the current database and calendar IDs","type":"main","index":0}]]},"Set the current database and calendar IDs":{"main":[[{"node":"Page edited by a user?","type":"main","index":0}]]},"Globals1":{"main":[[{"node":"Set the current database and calendar IDs1","type":"main","index":0}]]},"Globals2":{"main":[[{"node":"Set the current database and calendar IDs2","type":"main","index":0}]]},"Set the current database and calendar IDs2":{"main":[[{"node":"Find Task","type":"main","index":0}]]},"Event Updated":{"main":[[{"node":"Globals1","type":"main","index":0}]]},"When clicking \"Test workflow\"":{"main":[[{"node":"Notion1","type":"main","index":0},{"node":"Notion","type":"main","index":0}]]},"Event Created":{"main":[[{"node":"Globals1","type":"main","index":0}]]},"Find deleted pages1":{"main":[[{"node":"Delete event3","type":"main","index":0}]]},"Get future events1":{"main":[[{"node":"extendedProperties exist?","type":"main","index":0}]]},"Find related pages1":{"main":[[{"node":"Find deleted pages1","type":"main","index":0}]]},"extendedProperties exist?":{"main":[[{"node":"Find related pages1","type":"main","index":0}]]},"Set the current database and calendar IDs1":{"main":[[{"node":"Is it a new event?","type":"main","index":0}]]},"Create page":{"main":[[{"node":"Add extendedProperties to Google event8","type":"main","index":0}]]},"Update dateTime event":{"main":[[{"node":"Add extendedProperties to Google event","type":"main","index":0}]]},"Set some fields":{"main":[[{"node":"Compute calendar targets (TEST)","type":"main","index":0}]]},"Event Updated1":{"main":[[{"node":"Globals1","type":"main","index":0}]]},"Event Created1":{"main":[[{"node":"Globals1","type":"main","index":0}]]},"Deleted - Meetings":{"main":[[{"node":"Globals2","type":"main","index":0}]]},"Globals3":{"main":[[{"node":"Split fields","type":"main","index":0}]]},"Split fields":{"main":[[{"node":"Only calendarId","type":"main","index":0}]]},"Only calendarId":{"main":[[{"node":"Get future events1","type":"main","index":0}]]},"Every 3min":{"main":[[{"node":"Globals3","type":"main","index":0}]]},"Page Updated - Meetings":{"main":[[{"node":"Globals","type":"main","index":0}]]},"Page Updated - Todo":{"main":[[{"node":"Globals","type":"main","index":0}]]},"Deleted - Todo":{"main":[[{"node":"Globals2","type":"main","index":0}]]},"Compute calendar targets (TEST)":{"main":[[{"node":"Need to move calendar? (TEST)","type":"main","index":0}]]},"Need to move calendar? (TEST)":{"main":[[{"node":"Move event (Google) (TEST)","type":"main","index":0}],[{"node":"Creates defaultEndDate with 1h duration","type":"main","index":0}]]},"Move event (Google) (TEST)":{"main":[[{"node":"Set GCal Calendar ID (TEST)","type":"main","index":0}]]},"Set GCal Calendar ID (TEST)":{"main":[[{"node":"Creates defaultEndDate with 1h duration","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":null,"pinData":{},"versionId":"2e828836-cd79-48e7-92ac-885e5d39f52e","triggerCount":0,"tags":[],"shared":[{"createdAt":"2025-08-20T12:46:36.341Z","updatedAt":"2025-08-20T12:46:36.341Z","role":"workflow:owner","workflowId":"B0rji0ynpsVFh0p9","projectId":"DQC8ik4pLkhZ4ZDm","project":{"createdAt":"2025-08-19T19:25:16.723Z","updatedAt":"2025-08-19T19:26:16.591Z","id":"DQC8ik4pLkhZ4ZDm","name":"Ben Hex <bhochster@gmail.com>","type":"personal","icon":null,"description":null}}]},{"createdAt":"2025-08-20T14:46:46.119Z","updatedAt":"2025-09-11T23:48:50.000Z","id":"wpmnpYETSutrBAk8","name":"My workflow 4","active":false,"isArchived":true,"nodes":[{"parameters":{"calendar":{"__rl":true,"value":"={{ $json.Globals.calendarId }}","mode":"id"},"start":"={{ $json.notionDate.date.start }}","end":"={{ $json.endDateTime_Adjusted }}","additionalFields":{"allday":"yes","description":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>","summary":"={{ $json[\"notionName\"] }}"}},"id":"211edbf5-72c8-426a-84b8-fc25c4a87e61","name":"Google Calendar1","type":"n8n-nodes-base.googleCalendar","typeVersion":1,"position":[-208,2480],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $('Loop').item.json.notionID }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"GCal ID|rich_text","textContent":"={{ $json.id }}"}]},"options":{}},"id":"f8eb7b38-450b-4d2d-bf62-4fb4b665e2f5","name":"Add GCal ID","type":"n8n-nodes-base.notion","typeVersion":2,"position":[208,2480],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{},"id":"63c5acea-fe4c-4668-adc4-9f04d6e33b9f","name":"No Operation, do nothing","type":"n8n-nodes-base.noOp","typeVersion":1,"position":[-1360,2400]},{"parameters":{"content":"# Create event","height":80,"width":288.259119644621,"color":7},"id":"5efb8a7c-831e-45e5-bd87-a5b4ed2d95d9","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-1888,2304]},{"parameters":{"content":"# Update Event","height":80,"width":299.54925745153224,"color":7},"id":"b041a468-bfe4-4469-88e0-f6c037509e04","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-2208,768]},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $('Loop3').item.json.notionID }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"GCal ID|rich_text"}]},"options":{}},"id":"a2e44c74-c885-4c10-bcf6-84fa73e4de6e","name":"Remove GCal ID2","type":"n8n-nodes-base.notion","typeVersion":2,"position":[208,1232],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"content":"## This flow deletes GCal ID and Date, when the event is cancelled in Google.","height":162.57090146831365,"width":256.72937811647864,"color":7},"id":"98582135-2ef3-4bd4-bf14-210a2474d8d2","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4688,4464]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date }}","operation":"isNotEmpty"}]}},"id":"aa10485e-9f45-49aa-b45b-313a8c3bbd04","name":"Does it have a date?","type":"n8n-nodes-base.if","typeVersion":1,"position":[-1584,784]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date.start }}","operation":"contains","value2":"T"}]}},"id":"6d813583-b30f-4e64-85e6-ef6e1e2e2763","name":"Does it have a time?","type":"n8n-nodes-base.if","typeVersion":1,"position":[-1184,688]},{"parameters":{"operation":"delete","calendar":{"__rl":true,"value":"={{ $json.Globals.calendarId }}","mode":"id"},"eventId":"={{ $json.GCal_ID }}","options":{}},"id":"13d56708-278b-4429-aa13-4182d1af6c0c","name":"Delete event1","type":"n8n-nodes-base.googleCalendar","typeVersion":1,"position":[0,1232],"alwaysOutputData":false,"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date }}","operation":"isNotEmpty"}]}},"id":"efa9a503-95ad-4d1d-8914-b61b03a71b9e","name":"Does it have a date?1","type":"n8n-nodes-base.if","typeVersion":1,"position":[-1584,2304]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date.start }}","operation":"contains","value2":"T"}]}},"id":"b8375ba3-1172-44b3-b335-5482cd2ad0cc","name":"Does it have a time?1","type":"n8n-nodes-base.if","typeVersion":1,"position":[-1360,2240]},{"parameters":{"resource":"databasePage","operation":"getAll","databaseId":{"__rl":true,"value":"={{ $json.Globals.databaseId }}","mode":"id"},"returnAll":true,"filterType":"manual","filters":{"conditions":[{"key":"GCal ID|rich_text","condition":"equals","richTextValue":"={{ $json.id }}"}]},"options":{}},"id":"079200a2-9a7d-4761-a536-53187f1c47f6","name":"Find Task","type":"n8n-nodes-base.notion","typeVersion":2,"position":[-3264,4704],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $json.id }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"GCal ID|rich_text"},{"key":"Date|date"}]},"options":{}},"id":"0d8bcf5b-fc3e-4927-8925-8aa882aeadc0","name":"Remove GCal ID and Date","type":"n8n-nodes-base.notion","typeVersion":2,"position":[-3024,4704],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"resource":"databasePage","operation":"getAll","databaseId":{"__rl":true,"value":"dad4835c-1acc-4209-aac2-11440b13c475","mode":"list","cachedResultName":"Tasks","cachedResultUrl":"https://www.notion.so/dad4835c1acc4209aac211440b13c475"},"returnAll":true,"simple":false,"filterType":"manual","matchType":"allFilters","filters":{"conditions":[{"key":"Data|date","condition":"is_not_empty"},{"key":"Status|status","condition":"does_not_equal","statusValue":"Done"},{"key":"Status|status","condition":"does_not_equal","statusValue":"Archived"}]},"options":{}},"id":"c044fa71-518a-4284-9d6e-2850c36f5c38","name":"Notion","type":"n8n-nodes-base.notion","typeVersion":2.1,"position":[-5376,1504],"disabled":true},{"parameters":{"calendar":{"__rl":true,"value":"={{ $json.Globals.calendarId }}","mode":"id"},"start":"={{ $json.notionDate.date.start }}","end":"={{ $json.defaultEndDate }}","additionalFields":{"allday":"no","description":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>","summary":"={{ $json.notionName }}"}},"id":"60404df2-f429-4ab4-8419-3ef6c8084e3b","name":"Google Calendar3","type":"n8n-nodes-base.googleCalendar","typeVersion":1,"position":[-208,2128],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"calendar":{"__rl":true,"value":"={{ $json.Globals.calendarId }}","mode":"id"},"start":"={{ $json.notionDate.date.start }}","end":"={{ $json.notionDate.date.end }}","additionalFields":{"allday":"no","description":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>","summary":"={{ $json.notionName }}"}},"id":"f6bfcf71-9a8e-4c32-853c-2ae79df6f4c2","name":"Google Calendar","type":"n8n-nodes-base.googleCalendar","typeVersion":1,"position":[-208,1888],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $('Loop2').item.json.notionID }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"GCal ID|rich_text","textContent":"={{ $json.id }}"}]},"options":{}},"id":"8dc14154-498a-459a-aa15-5e2fc3184a38","name":"Add GCal ID3","type":"n8n-nodes-base.notion","typeVersion":2,"position":[208,1888],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date.end }}","operation":"isNotEmpty"}]}},"id":"4b9a62a4-544f-4dbc-b4c9-a3c530132a67","name":"Does it have an end date?","type":"n8n-nodes-base.if","typeVersion":1,"position":[-1040,2032]},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $('Loop1').item.json.notionID }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"GCal ID|rich_text","textContent":"={{ $json.id }}"}]},"options":{}},"id":"aa14bb6c-47cd-45b9-99a8-9a329aeb66c8","name":"Add GCal ID1","type":"n8n-nodes-base.notion","typeVersion":2,"position":[208,2128],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"options":{"reset":false}},"id":"376a2ae0-0ac4-40d6-b4cd-4413f75f7849","name":"Loop","type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[-784,2480]},{"parameters":{"options":{"reset":false}},"id":"99433289-f87c-4bbc-920c-3a7426f359e5","name":"Loop1","type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[-400,2128]},{"parameters":{"options":{"reset":false}},"id":"b4172dce-a1b9-4915-b575-44b2c1098ebf","name":"Loop2","type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[-400,1888]},{"parameters":{"options":{"reset":false}},"id":"c418a896-46bd-43f6-8165-ddb177c0be99","name":"Loop3","type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[-208,1232]},{"parameters":{"content":"## Choose your default event duration\nWhen pushing an event from Notion to Google Calendar, what is going to be the default duration?","height":334.192512604689,"width":259.7926186615935},"id":"98095859-5a84-400c-8049-3ea86a3d08ee","name":"Sticky Note11","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-2784,1472]},{"parameters":{"operation":"addToDate","magnitude":"={{ $json.notionDate.date.start }}","timeUnit":"hours","duration":1,"outputFieldName":"defaultEndDate","options":{"includeInputFields":true}},"id":"b0a81faf-68c1-4ed7-941c-e7bad8c10401","name":"Creates defaultEndDate with 1h duration","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-2704,1632]},{"parameters":{"content":"## Use these nodes for testing\nReplace the Notion \"Page Updated\" trigger by these 4 nodes to help simulate the behavior of the trigger.\n\nYou can create different filters and enable or disable the upper and lower nodes, depending on what tasks you need to test.\n\nThe only pages that won't work during testing are the deleted ones.","height":632.2029116375359,"width":880.8180923381184},"id":"d8405075-67c9-45f4-8855-4870d061a7c2","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-5760,1264]},{"parameters":{"operation":"delete","calendar":{"__rl":true,"value":"={{ $json.Globals.calendarId }}","mode":"id"},"eventId":"={{ $json.GCal_ID }}","options":{}},"id":"ccfcab14-59d7-41fe-bf69-e2c5931ef9d7","name":"Delete event2","type":"n8n-nodes-base.googleCalendar","typeVersion":1,"position":[208,0],"alwaysOutputData":false,"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"options":{"reset":false}},"id":"9d05cf74-c398-4954-ae26-d276f4b1edf1","name":"Loop4","type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[0,0]},{"parameters":{"resource":"databasePage","operation":"getAll","databaseId":{"__rl":true,"value":"dad4835c-1acc-4209-aac2-11440b13c475","mode":"list","cachedResultName":"Tasks","cachedResultUrl":"https://www.notion.so/dad4835c1acc4209aac211440b13c475"},"returnAll":true,"simple":false,"filterType":"manual","matchType":"allFilters","filters":{"conditions":[{"key":"GCal ID|rich_text","condition":"is_not_empty"},{"key":"Status|status","condition":"does_not_equal","statusValue":"Done"},{"key":"Status|status","condition":"does_not_equal","statusValue":"Archived"}]},"options":{}},"id":"b92f772d-bd41-42db-b0de-1f04ad0975ea","name":"Notion1","type":"n8n-nodes-base.notion","typeVersion":2.1,"position":[-5376,1664],"disabled":true},{"parameters":{"mode":"combine","mergeByFields":{"values":[{"field1":"id","field2":"id"}]},"joinMode":"keepEverything","options":{}},"id":"ccf12153-a73e-44d2-bfa3-df7fb4bb99e0","name":"Merge","type":"n8n-nodes-base.merge","typeVersion":2.1,"position":[-5088,1584],"disabled":true},{"parameters":{"content":"## Add one trigger for each Notion database that you want to sync","height":702.7054859554116,"width":289.07844289683123},"id":"2a73b412-fcbc-4a80-97f2-e10ee1b08b77","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4416,1200]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date.end }}","operation":"isNotEmpty"}]}},"id":"20644dfc-f354-42d5-8403-1d6c459bac70","name":"Does it have an end date?1","type":"n8n-nodes-base.if","typeVersion":1,"position":[-896,480]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date.end }}","operation":"isNotEmpty"}]}},"id":"e0b6536f-c4d8-4cdd-833c-f092f908c3b2","name":"Does it have an end date?2","type":"n8n-nodes-base.if","typeVersion":1,"position":[-1040,2624]},{"parameters":{"calendar":{"__rl":true,"value":"={{ $json.Globals.calendarId }}","mode":"id"},"start":"={{ $json.notionDate.date.start }}","end":"={{ $json.notionDate.date.start }}","additionalFields":{"allday":"yes","description":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>","summary":"={{ $json[\"notionName\"] }}"}},"id":"215c0073-f6c5-419a-b6ae-769db96277b6","name":"Google Calendar2","type":"n8n-nodes-base.googleCalendar","typeVersion":1,"position":[-208,2720],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $('Loop5').item.json.notionID }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"GCal ID|rich_text","textContent":"={{ $json.id }}"}]},"options":{}},"id":"4fe8ba15-230f-4a5e-9fa3-a5612d1d9a98","name":"Add GCal ID2","type":"n8n-nodes-base.notion","typeVersion":2,"position":[208,2720],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"content":"## YYYY-MM-DD","height":80,"width":190.88107700739067,"color":7},"id":"31fd0e19-b19e-4ea1-87c8-3e6d91e6a7f1","name":"Sticky Note18","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,2752]},{"parameters":{"options":{"reset":false}},"id":"afcb8b03-82a7-4ecd-899c-8e96cf1807a6","name":"Loop5","type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[-400,2720]},{"parameters":{"content":"## YYYY-MM-DD\n## YYYY-MM-DD","height":96.35243080295625,"width":190.88107700739073,"color":7},"id":"e9206c8d-c67c-4493-8c61-ae32db83e50e","name":"Sticky Note19","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,2512]},{"parameters":{"content":"## YYYY-MM-DD T HH:MM:SS-Z\n## YYYY-MM-DD T HH:MM:SS-Z","height":96.35243080295625,"width":364.9229338011439,"color":7},"id":"467f41e5-a52b-4659-8285-ac12e3dcf9b7","name":"Sticky Note20","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,1888]},{"parameters":{"content":"## YYYY-MM-DD T HH:MM:SS-Z","height":80,"width":359.18646169567,"color":7},"id":"5d44cb6b-44f5-473a-a396-520171274262","name":"Sticky Note21","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,2144]},{"parameters":{"content":"## YYYY-MM-DD","height":80,"width":190.88107700739067,"color":7},"id":"7168df1a-2232-4373-9213-9aa67511bd14","name":"Sticky Note26","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,960]},{"parameters":{"content":"## YYYY-MM-DD\n## YYYY-MM-DD","height":96.35243080295625,"width":190.88107700739073,"color":7},"id":"e8476529-bc93-4296-ba02-146c399da955","name":"Sticky Note27","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,768]},{"parameters":{"content":"## YYYY-MM-DD T HH:MM:SS-Z\n## YYYY-MM-DD T HH:MM:SS-Z","height":109.18668977858542,"width":364.9229338011439,"color":7},"id":"ebd45ff3-2781-45b7-9122-6a322a22214e","name":"Sticky Note28","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,352]},{"parameters":{"content":"## YYYY-MM-DD T HH:MM:SS-Z","height":83.20856474390726,"width":359.18646169567,"color":7},"id":"995b70fa-da21-4172-80f9-ddfc861094ff","name":"Sticky Note29","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,544]},{"parameters":{"content":"## Runs when page is deleted in Notion","height":96.35243080295625,"width":364.9229338011439,"color":7},"id":"7b178f98-49c1-447c-a71f-f46ec9c0395b","name":"Sticky Note31","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,0]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.GCal_ID }}","operation":"isNotEmpty"}]}},"id":"e6e71f82-4fa8-4cf8-bcfe-83b0fcb698f2","name":"GCal_ID exists in Notion?","type":"n8n-nodes-base.if","typeVersion":1,"position":[-2400,1632]},{"parameters":{"conditions":{"boolean":[{"value1":"={{ $json.in_trash }}","value2":"={{ true }}"}]}},"id":"6ab1b0eb-3664-4878-8870-8cea3a3fcc59","name":"Is the page deleted?","type":"n8n-nodes-base.if","typeVersion":1,"position":[-1888,768]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date.end }}","operation":"isNotEmpty"}]}},"id":"9240fb3c-256c-45a9-a254-753293c18993","name":"Does it have an end date?3","type":"n8n-nodes-base.if","typeVersion":1,"position":[-896,784]},{"parameters":{"content":"## Runs when date is cleared in Notion","height":96.35243080295625,"width":364.9229338011439,"color":7},"id":"8e36b8e7-3775-4869-83fb-b128a52df80d","name":"Sticky Note33","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,1232]},{"parameters":{"operation":"addToDate","magnitude":"={{ $json.notionDate.date.end.toDateTime() }}","duration":1,"outputFieldName":"endDateTime_Adjusted","options":{"includeInputFields":true}},"id":"b18e57db-d610-497c-9170-f6263de9a93b","name":"Add 1 day to end date","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-400,768],"notesInFlow":true,"notes":"Google Calendar and Notion handle end dates differently, when there's no time set.\n\nIf a date in Notion is from Nov-10 to Nov-12, in Google it will show \"Nov-10 at 00:00\" to \"Nov-12 at 00:00\".\nMeaning the event would end at the beggining of the day in Nov-12, not lasting all day.\n\nSo to make an event last all day in Nov-12 you have to make the end_date \"Nov-13 at 00:00\"."},{"parameters":{"operation":"formatDate","date":"={{ $json.endDateTime_Adjusted }}","format":"yyyy-MM-dd","outputFieldName":"endDate_Adjusted","options":{"includeInputFields":true}},"id":"432ee6bc-80c0-4cc1-8bb2-c69a5f165fbe","name":"Format date","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-208,768]},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $json.Globals.calendarId }}/events/{{ $json.GCal_ID }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"bodyParameters":{"parameters":[{"name":"start","value":"={{ {\n  \"dateTime\": null,\n  \"date\": $json.notionDate.date.start\n} }}"},{"name":"end","value":"={{ {\n  \"dateTime\": null,\n  \"date\": $json.endDate_Adjusted\n} }}"},{"name":"summary","value":"={{ $json.notionName }}"},{"name":"status","value":"confirmed"},{"name":"description","value":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>"}]},"options":{}},"id":"46d3139f-8b24-44e9-8103-dac9ea445aa1","name":"Update to All Day event","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[0,768],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $json.Globals.calendarId }}/events/{{ $json.GCal_ID }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"bodyParameters":{"parameters":[{"name":"start","value":"={{ {\n  \"dateTime\": null,\n  \"date\": $json.notionDate.date.start\n} }}"},{"name":"end","value":"={{ {\n  \"dateTime\": null,\n  \"date\": $json.notionDate.date.start\n} }}"},{"name":"summary","value":"={{ $json.notionName }}"},{"name":"status","value":"confirmed"},{"name":"description","value":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>"}]},"options":{}},"id":"e5ef6e90-4f86-4b06-84a8-678b237af8a0","name":"Update to All Day event2","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[0,960],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $json.Globals.calendarId }}/events/{{ $json.GCal_ID }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"bodyParameters":{"parameters":[{"name":"start","value":"={{ {\n  \"dateTime\": $json.notionDate.date.start,\n  \"date\": null\n} }}"},{"name":"end","value":"={{ {\n  \"dateTime\": $json.defaultEndDate,\n  \"date\": null\n} }}"},{"name":"summary","value":"={{ $json.notionName }}"},{"name":"status","value":"confirmed"},{"name":"description","value":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>"}]},"options":{}},"id":"0e0aa769-586a-4621-93f3-e4906b86eb5d","name":"Update dateTime event1","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[0,528],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"operation":"addToDate","magnitude":"={{ $json.notionDate.date.end.toDateTime() }}","duration":1,"outputFieldName":"endDateTime_Adjusted","options":{"includeInputFields":true}},"id":"194f08a3-0ff2-4e34-adae-3940c064a1a7","name":"Add 1 day to end date1","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-576,2480],"notesInFlow":true,"notes":"Google Calendar and Notion handle end dates differently, when there's no time set.\n\nIf a date in Notion is from Nov-10 to Nov-12, in Google it will show \"Nov-10 at 00:00\" to \"Nov-12 at 00:00\".\nMeaning the event would end at the beggining of the day in Nov-12, not lasting all day.\n\nSo to make an event last all day in Nov-12 you have to make the end_date \"Nov-13 at 00:00\"."},{"parameters":{"operation":"formatDate","date":"={{ $json.endDateTime_Adjusted }}","format":"yyyy-MM-dd","outputFieldName":"endDate_Adjusted","options":{"includeInputFields":true}},"id":"728de32f-63ab-47d0-8052-9875d40f5683","name":"Format date1","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-400,2480]},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":1},"conditions":[{"id":"7bcd3c8e-bdae-43d7-9023-a089298db558","leftValue":"={{ $json.last_edited_by.id }}","rightValue":"={{ $json.Globals.n8nConnectionUserId }}","operator":{"type":"string","operation":"equals"}}],"combinator":"and"},"options":{}},"id":"a4d875cd-4b89-43df-881d-cb1d9e01daba","name":"Page edited by a user?","type":"n8n-nodes-base.if","typeVersion":2,"position":[-3216,1648],"notesInFlow":true,"notes":"This prevents infinite loops of pages being edited by n8n and triggering the workflow again and again.\nIt will only update Google Calendar events when a user edits the Notion pages."},{"parameters":{},"id":"91d0c5f5-f784-49b6-9dcb-d06739748a4c","name":"Do nothing","type":"n8n-nodes-base.noOp","typeVersion":1,"position":[-2976,1824]},{"parameters":{"operation":"getAll","calendar":{"__rl":true,"value":"72fb857fe78a97c9ad2d361a2b433518df6549ac7149192c8cca38c73b919eca@group.calendar.google.com","mode":"list","cachedResultName":"Notion Tasks"},"returnAll":true,"options":{"timeMin":"={{ $today.minus(1, 'days') }}"}},"id":"87fdbcfc-32c7-4ffa-9290-0036b69066b7","name":"Get future events + yesterday","type":"n8n-nodes-base.googleCalendar","typeVersion":1.1,"position":[-5344,3392],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}},"disabled":true},{"parameters":{"content":"# Notion ➡ Google","height":80,"width":339.3724182117961,"color":7},"id":"b8160eb8-610a-4722-b9b0-20ce399b28bd","name":"Sticky Note9","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4448,1104]},{"parameters":{"content":"# Google ➡ Notion","height":87.25811154533459,"width":329.84653344771755,"color":7},"id":"d4f87d10-89dc-47f2-bcbd-35e64a975b03","name":"Sticky Note10","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4416,3168]},{"parameters":{"operation":"getTimeBetweenDates","startDate":"={{ $json.extendedProperties.shared.lastUpdatedByAutomation }}","endDate":"={{ $json.updated }}","units":["second"],"options":{"includeInputFields":true}},"id":"b1de33a0-11d1-4290-8074-58fd32d62860","name":"Calculate timeDifference between Google's updated_at  and our own updated_at fields","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-2784,3904]},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"b2b768dd-1682-42c2-9b6a-cd30a25415ba","leftValue":"={{ $json.timeDifference.seconds }}","rightValue":2,"operator":{"type":"number","operation":"gt"}}],"combinator":"and"},"options":{}},"id":"d723105f-4e20-4113-9089-cdd57498b441","name":"Only events that were edited 2s after the last update","type":"n8n-nodes-base.filter","typeVersion":2,"position":[-2576,3904],"notesInFlow":true,"notes":"This prevents an infinite loop.\n\nWhen you edit your Notion page, our automation edits the Google event. This would activate the Google trigger again and again.\n\nUsing the field \"lastUpdatedByAutomation\" we can check if the update happened after our automation ran. Meaning the user was the one that edited the event."},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.start.dateTime }}","operation":"contains","value2":"T"}]}},"id":"23e8233d-e963-4f98-b1bc-409550c82600","name":"Does it have a time?2","type":"n8n-nodes-base.if","typeVersion":1,"position":[-2368,3904]},{"parameters":{"operation":"subtractFromDate","magnitude":"={{ $json.end.date }}","duration":1,"outputFieldName":"notionDateTimeEnd","options":{"includeInputFields":true}},"id":"fe86cc8a-74ad-4866-928b-30904ba0148c","name":"Subtract 1 day from end_date","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-2144,4000],"notesInFlow":true,"notes":"Google Calendar and Notion handle end dates differently, when there's no time set.\n\nIf a date in Notion is from Nov-10 to Nov-12, in Google it will show \"Nov-10 at 00:00\" to \"Nov-12 at 00:00\".\n\nWhen you set an event in Google from Nov-12 to Nov-13, it sets the end date to \"Nov-14 at 00:00\" behind the scenes.\nMeaning the event would end at the beggining of Nov-14, lasting all day long during Nov-13.\n\nBut Notion considers Nov-12 to Nov-13 already as all day dates.\nSo Nov-14 in Google must be Nov-13 in Notion."},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"817652c4-64ad-45d7-800a-c58e2e23f9cc","leftValue":"={{ $json.extendedProperties.shared.lastUpdatedByAutomation }}","rightValue":"","operator":{"type":"string","operation":"notExists","singleValue":true}}],"combinator":"and"},"options":{}},"id":"028f6191-881e-4163-b37f-ceda3f31e026","name":"Is it a new event?","type":"n8n-nodes-base.if","typeVersion":2,"position":[-3040,3744]},{"parameters":{"operation":"formatDate","date":"={{ $json.notionDateTimeEnd }}","format":"yyyy-MM-dd","outputFieldName":"notiondEndDate","options":{"includeInputFields":true}},"id":"332c2892-7052-426b-b326-ed928428c844","name":"Format end_date","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-1936,4000]},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"d92e072a-d10a-462f-8195-74f5b10d2f12","name":"Add extendedProperties to Google event","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[208,352],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"461f22dc-9025-41e6-b193-787007b29a7b","name":"Add extendedProperties to Google event1","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[208,528],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"62fb9d88-ed9f-451b-bb15-4c33a2386565","name":"Add extendedProperties to Google event2","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[208,768],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"c47d6daa-bc99-4e8d-96f4-10722ec06e97","name":"Add extendedProperties to Google event3","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[208,960],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"b552ea10-9df8-4c6e-9597-d42bbd8881ed","name":"Add extendedProperties to Google event4","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[0,1888],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"1869420b-6423-424c-899c-4a1898856f3e","name":"Add extendedProperties to Google event5","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[0,2128],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"750b4e78-c12a-4b65-969a-61fec9991fb1","name":"Add extendedProperties to Google event6","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[0,2480],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"22dc3159-fc84-469b-8471-6d92ef5e01f8","name":"Add extendedProperties to Google event7","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[0,2720],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"a16200de-0d2b-4144-a5ea-77d52e1eed42","leftValue":"={{ $json.start.date }}","rightValue":"={{ $json.notiondEndDate }}","operator":{"type":"string","operation":"notRegex"}}],"combinator":"and"},"options":{}},"id":"27f6758d-0506-4304-a01c-14317870837b","name":"Does it really have an end_date?","type":"n8n-nodes-base.if","typeVersion":2,"position":[-1744,4000]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.start.dateTime }}","operation":"contains","value2":"T"}]}},"id":"523a63a0-f001-428a-9e90-21cb70541b75","name":"Does it have a time?3","type":"n8n-nodes-base.if","typeVersion":1,"position":[-2800,3408]},{"parameters":{"operation":"subtractFromDate","magnitude":"={{ $json.end.date }}","duration":1,"outputFieldName":"notionDateTimeEnd","options":{"includeInputFields":true}},"id":"32ab8ac1-76eb-4e17-9286-fbf034ea27b4","name":"Subtract 1 day from end_date1","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-2576,3504],"notesInFlow":true,"notes":"Google Calendar and Notion handle end dates differently, when there's no time set.\n\nIf a date in Notion is from Nov-10 to Nov-12, in Google it will show \"Nov-10 at 00:00\" to \"Nov-12 at 00:00\".\n\nWhen you set an event in Google from Nov-12 to Nov-13, it sets the end date to \"Nov-14 at 00:00\" behind the scenes.\nMeaning the event would end at the beggining of Nov-14, lasting all day long during Nov-13.\n\nBut Notion considers Nov-12 to Nov-13 already as all day dates.\nSo Nov-14 in Google must be Nov-13 in Notion."},{"parameters":{"operation":"formatDate","date":"={{ $json.notionDateTimeEnd }}","format":"yyyy-MM-dd","outputFieldName":"notiondEndDate","options":{"includeInputFields":true}},"id":"17188880-c182-4f79-82db-e736755f500d","name":"Format end_date1","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-2384,3504]},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":1},"conditions":[{"id":"a16200de-0d2b-4144-a5ea-77d52e1eed42","leftValue":"={{ $json.start.date }}","rightValue":"={{ $json.notiondEndDate }}","operator":{"type":"string","operation":"notRegex"}}],"combinator":"and"},"options":{}},"id":"c7e5169a-c591-49db-80f1-bd63ccadc2d6","name":"Does it really have an end_date?1","type":"n8n-nodes-base.if","typeVersion":2,"position":[-2176,3504]},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"={{ $json.Globals.databaseId }}","mode":"id"},"title":"={{ $json.summary }}","propertiesUi":{"propertyValues":[{"key":"Date|date","range":true,"includeTime":false,"dateStart":"={{ $json.start.date }}","dateEnd":"={{ $json.notiondEndDate }}"},{"key":"GCal ID|rich_text","textContent":"={{ $json.id }}"}]},"options":{}},"id":"0c4783b7-8a09-4279-aca2-0d35b10b4c94","name":"Create page1","type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-1968,3408],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"={{ $json.Globals.databaseId }}","mode":"id"},"title":"={{ $json.summary }}","propertiesUi":{"propertyValues":[{"key":"Date|date","includeTime":false,"date":"={{ $json.start.date }}"},{"key":"GCal ID|rich_text","textContent":"={{ $json.id }}"}]},"options":{}},"id":"11934f18-39ff-451b-b2a8-9483b5ec0628","name":"Create page2","type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-1968,3600],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs1').item.json.Globals.calendarId }}/events/{{ $('Globals1').item.json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $json.id }}\"\n    }\n  },\n  \"description\": \"👉 <a href=https://www.notion.so/{{ $json.id.replaceAll(\"-\", \"\") }} target=_blank><b>View in Notion</b></a>\"\n}","options":{}},"id":"b56b6f7e-adb6-426b-9e50-b122053961b8","name":"Add extendedProperties to Google event8","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[-2384,3312],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs1').item.json.Globals.calendarId }}/events/{{ $('Globals1').item.json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $json.id }}\"\n    }\n  },\n  \"description\": \"👉 <a href=https://www.notion.so/{{ $json.id.replaceAll(\"-\", \"\") }} target=_blank><b>View in Notion</b></a>\"\n}","options":{}},"id":"035f9214-f705-4f35-a949-5618338e629d","name":"Add extendedProperties to Google event9","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[-1776,3408],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs1').item.json.Globals.calendarId }}/events/{{ $('Globals1').item.json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $json.id }}\"\n    }\n  },\n  \"description\": \"👉 <a href=https://www.notion.so/{{ $json.id.replaceAll(\"-\", \"\") }} target=_blank><b>View in Notion</b></a>\"\n}","options":{}},"id":"d0d15591-14e0-487c-9891-a7790e9f3115","name":"Add extendedProperties to Google event10","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[-1776,3600],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"mode":"raw","jsonOutput":"{\n  \"Globals\": {\n    \n    \"n8nConnectionUserId\": \"a07174da-0c76-4695-a1e1-ceab14e1c47e\",\n    \n    \"Todo\": {\n      \"databaseId\": \"218dcbfd-8835-8008-a2bd-c164ab084ed3\",\n      \"calendarId\": \"b0fdadc0038eaed12fbcdb9a4130a3ae4c1ffd36c1ce9ce62221cd77b6196164@group.calendar.google.com\"\n    },\n\n    \"Meetings\": {\n      \"databaseId\": \"24ddcbfd-8835-80fe-ab1d-fa7270343d5b\",\n      \"calendarId\": \"293ead77ad5a26298e15cd8a36e87b3c22311f4f15b3e783ce1ace367ce04911@group.calendar.google.com\"\n    }\n  }\n}","includeOtherFields":true,"options":{}},"id":"fcd63f6a-a0d2-440d-bc8c-f56ec6375bfe","name":"Globals","type":"n8n-nodes-base.set","typeVersion":3.4,"position":[-3808,1648]},{"parameters":{"content":"# Set some variables here\n## 1️⃣ n8nConnectionUserId\nWhen a page is edited in Notion it registers the ID of the user that made the change.\n\nTo find out what's the ID for your n8n user, use a Notion node to create a database page and check the 'last_edited_by' field.\n\n\n\n\n## 2️⃣ Database and Calendar IDs\nFor each database you want to sync, you have to add the Notion **databaseId** and Google **calendarId** in JSON objects like this:\n\nTasks: {\n   databaseId: \"`72fb8-57fe78a-sgf976`\",\n   calendarId: \"`73b919eca@group.calendar.google.com`\"\n },\n\nMeetings: {\n    databaseId: \"`157fe-78a23f-dfs978`\",\n    calendarId: \"`2a384hfy@group.calendar.google.com`\"\n  }\n\n## 🚨🚨🚨 ATTENTION 🚨🚨🚨\nThe databaseId must include the hyphens, like this:\n`d6e15d95-c538-4795-b1d8-0e5gc778c03c`\n\nThe pattern is:\n8 characters - 4 characters - 4 characters - 4 characters - 12 characters.","height":1341,"width":399},"id":"85fd1c5a-6985-4deb-b705-e6f4f33c1b08","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-3952,832]},{"parameters":{"jsCode":"const items = $input.all();\nconst updatedItems = items.map(item => {\n  const databaseId = item.json.parent.database_id;\n  let currentCalendarId = null;\n\n  // Searches the Globals object to find the matching field\n  for (const key in item.json.Globals) {\n    if (item.json.Globals[key].databaseId === databaseId) {\n      currentCalendarId = item.json.Globals[key].calendarId;\n      break;\n    }\n  }\n\n  // Rebuild the Globals object with only the desired fields\n  item.json.Globals = {\n    n8nConnectionUserId: item.json.Globals.n8nConnectionUserId,\n    calendarId: currentCalendarId,\n    databaseId: databaseId\n  };\n  \n  return item;\n});\n\nreturn updatedItems;"},"id":"a43e972c-66cd-47c3-9a32-1abc3f87ea88","name":"Set the current database and calendar IDs","type":"n8n-nodes-base.code","typeVersion":2,"position":[-3488,1648]},{"parameters":{"content":"# Copy the Globals from above and paste here","height":388.29901720463954,"width":319.61007431942534},"id":"f3095195-c460-4d53-962e-bc1cd0f25e0d","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-3904,3552]},{"parameters":{"mode":"raw","jsonOutput":"{\n  \"Globals\": {\n    \n    \"n8nConnectionUserId\": \"a07174da-0c76-4695-a1e1-ceab14e1c47e\",\n    \n    \"Todo\": {\n      \"databaseId\": \"218dcbfd-8835-8008-a2bd-c164ab084ed3\",\n      \"calendarId\": \"b0fdadc0038eaed12fbcdb9a4130a3ae4c1ffd36c1ce9ce62221cd77b6196164@group.calendar.google.com\"\n    },\n\n    \"Meetings\": {\n      \"databaseId\": \"24ddcbfd-8835-80fe-ab1d-fa7270343d5b\",\n      \"calendarId\": \"293ead77ad5a26298e15cd8a36e87b3c22311f4f15b3e783ce1ace367ce04911@group.calendar.google.com\"\n    }\n  }\n}","includeOtherFields":true,"options":{}},"id":"822e26b0-dc8a-4384-95f6-c6b4ebe80324","name":"Globals1","type":"n8n-nodes-base.set","typeVersion":3.4,"position":[-3808,3744]},{"parameters":{"content":"# Copy the Globals from above and paste here","height":380.06310703196385,"width":319.61007431942534},"id":"01f45974-d722-462f-a5cf-853c8334b4b0","name":"Sticky Note14","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-3904,4512]},{"parameters":{"mode":"raw","jsonOutput":"{\n  \"Globals\": {\n    \n    \"n8nConnectionUserId\": \"a07174da-0c76-4695-a1e1-ceab14e1c47e\",\n    \n    \"Todo\": {\n      \"databaseId\": \"218dcbfd-8835-8008-a2bd-c164ab084ed3\",\n      \"calendarId\": \"b0fdadc0038eaed12fbcdb9a4130a3ae4c1ffd36c1ce9ce62221cd77b6196164@group.calendar.google.com\"\n    },\n\n    \"Meetings\": {\n      \"databaseId\": \"24ddcbfd-8835-80fe-ab1d-fa7270343d5b\",\n      \"calendarId\": \"293ead77ad5a26298e15cd8a36e87b3c22311f4f15b3e783ce1ace367ce04911@group.calendar.google.com\"\n    }\n  }\n}","includeOtherFields":true,"options":{}},"id":"a71e1780-0a81-4283-bd90-4edb91f43ed1","name":"Globals2","type":"n8n-nodes-base.set","typeVersion":3.4,"position":[-3808,4704]},{"parameters":{"jsCode":"const items = $input.all();\nconst updatedItems = items.map(item => {\n  const calendarId = item.json.organizer.email;\n  let currentDatabaseId = null;\n\n  // Searches the Globals object to find the matching field\n  for (const key in item.json.Globals) {\n    if (item.json.Globals[key].calendarId === calendarId) {\n      currentDatabaseId = item.json.Globals[key].databaseId;\n      break;\n    }\n  }\n\n  // Rebuild the Globals object with only the desired fields\n  item.json.Globals = {\n    n8nConnectionUserId: item.json.Globals.n8nConnectionUserId,\n    calendarId: calendarId,\n    databaseId: currentDatabaseId\n  };\n  \n  return item;\n});\n\nreturn updatedItems;"},"id":"f63a74bd-5b03-492a-8781-81f4653ee736","name":"Set the current database and calendar IDs2","type":"n8n-nodes-base.code","typeVersion":2,"position":[-3504,4704]},{"parameters":{"content":"## Use this node for testing\nReplace the Event Updated trigger by this node","height":305.14255210487977,"width":315.66399727154976},"id":"2f065a63-081b-46fd-a050-9503dc4283ef","name":"Sticky Note16","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-5408,3264]},{"parameters":{"content":"## Add two triggers for each Google Calendar that you want to sync","height":665.1419819421769,"width":365.7122508375314},"id":"e33a5c29-9f61-4792-b8ae-f6966d6fc01e","name":"Sticky Note17","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4448,3264]},{"parameters":{"content":"## Add one trigger for each Google Calendar that you want to sync","height":641.5966864244806,"width":283.9419368038477},"id":"6e76f0ea-3cfc-4e77-8860-2e39efda2637","name":"Sticky Note34","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4400,4240]},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"calendarId":{"__rl":true,"value":"b0fdadc0038eaed12fbcdb9a4130a3ae4c1ffd36c1ce9ce62221cd77b6196164@group.calendar.google.com","mode":"list","cachedResultName":"TodoCal"},"triggerOn":"eventUpdated","options":{}},"id":"4a8ebaba-a33f-43d9-bb8a-4c2987022271","name":"Event Updated","type":"n8n-nodes-base.googleCalendarTrigger","typeVersion":1,"position":[-4240,3392],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{},"id":"3202a4f1-ae29-4bd5-8648-491691b3555d","name":"When clicking \"Test workflow\"","type":"n8n-nodes-base.manualTrigger","typeVersion":1,"position":[-5696,1584],"disabled":true},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"calendarId":{"__rl":true,"value":"b0fdadc0038eaed12fbcdb9a4130a3ae4c1ffd36c1ce9ce62221cd77b6196164@group.calendar.google.com","mode":"list","cachedResultName":"TodoCal"},"triggerOn":"eventCreated","options":{}},"id":"5e50a422-d3a6-49dc-9196-a2c306dc104a","name":"Event Created","type":"n8n-nodes-base.googleCalendarTrigger","typeVersion":1,"position":[-4400,3392],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"content":"# Todo","height":99.22146266772059,"width":196.39800582684305,"color":7},"id":"9085512b-d5b5-4f94-a8e8-732421f4f73a","name":"Sticky Note35","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4656,3392]},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $json.extendedProperties.shared.notionPageId }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"Data|date","includeTime":false,"date":"={{ $json.start.date }}"},{"key":"Task name|title","title":"={{ $json.summary }}"}]},"options":{}},"id":"c81ebbc4-3c67-4fc7-a097-8d46b701257e","name":"Update page1 - continue on error","type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-1520,4112],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}},"onError":"continueRegularOutput"},{"parameters":{"content":"### Allowing these Notion nodes to continue on error prevents deleted pages from stopping the workflow.\n\nThe deleted pages go to another branch to be deleted in Google Calendar.","height":324.9384888466118,"color":7},"id":"9b9654c3-8a28-4317-adaf-61d42ba76cd3","name":"Sticky Note36","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-1344,3920]},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"186dc8f2-4a6d-416c-9900-1b4ee8e7418b","leftValue":"={{ $json.in_trash }}","rightValue":"true","operator":{"type":"boolean","operation":"true","singleValue":true}}],"combinator":"and"},"options":{}},"id":"18ebca7d-c1db-4f1d-9996-650c761b7f5d","name":"Find deleted pages1","type":"n8n-nodes-base.filter","typeVersion":2,"position":[-2576,2352]},{"parameters":{"operation":"delete","calendar":{"__rl":true,"value":"={{ $('Only calendarId').item.json.calendarId }}","mode":"id"},"eventId":"={{ $json.properties['GCal ID'].rich_text[0].text.content }}","options":{}},"id":"5abf4fe6-182f-4465-9b8d-9b740b52bc51","name":"Delete event3","type":"n8n-nodes-base.googleCalendar","typeVersion":1,"position":[-2400,2352],"alwaysOutputData":false,"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"content":"## This flow checks if any Notion page was deleted and deletes the event\nWe have to do this because there's no way to retrieve deleted pages using the Notion API.\n\nAnd the \"page updated\" trigger uses the Notion API to check for updates, so it never detects when a page was deleted.","height":306.9481514579442,"width":286.9846072927019,"color":7},"id":"04003654-cb29-4d19-9703-317d0711bd0b","name":"Sticky Note38","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4416,2224]},{"parameters":{"operation":"getAll","calendar":{"__rl":true,"value":"={{ $json.calendarId }}","mode":"id"},"returnAll":true,"options":{"timeMin":"={{ $today.minus(1, 'days') }}"}},"id":"4cb9d9b8-fb26-466d-a75a-307f1ad745eb","name":"Get future events1","type":"n8n-nodes-base.googleCalendar","typeVersion":1.1,"position":[-3120,2352],"alwaysOutputData":false,"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"resource":"databasePage","operation":"get","pageId":{"__rl":true,"value":"={{ $json.extendedProperties.shared.notionPageId }}","mode":"id"},"simple":false},"id":"c802a95b-2288-4518-98e6-5f6cc70f77ae","name":"Find related pages1","type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-2768,2352],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"7a2065ef-7d16-4d67-aea0-e2d9185562cd","leftValue":"={{ $json.extendedProperties.shared.notionPageId }}","rightValue":"","operator":{"type":"string","operation":"exists","singleValue":true}}],"combinator":"and"},"options":{}},"id":"93d701bb-7a25-4f20-9c07-daf1b7ad5cc8","name":"extendedProperties exist?","type":"n8n-nodes-base.filter","typeVersion":2,"position":[-2944,2352]},{"parameters":{"jsCode":"const items = $input.all();\nconst updatedItems = items.map(item => {\n  const calendarId = item.json.organizer.email;\n  let currentDatabaseId = null;\n\n  // Searches the Globals object to find the matching field\n  for (const key in item.json.Globals) {\n    if (item.json.Globals[key].calendarId === calendarId) {\n      currentDatabaseId = item.json.Globals[key].databaseId;\n      break;\n    }\n  }\n\n  // Rebuild the Globals object with only the desired fields\n  item.json.Globals = {\n    n8nConnectionUserId: item.json.Globals.n8nConnectionUserId,\n    calendarId: calendarId,\n    databaseId: currentDatabaseId\n  };\n  \n  return item;\n});\n\nreturn updatedItems;"},"id":"895b9242-77a4-4ae9-8782-508a115e7209","name":"Set the current database and calendar IDs1","type":"n8n-nodes-base.code","typeVersion":2,"position":[-3504,3744]},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $json.extendedProperties.shared.notionPageId }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"Date|date","range":true,"dateStart":"={{ $json.start.dateTime }}","dateEnd":"={{ $json.end.dateTime }}"},{"key":"Name|title","title":"={{ $json.summary }}"}]},"options":{}},"id":"31a38dde-2434-4b7e-9bef-61913b2e3de0","name":"Update page2 - continue on error","type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-2144,3808],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}},"onError":"continueRegularOutput"},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $json.extendedProperties.shared.notionPageId }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"Date|date","range":true,"includeTime":false,"dateStart":"={{ $json.start.date }}","dateEnd":"={{ $json.notiondEndDate }}"},{"key":"Name|title","title":"={{ $json.summary }}"}]},"options":{}},"id":"b59ec774-7c0d-43bd-8573-8c5fe261651b","name":"Update page - continue on error","type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-1520,3920],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}},"onError":"continueRegularOutput"},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"={{ $json.Globals.databaseId }}","mode":"id"},"title":"={{ $json.summary }}","propertiesUi":{"propertyValues":[{"key":"Date|date","range":true,"dateStart":"={{ $json.start.dateTime }}","dateEnd":"={{ $json.end.dateTime }}"},{"key":"GCal ID|rich_text","textContent":"={{ $json.id }}"}]},"options":{}},"id":"96245a5f-7c2d-482e-b454-5dd7d7560421","name":"Create page","type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-2576,3312],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $json.Globals.calendarId }}/events/{{ $json.GCal_ID }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"bodyParameters":{"parameters":[{"name":"start","value":"={{ {\n  \"dateTime\": $json.notionDate.date.start,\n  \"date\": null\n} }}"},{"name":"end","value":"={{ {\n  \"dateTime\": $json.notionDate.date.end,\n  \"date\": null\n} }}"},{"name":"summary","value":"={{ $json.notionName }}"},{"name":"status","value":"confirmed"},{"name":"description","value":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>"}]},"options":{}},"id":"0df6d670-e9d8-4ba7-9384-94d8343e1802","name":"Update dateTime event","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[0,352],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"fields":{"values":[{"name":"notionID","stringValue":"={{ $json.id }}"},{"name":"notionName","stringValue":"={{ $json.properties['Name'].title[0].text.content }}"},{"name":"notionDate","type":"objectValue","objectValue":"={{ $json.properties.Date }}"},{"name":"GCal_ID","stringValue":"={{ $json.properties['GCal ID'].rich_text[0].text.content }}"}]},"include":"selected","includeFields":"archived,Globals","options":{}},"id":"bf2580ba-ba7f-4d27-9e6e-98f3d1c258f4","name":"Set some fields","type":"n8n-nodes-base.set","typeVersion":3.2,"position":[-2976,1632]},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"event":"pagedUpdatedInDatabase","databaseId":{"__rl":true,"value":"24ddcbfd-8835-80fe-ab1d-fa7270343d5b","mode":"list","cachedResultName":"Meetings","cachedResultUrl":"https://www.notion.so/24ddcbfd883580feab1dfa7270343d5b"},"simple":false},"id":"8c320c76-8beb-4761-8814-8c6100255935","name":"Page Updated - Meetings","type":"n8n-nodes-base.notionTrigger","typeVersion":1,"position":[-4336,1520],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"calendarId":{"__rl":true,"value":"293ead77ad5a26298e15cd8a36e87b3c22311f4f15b3e783ce1ace367ce04911@group.calendar.google.com","mode":"list","cachedResultName":"MeetingsCal"},"triggerOn":"eventUpdated","options":{}},"id":"6692565e-e61a-49cd-9789-3c78bc0b72e8","name":"Event Updated1","type":"n8n-nodes-base.googleCalendarTrigger","typeVersion":1,"position":[-4240,3584],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"calendarId":{"__rl":true,"value":"293ead77ad5a26298e15cd8a36e87b3c22311f4f15b3e783ce1ace367ce04911@group.calendar.google.com","mode":"list","cachedResultName":"MeetingsCal"},"triggerOn":"eventCreated","options":{}},"id":"a8e14c2a-d405-43fb-9559-a0cffd33fad2","name":"Event Created1","type":"n8n-nodes-base.googleCalendarTrigger","typeVersion":1,"position":[-4400,3584],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"content":"# Meetings","height":99.22146266772059,"width":196.39800582684305,"color":7},"id":"90160027-55a7-4ecf-9ac5-deb7c829ee82","name":"Sticky Note37","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4656,3584]},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"calendarId":{"__rl":true,"value":"293ead77ad5a26298e15cd8a36e87b3c22311f4f15b3e783ce1ace367ce04911@group.calendar.google.com","mode":"list","cachedResultName":"MeetingsCal"},"triggerOn":"eventCancelled","options":{}},"id":"6c8df852-14cd-4404-b3ff-3dcd9a964b8e","name":"Deleted - Meetings","type":"n8n-nodes-base.googleCalendarTrigger","typeVersion":1,"position":[-4320,4560],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"mode":"raw","jsonOutput":"{\n  \"Globals\": {\n    \n    \"n8nConnectionUserId\": \"a07174da-0c76-4695-a1e1-ceab14e1c47e\",\n    \n    \"Todo\": {\n      \"databaseId\": \"218dcbfd-8835-8008-a2bd-c164ab084ed3\",\n      \"calendarId\": \"b0fdadc0038eaed12fbcdb9a4130a3ae4c1ffd36c1ce9ce62221cd77b6196164@group.calendar.google.com\"\n    },\n\n    \"Meetings\": {\n      \"databaseId\": \"24ddcbfd-8835-80fe-ab1d-fa7270343d5b\",\n      \"calendarId\": \"293ead77ad5a26298e15cd8a36e87b3c22311f4f15b3e783ce1ace367ce04911@group.calendar.google.com\"\n    }\n  }\n}","includeOtherFields":true,"options":{}},"id":"38d1af2c-1a4c-4b16-a90c-5fd9c348d2de","name":"Globals3","type":"n8n-nodes-base.set","typeVersion":3.4,"position":[-3808,2352]},{"parameters":{"fieldToSplitOut":"Globals","options":{}},"id":"26a62f8e-faaf-486f-a816-6bf69d3be974","name":"Split fields","type":"n8n-nodes-base.splitOut","typeVersion":1,"position":[-3552,2336]},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"b2a5f692-c6c4-4691-b5cf-fcf57bcd2523","leftValue":"={{ $json.calendarId }}","rightValue":"","operator":{"type":"string","operation":"exists","singleValue":true}}],"combinator":"and"},"options":{}},"id":"8b78d9d3-aa6f-4f15-91b2-a67382f89355","name":"Only calendarId","type":"n8n-nodes-base.filter","typeVersion":2,"position":[-3296,2352]},{"parameters":{"content":"# Copy the Globals from above and paste here","height":388.29901720463954,"width":319.61007431942534},"id":"604eac52-2523-40a1-93b2-d935c72554dc","name":"Sticky Note41","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-3904,2144]},{"parameters":{"rule":{"interval":[{"field":"minutes","minutesInterval":3}]}},"id":"110eb4dc-9241-4aba-9b56-3b1350e1a49f","name":"Every 3min","type":"n8n-nodes-base.scheduleTrigger","typeVersion":1.2,"position":[-4080,2352]},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"event":"pagedUpdatedInDatabase","databaseId":{"__rl":true,"value":"218dcbfd-8835-8008-a2bd-c164ab084ed3","mode":"list","cachedResultName":"TODO ","cachedResultUrl":"https://www.notion.so/218dcbfd88358008a2bdc164ab084ed3"},"simple":false},"id":"8f5d70af-8d96-43ef-acaf-2a86e03b289f","name":"Page Updated - Todo","type":"n8n-nodes-base.notionTrigger","typeVersion":1,"position":[-4336,1344],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"calendarId":{"__rl":true,"value":"b0fdadc0038eaed12fbcdb9a4130a3ae4c1ffd36c1ce9ce62221cd77b6196164@group.calendar.google.com","mode":"list","cachedResultName":"TodoCal"},"triggerOn":"eventCancelled","options":{}},"id":"a7ecd994-944d-4948-ba0f-e8e7dcd1872e","name":"Deleted - Todo","type":"n8n-nodes-base.googleCalendarTrigger","typeVersion":1,"position":[-4320,4384],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}}],"connections":{"Google Calendar1":{"main":[[{"node":"Add extendedProperties to Google event6","type":"main","index":0}]]},"Add GCal ID":{"main":[[{"node":"Loop","type":"main","index":0}]]},"Remove GCal ID2":{"main":[[{"node":"Loop3","type":"main","index":0}]]},"Does it have a date?":{"main":[[{"node":"Does it have a time?","type":"main","index":0}],[{"node":"Loop3","type":"main","index":0}]]},"Does it have a time?":{"main":[[{"node":"Does it have an end date?1","type":"main","index":0}],[{"node":"Does it have an end date?3","type":"main","index":0}]]},"Delete event1":{"main":[[{"node":"Remove GCal ID2","type":"main","index":0}]]},"Does it have a date?1":{"main":[[{"node":"Does it have a time?1","type":"main","index":0}],[{"node":"No Operation, do nothing","type":"main","index":0}]]},"Does it have a time?1":{"main":[[{"node":"Does it have an end date?","type":"main","index":0}],[{"node":"Does it have an end date?2","type":"main","index":0}]]},"Find Task":{"main":[[{"node":"Remove GCal ID and Date","type":"main","index":0}]]},"Notion":{"main":[[{"node":"Merge","type":"main","index":0}]]},"Google Calendar3":{"main":[[{"node":"Add extendedProperties to Google event5","type":"main","index":0}]]},"Google Calendar":{"main":[[{"node":"Add extendedProperties to Google event4","type":"main","index":0}]]},"Add GCal ID3":{"main":[[{"node":"Loop2","type":"main","index":0}]]},"Does it have an end date?":{"main":[[{"node":"Loop2","type":"main","index":0}],[{"node":"Loop1","type":"main","index":0}]]},"Add GCal ID1":{"main":[[{"node":"Loop1","type":"main","index":0}]]},"Loop":{"main":[[],[{"node":"Add 1 day to end date1","type":"main","index":0}]]},"Loop1":{"main":[[],[{"node":"Google Calendar3","type":"main","index":0}]]},"Loop2":{"main":[[],[{"node":"Google Calendar","type":"main","index":0}]]},"Loop3":{"main":[[],[{"node":"Delete event1","type":"main","index":0}]]},"Creates defaultEndDate with 1h duration":{"main":[[{"node":"GCal_ID exists in Notion?","type":"main","index":0}]]},"Delete event2":{"main":[[{"node":"Loop4","type":"main","index":0}]]},"Loop4":{"main":[[],[{"node":"Delete event2","type":"main","index":0}]]},"Notion1":{"main":[[{"node":"Merge","type":"main","index":1}]]},"Does it have an end date?1":{"main":[[{"node":"Update dateTime event","type":"main","index":0}],[{"node":"Update dateTime event1","type":"main","index":0}]]},"Does it have an end date?2":{"main":[[{"node":"Loop","type":"main","index":0}],[{"node":"Loop5","type":"main","index":0}]]},"Google Calendar2":{"main":[[{"node":"Add extendedProperties to Google event7","type":"main","index":0}]]},"Add GCal ID2":{"main":[[{"node":"Loop5","type":"main","index":0}]]},"Loop5":{"main":[[],[{"node":"Google Calendar2","type":"main","index":0}]]},"GCal_ID exists in Notion?":{"main":[[{"node":"Is the page deleted?","type":"main","index":0}],[{"node":"Does it have a date?1","type":"main","index":0}]]},"Is the page deleted?":{"main":[[{"node":"Loop4","type":"main","index":0}],[{"node":"Does it have a date?","type":"main","index":0}]]},"Does it have an end date?3":{"main":[[{"node":"Add 1 day to end date","type":"main","index":0}],[{"node":"Update to All Day event2","type":"main","index":0}]]},"Add 1 day to end date":{"main":[[{"node":"Format date","type":"main","index":0}]]},"Format date":{"main":[[{"node":"Update to All Day event","type":"main","index":0}]]},"Update to All Day event":{"main":[[{"node":"Add extendedProperties to Google event2","type":"main","index":0}]]},"Update to All Day event2":{"main":[[{"node":"Add extendedProperties to Google event3","type":"main","index":0}]]},"Update dateTime event1":{"main":[[{"node":"Add extendedProperties to Google event1","type":"main","index":0}]]},"Add 1 day to end date1":{"main":[[{"node":"Format date1","type":"main","index":0}]]},"Format date1":{"main":[[{"node":"Google Calendar1","type":"main","index":0}]]},"Page edited by a user?":{"main":[[{"node":"Set some fields","type":"main","index":0}],[{"node":"Do nothing","type":"main","index":0}]]},"Calculate timeDifference between Google's updated_at  and our own updated_at fields":{"main":[[{"node":"Only events that were edited 2s after the last update","type":"main","index":0}]]},"Only events that were edited 2s after the last update":{"main":[[{"node":"Does it have a time?2","type":"main","index":0}]]},"Does it have a time?2":{"main":[[{"node":"Update page2 - continue on error","type":"main","index":0}],[{"node":"Subtract 1 day from end_date","type":"main","index":0}]]},"Subtract 1 day from end_date":{"main":[[{"node":"Format end_date","type":"main","index":0}]]},"Is it a new event?":{"main":[[{"node":"Does it have a time?3","type":"main","index":0}],[{"node":"Calculate timeDifference between Google's updated_at  and our own updated_at fields","type":"main","index":0}]]},"Format end_date":{"main":[[{"node":"Does it really have an end_date?","type":"main","index":0}]]},"Add extendedProperties to Google event4":{"main":[[{"node":"Add GCal ID3","type":"main","index":0}]]},"Add extendedProperties to Google event5":{"main":[[{"node":"Add GCal ID1","type":"main","index":0}]]},"Add extendedProperties to Google event6":{"main":[[{"node":"Add GCal ID","type":"main","index":0}]]},"Add extendedProperties to Google event7":{"main":[[{"node":"Add GCal ID2","type":"main","index":0}]]},"Does it really have an end_date?":{"main":[[{"node":"Update page - continue on error","type":"main","index":0}],[{"node":"Update page1 - continue on error","type":"main","index":0}]]},"Does it have a time?3":{"main":[[{"node":"Create page","type":"main","index":0}],[{"node":"Subtract 1 day from end_date1","type":"main","index":0}]]},"Subtract 1 day from end_date1":{"main":[[{"node":"Format end_date1","type":"main","index":0}]]},"Format end_date1":{"main":[[{"node":"Does it really have an end_date?1","type":"main","index":0}]]},"Does it really have an end_date?1":{"main":[[{"node":"Create page1","type":"main","index":0}],[{"node":"Create page2","type":"main","index":0}]]},"Create page1":{"main":[[{"node":"Add extendedProperties to Google event9","type":"main","index":0}]]},"Create page2":{"main":[[{"node":"Add extendedProperties to Google event10","type":"main","index":0}]]},"Globals":{"main":[[{"node":"Set the current database and calendar IDs","type":"main","index":0}]]},"Set the current database and calendar IDs":{"main":[[{"node":"Page edited by a user?","type":"main","index":0}]]},"Globals1":{"main":[[{"node":"Set the current database and calendar IDs1","type":"main","index":0}]]},"Globals2":{"main":[[{"node":"Set the current database and calendar IDs2","type":"main","index":0}]]},"Set the current database and calendar IDs2":{"main":[[{"node":"Find Task","type":"main","index":0}]]},"Event Updated":{"main":[[{"node":"Globals1","type":"main","index":0}]]},"When clicking \"Test workflow\"":{"main":[[{"node":"Notion1","type":"main","index":0},{"node":"Notion","type":"main","index":0}]]},"Event Created":{"main":[[{"node":"Globals1","type":"main","index":0}]]},"Find deleted pages1":{"main":[[{"node":"Delete event3","type":"main","index":0}]]},"Get future events1":{"main":[[{"node":"extendedProperties exist?","type":"main","index":0}]]},"Find related pages1":{"main":[[{"node":"Find deleted pages1","type":"main","index":0}]]},"extendedProperties exist?":{"main":[[{"node":"Find related pages1","type":"main","index":0}]]},"Set the current database and calendar IDs1":{"main":[[{"node":"Is it a new event?","type":"main","index":0}]]},"Create page":{"main":[[{"node":"Add extendedProperties to Google event8","type":"main","index":0}]]},"Update dateTime event":{"main":[[{"node":"Add extendedProperties to Google event","type":"main","index":0}]]},"Set some fields":{"main":[[{"node":"Creates defaultEndDate with 1h duration","type":"main","index":0}]]},"Event Updated1":{"main":[[{"node":"Globals1","type":"main","index":0}]]},"Event Created1":{"main":[[{"node":"Globals1","type":"main","index":0}]]},"Deleted - Meetings":{"main":[[{"node":"Globals2","type":"main","index":0}]]},"Globals3":{"main":[[{"node":"Split fields","type":"main","index":0}]]},"Split fields":{"main":[[{"node":"Only calendarId","type":"main","index":0}]]},"Only calendarId":{"main":[[{"node":"Get future events1","type":"main","index":0}]]},"Every 3min":{"main":[[{"node":"Globals3","type":"main","index":0}]]},"Page Updated - Meetings":{"main":[[{"node":"Globals","type":"main","index":0}]]},"Page Updated - Todo":{"main":[[{"node":"Globals","type":"main","index":0}]]},"Deleted - Todo":{"main":[[{"node":"Globals2","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":null,"pinData":{},"versionId":"c57870cd-2a59-4a4c-8ba5-dc9dc29bcb0a","triggerCount":0,"tags":[],"shared":[{"createdAt":"2025-08-20T14:46:46.122Z","updatedAt":"2025-08-20T14:46:46.122Z","role":"workflow:owner","workflowId":"wpmnpYETSutrBAk8","projectId":"DQC8ik4pLkhZ4ZDm","project":{"createdAt":"2025-08-19T19:25:16.723Z","updatedAt":"2025-08-19T19:26:16.591Z","id":"DQC8ik4pLkhZ4ZDm","name":"Ben Hex <bhochster@gmail.com>","type":"personal","icon":null,"description":null}}]},{"createdAt":"2025-08-20T15:06:24.494Z","updatedAt":"2025-09-11T23:48:47.000Z","id":"Hzl9tkzVfFoRv6Gq","name":"My workflow 5","active":false,"isArchived":true,"nodes":[{"parameters":{"calendar":{"__rl":true,"value":"={{ $json.Globals.calendarId }}","mode":"id"},"start":"={{ $json.notionDate.date.start }}","end":"={{ $json.endDateTime_Adjusted }}","additionalFields":{"allday":"yes","description":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>","summary":"={{ $json[\"notionName\"] }}"}},"id":"1bc88089-3012-4a4a-848e-337c290ac9e9","name":"Google Calendar1","type":"n8n-nodes-base.googleCalendar","typeVersion":1,"position":[-208,2480],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $('Loop').item.json.notionID }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"GCal ID|rich_text","textContent":"={{ $json.id }}"}]},"options":{}},"id":"a9762779-826a-46df-8ac9-930d7a4cdc47","name":"Add GCal ID","type":"n8n-nodes-base.notion","typeVersion":2,"position":[208,2480],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{},"id":"03fbc7af-7949-4be6-94e1-c576eda25539","name":"No Operation, do nothing","type":"n8n-nodes-base.noOp","typeVersion":1,"position":[-1360,2400]},{"parameters":{"content":"# Create event","height":80,"width":288.259119644621,"color":7},"id":"21f10db3-a81b-40b0-a5ba-1e44dbb1e9dc","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-1888,2304]},{"parameters":{"content":"# Update Event","height":80,"width":299.54925745153224,"color":7},"id":"f337fc2b-bcab-45dc-9050-ce4299c0db41","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-2208,768]},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $('Loop3').item.json.notionID }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"GCal ID|rich_text"}]},"options":{}},"id":"8d9dbe7d-8ef8-4b30-8156-0bb79fb48ba3","name":"Remove GCal ID2","type":"n8n-nodes-base.notion","typeVersion":2,"position":[208,1232],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"content":"## This flow deletes GCal ID and Date, when the event is cancelled in Google.","height":162.57090146831365,"width":256.72937811647864,"color":7},"id":"62e9c4a3-b846-46fe-9f4b-81acb929dac6","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4688,4464]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date }}","operation":"isNotEmpty"}]}},"id":"61fca3df-0bcf-4d3b-b920-772dba3d66d3","name":"Does it have a date?","type":"n8n-nodes-base.if","typeVersion":1,"position":[-1584,784]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date.start }}","operation":"contains","value2":"T"}]}},"id":"aea05ab2-050f-4ece-aae7-e529cef83b34","name":"Does it have a time?","type":"n8n-nodes-base.if","typeVersion":1,"position":[-1184,688]},{"parameters":{"operation":"delete","calendar":{"__rl":true,"value":"={{ $json.Globals.calendarId }}","mode":"id"},"eventId":"={{ $json.GCal_ID }}","options":{}},"id":"da5399b5-a4a3-4905-86c7-6c1aac74188b","name":"Delete event1","type":"n8n-nodes-base.googleCalendar","typeVersion":1,"position":[0,1232],"alwaysOutputData":false,"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date }}","operation":"isNotEmpty"}]}},"id":"f47f4353-d399-4d66-9839-f455d5e80072","name":"Does it have a date?1","type":"n8n-nodes-base.if","typeVersion":1,"position":[-1584,2304]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date.start }}","operation":"contains","value2":"T"}]}},"id":"684fa698-8fdb-4b83-9841-712e802bdedb","name":"Does it have a time?1","type":"n8n-nodes-base.if","typeVersion":1,"position":[-1360,2240]},{"parameters":{"resource":"databasePage","operation":"getAll","databaseId":{"__rl":true,"value":"={{ $json.Globals.databaseId }}","mode":"id"},"returnAll":true,"filterType":"manual","filters":{"conditions":[{"key":"GCal ID|rich_text","condition":"equals","richTextValue":"={{ $json.id }}"}]},"options":{}},"id":"00d51842-6590-4e2b-a7b4-9e9b171320f9","name":"Find Task","type":"n8n-nodes-base.notion","typeVersion":2,"position":[-3264,4704]},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $json.id }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"GCal ID|rich_text"},{"key":"Date|date"}]},"options":{}},"id":"38d052a5-4ee1-46f0-9c69-256e5e1cdac1","name":"Remove GCal ID and Date","type":"n8n-nodes-base.notion","typeVersion":2,"position":[-3024,4704]},{"parameters":{"resource":"databasePage","operation":"getAll","databaseId":{"__rl":true,"value":"dad4835c-1acc-4209-aac2-11440b13c475","mode":"list","cachedResultName":"Tasks","cachedResultUrl":"https://www.notion.so/dad4835c1acc4209aac211440b13c475"},"returnAll":true,"simple":false,"filterType":"manual","matchType":"allFilters","filters":{"conditions":[{"key":"Data|date","condition":"is_not_empty"},{"key":"Status|status","condition":"does_not_equal","statusValue":"Done"},{"key":"Status|status","condition":"does_not_equal","statusValue":"Archived"}]},"options":{}},"id":"1420ce66-8cb5-4abc-8b9f-423b41d1732e","name":"Notion","type":"n8n-nodes-base.notion","typeVersion":2.1,"position":[-5376,1504]},{"parameters":{"calendar":{"__rl":true,"value":"={{ $json.Globals.calendarId }}","mode":"id"},"start":"={{ $json.notionDate.date.start }}","end":"={{ $json.defaultEndDate }}","additionalFields":{"allday":"no","description":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>","summary":"={{ $json.notionName }}"}},"id":"d1fda009-db76-4ecd-947c-a897d1d3bd8d","name":"Google Calendar3","type":"n8n-nodes-base.googleCalendar","typeVersion":1,"position":[-208,2128],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"calendar":{"__rl":true,"value":"={{ $json.Globals.calendarId }}","mode":"id"},"start":"={{ $json.notionDate.date.start }}","end":"={{ $json.notionDate.date.end }}","additionalFields":{"allday":"no","description":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>","summary":"={{ $json.notionName }}"}},"id":"033d3803-7b35-4c55-b9ef-2707142d06e8","name":"Google Calendar","type":"n8n-nodes-base.googleCalendar","typeVersion":1,"position":[-208,1888],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $('Loop2').item.json.notionID }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"GCal ID|rich_text","textContent":"={{ $json.id }}"}]},"options":{}},"id":"63921205-6930-47ed-a5d5-57fa2c4addd0","name":"Add GCal ID3","type":"n8n-nodes-base.notion","typeVersion":2,"position":[208,1888],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date.end }}","operation":"isNotEmpty"}]}},"id":"3cbb33f5-a83b-41e5-ad6e-2dfed135bdfd","name":"Does it have an end date?","type":"n8n-nodes-base.if","typeVersion":1,"position":[-1040,2032]},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $('Loop1').item.json.notionID }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"GCal ID|rich_text","textContent":"={{ $json.id }}"}]},"options":{}},"id":"cce72e6c-94f2-4485-8a2f-b27231bfc78a","name":"Add GCal ID1","type":"n8n-nodes-base.notion","typeVersion":2,"position":[208,2128],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"options":{"reset":false}},"id":"82d74ff9-e4f9-4daf-8bb8-50f1e898d218","name":"Loop","type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[-784,2480]},{"parameters":{"options":{"reset":false}},"id":"5a8814e7-368a-4712-b1fe-ee90f60f30a3","name":"Loop1","type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[-400,2128]},{"parameters":{"options":{"reset":false}},"id":"4606b4f2-c8bf-4064-949a-ada6d695ccad","name":"Loop2","type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[-400,1888]},{"parameters":{"options":{"reset":false}},"id":"74afcffb-cf6a-4ea9-a66d-57191a947e61","name":"Loop3","type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[-208,1232]},{"parameters":{"content":"## Choose your default event duration\nWhen pushing an event from Notion to Google Calendar, what is going to be the default duration?","height":334.192512604689,"width":259.7926186615935},"id":"2b1c3e28-a147-4723-a17c-9eed20914590","name":"Sticky Note11","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-2784,1472]},{"parameters":{"operation":"addToDate","magnitude":"={{ $json.notionDate.date.start }}","timeUnit":"hours","duration":1,"outputFieldName":"defaultEndDate","options":{"includeInputFields":true}},"id":"ad21a1a6-2c82-477c-b3b9-a66d70b2a722","name":"Creates defaultEndDate with 1h duration","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-2704,1632]},{"parameters":{"content":"## Use these nodes for testing\nReplace the Notion \"Page Updated\" trigger by these 4 nodes to help simulate the behavior of the trigger.\n\nYou can create different filters and enable or disable the upper and lower nodes, depending on what tasks you need to test.\n\nThe only pages that won't work during testing are the deleted ones.","height":632.2029116375359,"width":880.8180923381184},"id":"43eb73d9-6f9a-4c7d-9ae6-207a0916f01c","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-5760,1264]},{"parameters":{"operation":"delete","calendar":{"__rl":true,"value":"={{ $json.Globals.calendarId }}","mode":"id"},"eventId":"={{ $json.GCal_ID }}","options":{}},"id":"4e715379-a1bc-4b25-9162-827849da25d8","name":"Delete event2","type":"n8n-nodes-base.googleCalendar","typeVersion":1,"position":[208,0],"alwaysOutputData":false,"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"options":{"reset":false}},"id":"8ed0f8ba-7c5c-4446-b235-195aec4d1501","name":"Loop4","type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[0,0]},{"parameters":{"resource":"databasePage","operation":"getAll","databaseId":{"__rl":true,"value":"dad4835c-1acc-4209-aac2-11440b13c475","mode":"list","cachedResultName":"Tasks","cachedResultUrl":"https://www.notion.so/dad4835c1acc4209aac211440b13c475"},"returnAll":true,"simple":false,"filterType":"manual","matchType":"allFilters","filters":{"conditions":[{"key":"GCal ID|rich_text","condition":"is_not_empty"},{"key":"Status|status","condition":"does_not_equal","statusValue":"Done"},{"key":"Status|status","condition":"does_not_equal","statusValue":"Archived"}]},"options":{}},"id":"2ab0edff-4a06-4ded-8a9b-81f1ba1962f9","name":"Notion1","type":"n8n-nodes-base.notion","typeVersion":2.1,"position":[-5376,1664]},{"parameters":{"mode":"combine","mergeByFields":{"values":[{"field1":"id","field2":"id"}]},"joinMode":"keepEverything","options":{}},"id":"1930ecfd-15d7-4243-9f40-0382e0ac5d91","name":"Merge","type":"n8n-nodes-base.merge","typeVersion":2.1,"position":[-5088,1584]},{"parameters":{"content":"## Add one trigger for each Notion database that you want to sync","height":702.7054859554116,"width":289.07844289683123},"id":"a9130809-d8e6-4e7a-8833-5192a710686f","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4416,1200]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date.end }}","operation":"isNotEmpty"}]}},"id":"231f507b-d018-4a27-b709-56aef0e91361","name":"Does it have an end date?1","type":"n8n-nodes-base.if","typeVersion":1,"position":[-896,480]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date.end }}","operation":"isNotEmpty"}]}},"id":"dda2f9ff-e2b3-4c2a-b341-76225bd061f2","name":"Does it have an end date?2","type":"n8n-nodes-base.if","typeVersion":1,"position":[-1040,2624]},{"parameters":{"calendar":{"__rl":true,"value":"={{ $json.Globals.calendarId }}","mode":"id"},"start":"={{ $json.notionDate.date.start }}","end":"={{ $json.notionDate.date.start }}","additionalFields":{"allday":"yes","description":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>","summary":"={{ $json[\"notionName\"] }}"}},"id":"2cc6b41f-66d7-4775-8405-abd5d7763562","name":"Google Calendar2","type":"n8n-nodes-base.googleCalendar","typeVersion":1,"position":[-208,2720],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $('Loop5').item.json.notionID }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"GCal ID|rich_text","textContent":"={{ $json.id }}"}]},"options":{}},"id":"4240aae8-ca02-47d1-8c81-331233b21be5","name":"Add GCal ID2","type":"n8n-nodes-base.notion","typeVersion":2,"position":[208,2720],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"content":"## YYYY-MM-DD","height":80,"width":190.88107700739067,"color":7},"id":"136317b9-a453-4374-8974-4386c4651151","name":"Sticky Note18","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,2752]},{"parameters":{"options":{"reset":false}},"id":"3f357394-9cb0-4ccd-b1a4-5a860df1e605","name":"Loop5","type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[-400,2720]},{"parameters":{"content":"## YYYY-MM-DD\n## YYYY-MM-DD","height":96.35243080295625,"width":190.88107700739073,"color":7},"id":"42439485-3d2c-4f4a-b6c2-c6445d3a3ba8","name":"Sticky Note19","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,2512]},{"parameters":{"content":"## YYYY-MM-DD T HH:MM:SS-Z\n## YYYY-MM-DD T HH:MM:SS-Z","height":96.35243080295625,"width":364.9229338011439,"color":7},"id":"071fb8af-24e6-4c46-ba38-fece3b78ba9f","name":"Sticky Note20","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,1888]},{"parameters":{"content":"## YYYY-MM-DD T HH:MM:SS-Z","height":80,"width":359.18646169567,"color":7},"id":"82c9ef88-f613-450e-bd57-9548690a4079","name":"Sticky Note21","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,2144]},{"parameters":{"content":"## YYYY-MM-DD","height":80,"width":190.88107700739067,"color":7},"id":"3339af0b-7ee8-42cc-850f-13849f7784d9","name":"Sticky Note26","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,960]},{"parameters":{"content":"## YYYY-MM-DD\n## YYYY-MM-DD","height":96.35243080295625,"width":190.88107700739073,"color":7},"id":"beae381d-52ee-4de5-a861-d2c4105f0a36","name":"Sticky Note27","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,768]},{"parameters":{"content":"## YYYY-MM-DD T HH:MM:SS-Z\n## YYYY-MM-DD T HH:MM:SS-Z","height":109.18668977858542,"width":364.9229338011439,"color":7},"id":"efd0c99b-7d51-4a69-94d6-08dd6a621a47","name":"Sticky Note28","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,352]},{"parameters":{"content":"## YYYY-MM-DD T HH:MM:SS-Z","height":83.20856474390726,"width":359.18646169567,"color":7},"id":"42915d8c-66df-4742-9cfd-730c9f3606ce","name":"Sticky Note29","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,544]},{"parameters":{"content":"## Runs when page is deleted in Notion","height":96.35243080295625,"width":364.9229338011439,"color":7},"id":"d4274dc6-e9ba-42a1-92d2-ac8c7a585c7b","name":"Sticky Note31","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,0]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.GCal_ID }}","operation":"isNotEmpty"}]}},"id":"936e4bae-a632-4b1c-ac5f-3e88b8fe5b4a","name":"GCal_ID exists in Notion?","type":"n8n-nodes-base.if","typeVersion":1,"position":[-2400,1632]},{"parameters":{"conditions":{"boolean":[{"value1":"={{ $json.in_trash }}","value2":"={{ true }}"}]}},"id":"79fd7093-4c3d-4344-adf4-2b1f5ee4a404","name":"Is the page deleted?","type":"n8n-nodes-base.if","typeVersion":1,"position":[-1888,768]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date.end }}","operation":"isNotEmpty"}]}},"id":"14c293c8-cf5a-4ab7-beae-7c214c5fb30e","name":"Does it have an end date?3","type":"n8n-nodes-base.if","typeVersion":1,"position":[-896,784]},{"parameters":{"content":"## Runs when date is cleared in Notion","height":96.35243080295625,"width":364.9229338011439,"color":7},"id":"dadacb8e-b173-402b-a14d-70ba4bbc179b","name":"Sticky Note33","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,1232]},{"parameters":{"operation":"addToDate","magnitude":"={{ $json.notionDate.date.end.toDateTime() }}","duration":1,"outputFieldName":"endDateTime_Adjusted","options":{"includeInputFields":true}},"id":"850c4cc2-7620-4e9c-b4cd-8d6b7cd6e0e3","name":"Add 1 day to end date","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-400,768],"notesInFlow":true,"notes":"Google Calendar and Notion handle end dates differently, when there's no time set.\n\nIf a date in Notion is from Nov-10 to Nov-12, in Google it will show \"Nov-10 at 00:00\" to \"Nov-12 at 00:00\".\nMeaning the event would end at the beggining of the day in Nov-12, not lasting all day.\n\nSo to make an event last all day in Nov-12 you have to make the end_date \"Nov-13 at 00:00\"."},{"parameters":{"operation":"formatDate","date":"={{ $json.endDateTime_Adjusted }}","format":"yyyy-MM-dd","outputFieldName":"endDate_Adjusted","options":{"includeInputFields":true}},"id":"a4b3df70-85a2-4e58-a09a-6fc8cb074942","name":"Format date","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-208,768]},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $json.Globals.calendarId }}/events/{{ $json.GCal_ID }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"bodyParameters":{"parameters":[{"name":"start","value":"={{ {\n  \"dateTime\": null,\n  \"date\": $json.notionDate.date.start\n} }}"},{"name":"end","value":"={{ {\n  \"dateTime\": null,\n  \"date\": $json.endDate_Adjusted\n} }}"},{"name":"summary","value":"={{ $json.notionName }}"},{"name":"status","value":"confirmed"},{"name":"description","value":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>"}]},"options":{}},"id":"1584a27f-774b-4525-9fa9-85980cd80ec4","name":"Update to All Day event","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[0,768],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $json.Globals.calendarId }}/events/{{ $json.GCal_ID }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"bodyParameters":{"parameters":[{"name":"start","value":"={{ {\n  \"dateTime\": null,\n  \"date\": $json.notionDate.date.start\n} }}"},{"name":"end","value":"={{ {\n  \"dateTime\": null,\n  \"date\": $json.notionDate.date.start\n} }}"},{"name":"summary","value":"={{ $json.notionName }}"},{"name":"status","value":"confirmed"},{"name":"description","value":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>"}]},"options":{}},"id":"4db39f18-c03a-46d8-b123-59f17687a733","name":"Update to All Day event2","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[0,960],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $json.Globals.calendarId }}/events/{{ $json.GCal_ID }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"bodyParameters":{"parameters":[{"name":"start","value":"={{ {\n  \"dateTime\": $json.notionDate.date.start,\n  \"date\": null\n} }}"},{"name":"end","value":"={{ {\n  \"dateTime\": $json.defaultEndDate,\n  \"date\": null\n} }}"},{"name":"summary","value":"={{ $json.notionName }}"},{"name":"status","value":"confirmed"},{"name":"description","value":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>"}]},"options":{}},"id":"9f24a66e-6b0e-451f-9266-ea1ea377bf3f","name":"Update dateTime event1","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[0,528],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"operation":"addToDate","magnitude":"={{ $json.notionDate.date.end.toDateTime() }}","duration":1,"outputFieldName":"endDateTime_Adjusted","options":{"includeInputFields":true}},"id":"f7b68cb9-108d-4122-aa0b-dc83727c648a","name":"Add 1 day to end date1","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-576,2480],"notesInFlow":true,"notes":"Google Calendar and Notion handle end dates differently, when there's no time set.\n\nIf a date in Notion is from Nov-10 to Nov-12, in Google it will show \"Nov-10 at 00:00\" to \"Nov-12 at 00:00\".\nMeaning the event would end at the beggining of the day in Nov-12, not lasting all day.\n\nSo to make an event last all day in Nov-12 you have to make the end_date \"Nov-13 at 00:00\"."},{"parameters":{"operation":"formatDate","date":"={{ $json.endDateTime_Adjusted }}","format":"yyyy-MM-dd","outputFieldName":"endDate_Adjusted","options":{"includeInputFields":true}},"id":"d9d11af3-e3fd-4190-8377-54887ed7cbab","name":"Format date1","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-400,2480]},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":1},"conditions":[{"id":"7bcd3c8e-bdae-43d7-9023-a089298db558","leftValue":"={{ $json.last_edited_by.id }}","rightValue":"={{ $json.Globals.n8nConnectionUserId }}","operator":{"type":"string","operation":"equals"}}],"combinator":"and"},"options":{}},"id":"9ce23f4b-5f7e-423c-b92a-a697c5077ee1","name":"Page edited by a user?","type":"n8n-nodes-base.if","typeVersion":2,"position":[-3216,1648],"notesInFlow":true,"notes":"This prevents infinite loops of pages being edited by n8n and triggering the workflow again and again.\nIt will only update Google Calendar events when a user edits the Notion pages."},{"parameters":{},"id":"f1d7be3f-b5ae-4e82-9d3e-e04f790fd77e","name":"Do nothing","type":"n8n-nodes-base.noOp","typeVersion":1,"position":[-2976,1824]},{"parameters":{"operation":"getAll","calendar":{"__rl":true,"value":"72fb857fe78a97c9ad2d361a2b433518df6549ac7149192c8cca38c73b919eca@group.calendar.google.com","mode":"list","cachedResultName":"Notion Tasks"},"returnAll":true,"options":{"timeMin":"={{ $today.minus(1, 'days') }}"}},"id":"22942538-6bf8-4405-8238-dde01e1d9650","name":"Get future events + yesterday","type":"n8n-nodes-base.googleCalendar","typeVersion":1.1,"position":[-5344,3392]},{"parameters":{"content":"# Notion ➡ Google","height":80,"width":339.3724182117961,"color":7},"id":"9bb4704d-853d-4416-84e4-2a0740c958d9","name":"Sticky Note9","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4448,1104]},{"parameters":{"content":"# Google ➡ Notion","height":87.25811154533459,"width":329.84653344771755,"color":7},"id":"a8e8d77c-f4a9-47b1-b101-08da6061e388","name":"Sticky Note10","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4416,3168]},{"parameters":{"operation":"getTimeBetweenDates","startDate":"={{ $json.extendedProperties.shared.lastUpdatedByAutomation }}","endDate":"={{ $json.updated }}","units":["second"],"options":{"includeInputFields":true}},"id":"9067fa2e-b63e-4609-aa4f-d470fb3f3ba5","name":"Calculate timeDifference between Google's updated_at  and our own updated_at fields","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-2784,3904]},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":1},"conditions":[{"id":"b2b768dd-1682-42c2-9b6a-cd30a25415ba","leftValue":"={{ $json.timeDifference.seconds }}","rightValue":2,"operator":{"type":"number","operation":"gt"}}],"combinator":"and"},"options":{}},"id":"228754dd-ac0f-4773-926c-601acc44d552","name":"Only events that were edited 2s after the last update","type":"n8n-nodes-base.filter","typeVersion":2,"position":[-2576,3904],"notesInFlow":true,"notes":"This prevents an infinite loop.\n\nWhen you edit your Notion page, our automation edits the Google event. This would activate the Google trigger again and again.\n\nUsing the field \"lastUpdatedByAutomation\" we can check if the update happened after our automation ran. Meaning the user was the one that edited the event."},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.start.dateTime }}","operation":"contains","value2":"T"}]}},"id":"7dac7737-2e59-474f-a2bc-4841a862f8b8","name":"Does it have a time?2","type":"n8n-nodes-base.if","typeVersion":1,"position":[-2368,3904]},{"parameters":{"operation":"subtractFromDate","magnitude":"={{ $json.end.date }}","duration":1,"outputFieldName":"notionDateTimeEnd","options":{"includeInputFields":true}},"id":"b9dc49bb-236b-4724-a4b7-7b8b867d4fd2","name":"Subtract 1 day from end_date","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-2144,4000],"notesInFlow":true,"notes":"Google Calendar and Notion handle end dates differently, when there's no time set.\n\nIf a date in Notion is from Nov-10 to Nov-12, in Google it will show \"Nov-10 at 00:00\" to \"Nov-12 at 00:00\".\n\nWhen you set an event in Google from Nov-12 to Nov-13, it sets the end date to \"Nov-14 at 00:00\" behind the scenes.\nMeaning the event would end at the beggining of Nov-14, lasting all day long during Nov-13.\n\nBut Notion considers Nov-12 to Nov-13 already as all day dates.\nSo Nov-14 in Google must be Nov-13 in Notion."},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":1},"conditions":[{"id":"817652c4-64ad-45d7-800a-c58e2e23f9cc","leftValue":"={{ $json.extendedProperties.shared.lastUpdatedByAutomation }}","rightValue":"","operator":{"type":"string","operation":"notExists","singleValue":true}}],"combinator":"and"},"options":{}},"id":"07c28419-3537-4e00-a370-d71bc7b8b6c1","name":"Is it a new event?","type":"n8n-nodes-base.if","typeVersion":2,"position":[-3040,3744]},{"parameters":{"operation":"formatDate","date":"={{ $json.notionDateTimeEnd }}","format":"yyyy-MM-dd","outputFieldName":"notiondEndDate","options":{"includeInputFields":true}},"id":"d641f142-2b44-4f14-ae3e-17428d90b58b","name":"Format end_date","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-1936,4000]},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"92848aee-82e9-4006-af6b-40d65b30fbcc","name":"Add extendedProperties to Google event","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[208,352],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"776ef246-eb0c-4f78-9adf-1bbab98d6b8a","name":"Add extendedProperties to Google event1","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[208,528],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"1703b71d-6f0f-4f9d-8a02-f9e77e14ece6","name":"Add extendedProperties to Google event2","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[208,768],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"3a131902-7414-4a15-9344-ecb02a3e9a67","name":"Add extendedProperties to Google event3","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[208,960],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"9fe6bed1-6725-4cce-9a06-5c3fdfd83b47","name":"Add extendedProperties to Google event4","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[0,1888],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"6c481f1c-c03b-4d8d-947a-06f0db7d00d4","name":"Add extendedProperties to Google event5","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[0,2128],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"2dd20d73-afa7-44b9-a89d-795ea62097a0","name":"Add extendedProperties to Google event6","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[0,2480],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"b62f36cf-cfe2-47ff-b07b-495632f12678","name":"Add extendedProperties to Google event7","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[0,2720],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"a16200de-0d2b-4144-a5ea-77d52e1eed42","leftValue":"={{ $json.start.date }}","rightValue":"={{ $json.notiondEndDate }}","operator":{"type":"string","operation":"notRegex"}}],"combinator":"and"},"options":{}},"id":"912ccf98-3acd-425e-b284-55e45c7a680c","name":"Does it really have an end_date?","type":"n8n-nodes-base.if","typeVersion":2,"position":[-1744,4000]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.start.dateTime }}","operation":"contains","value2":"T"}]}},"id":"c652f9fa-e5ea-4b3a-945c-ba140d9a8070","name":"Does it have a time?3","type":"n8n-nodes-base.if","typeVersion":1,"position":[-2800,3408]},{"parameters":{"operation":"subtractFromDate","magnitude":"={{ $json.end.date }}","duration":1,"outputFieldName":"notionDateTimeEnd","options":{"includeInputFields":true}},"id":"5cabcf70-f5d0-4cc8-841b-aa522f305bd9","name":"Subtract 1 day from end_date1","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-2576,3504],"notesInFlow":true,"notes":"Google Calendar and Notion handle end dates differently, when there's no time set.\n\nIf a date in Notion is from Nov-10 to Nov-12, in Google it will show \"Nov-10 at 00:00\" to \"Nov-12 at 00:00\".\n\nWhen you set an event in Google from Nov-12 to Nov-13, it sets the end date to \"Nov-14 at 00:00\" behind the scenes.\nMeaning the event would end at the beggining of Nov-14, lasting all day long during Nov-13.\n\nBut Notion considers Nov-12 to Nov-13 already as all day dates.\nSo Nov-14 in Google must be Nov-13 in Notion."},{"parameters":{"operation":"formatDate","date":"={{ $json.notionDateTimeEnd }}","format":"yyyy-MM-dd","outputFieldName":"notiondEndDate","options":{"includeInputFields":true}},"id":"bd7e5343-cb28-40ac-8940-18fa2afe7569","name":"Format end_date1","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-2384,3504]},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"a16200de-0d2b-4144-a5ea-77d52e1eed42","leftValue":"={{ $json.start.date }}","rightValue":"={{ $json.notiondEndDate }}","operator":{"type":"string","operation":"notRegex"}}],"combinator":"and"},"options":{}},"id":"3453d8a6-6acb-4959-a615-af8e20e751de","name":"Does it really have an end_date?1","type":"n8n-nodes-base.if","typeVersion":2,"position":[-2176,3504]},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"={{ $json.Globals.databaseId }}","mode":"id"},"title":"={{ $json.summary }}","propertiesUi":{"propertyValues":[{"key":"Date|date","range":true,"includeTime":false,"dateStart":"={{ $json.start.date }}","dateEnd":"={{ $json.notiondEndDate }}"},{"key":"GCal ID|rich_text","textContent":"={{ $json.id }}"}]},"options":{}},"id":"4a08ef6b-0323-475c-a56f-21ca21ac6f5d","name":"Create page1","type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-1968,3408],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"={{ $json.Globals.databaseId }}","mode":"id"},"title":"={{ $json.summary }}","propertiesUi":{"propertyValues":[{"key":"Date|date","includeTime":false,"date":"={{ $json.start.date }}"},{"key":"GCal ID|rich_text","textContent":"={{ $json.id }}"}]},"options":{}},"id":"cd7e9a9f-b5c7-4480-b0aa-a7e10628f744","name":"Create page2","type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-1968,3600],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs1').item.json.Globals.calendarId }}/events/{{ $('Globals1').item.json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $json.id }}\"\n    }\n  },\n  \"description\": \"👉 <a href=https://www.notion.so/{{ $json.id.replaceAll(\"-\", \"\") }} target=_blank><b>View in Notion</b></a>\"\n}","options":{}},"id":"f4330ddf-3615-41a4-bed9-bddce36500cd","name":"Add extendedProperties to Google event8","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[-2384,3312]},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs1').item.json.Globals.calendarId }}/events/{{ $('Globals1').item.json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $json.id }}\"\n    }\n  },\n  \"description\": \"👉 <a href=https://www.notion.so/{{ $json.id.replaceAll(\"-\", \"\") }} target=_blank><b>View in Notion</b></a>\"\n}","options":{}},"id":"8f6e6b08-13ce-4516-89de-aa828c71ca95","name":"Add extendedProperties to Google event9","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[-1776,3408]},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs1').item.json.Globals.calendarId }}/events/{{ $('Globals1').item.json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $json.id }}\"\n    }\n  },\n  \"description\": \"👉 <a href=https://www.notion.so/{{ $json.id.replaceAll(\"-\", \"\") }} target=_blank><b>View in Notion</b></a>\"\n}","options":{}},"id":"d4e3613a-7d83-47b0-b1cc-602bdf9dc449","name":"Add extendedProperties to Google event10","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[-1776,3600],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"mode":"raw","jsonOutput":"{\n  \"Globals\": {\n    \n    \"n8nConnectionUserId\": \"a07174da-0c76-4695-a1e1-ceab14e1c47e\",\n    \n    \"Todo\": {\n      \"databaseId\": \"218dcbfd-8835-8008-a2bd-c164ab084ed3\",\n      \"calendarId\": \"5ee2a7975418d942ddaa25d4e85643ceba794eaff453aa23aaf7336d5511c2a1@group.calendar.google.com\"\n    },\n\n    \"Meetings\": {\n      \"databaseId\": \"24ddcbfd-8835-80fe-ab1d-fa7270343d5b\",\n      \"calendarId\": \"617e0bd5b14375f1fa01d4aebef864122bc67b93e8f8e98fcd867cde5b89b430@group.calendar.google.com\"\n    }\n  }\n}","includeOtherFields":true,"options":{}},"id":"f30d26b1-5aa6-44cb-831f-f20ade3185c6","name":"Globals","type":"n8n-nodes-base.set","typeVersion":3.4,"position":[-3808,1648]},{"parameters":{"content":"# Set some variables here\n## 1️⃣ n8nConnectionUserId\nWhen a page is edited in Notion it registers the ID of the user that made the change.\n\nTo find out what's the ID for your n8n user, use a Notion node to create a database page and check the 'last_edited_by' field.\n\n\n\n\n## 2️⃣ Database and Calendar IDs\nFor each database you want to sync, you have to add the Notion **databaseId** and Google **calendarId** in JSON objects like this:\n\nTasks: {\n   databaseId: \"`72fb8-57fe78a-sgf976`\",\n   calendarId: \"`73b919eca@group.calendar.google.com`\"\n },\n\nMeetings: {\n    databaseId: \"`157fe-78a23f-dfs978`\",\n    calendarId: \"`2a384hfy@group.calendar.google.com`\"\n  }\n\n## 🚨🚨🚨 ATTENTION 🚨🚨🚨\nThe databaseId must include the hyphens, like this:\n`d6e15d95-c538-4795-b1d8-0e5gc778c03c`\n\nThe pattern is:\n8 characters - 4 characters - 4 characters - 4 characters - 12 characters.","height":1341,"width":399},"id":"f2ce7af3-7d2b-46a7-83d8-268cd2a9b48d","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-3952,832]},{"parameters":{"jsCode":"const items = $input.all();\nconst updatedItems = items.map(item => {\n  const databaseId = item.json.parent.database_id;\n  let currentCalendarId = null;\n\n  // Searches the Globals object to find the matching field\n  for (const key in item.json.Globals) {\n    if (item.json.Globals[key].databaseId === databaseId) {\n      currentCalendarId = item.json.Globals[key].calendarId;\n      break;\n    }\n  }\n\n  // Rebuild the Globals object with only the desired fields\n  item.json.Globals = {\n    n8nConnectionUserId: item.json.Globals.n8nConnectionUserId,\n    calendarId: currentCalendarId,\n    databaseId: databaseId\n  };\n  \n  return item;\n});\n\nreturn updatedItems;"},"id":"8cf4f457-421b-4bc1-a719-e618c1b0db2c","name":"Set the current database and calendar IDs","type":"n8n-nodes-base.code","typeVersion":2,"position":[-3488,1648]},{"parameters":{"content":"# Copy the Globals from above and paste here","height":388.29901720463954,"width":319.61007431942534},"id":"a0f230df-ee79-478e-903f-225bef4ae839","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-3904,3552]},{"parameters":{"mode":"raw","jsonOutput":"{\n  \"Globals\": {\n    \n    \"n8nConnectionUserId\": \"a07174da-0c76-4695-a1e1-ceab14e1c47e\",\n    \n    \"Todo\": {\n      \"databaseId\": \"218dcbfd-8835-8008-a2bd-c164ab084ed3\",\n      \"calendarId\": \"5ee2a7975418d942ddaa25d4e85643ceba794eaff453aa23aaf7336d5511c2a1@group.calendar.google.com\"\n    },\n\n    \"Meetings\": {\n      \"databaseId\": \"24ddcbfd-8835-80fe-ab1d-fa7270343d5b\",\n      \"calendarId\": \"617e0bd5b14375f1fa01d4aebef864122bc67b93e8f8e98fcd867cde5b89b430@group.calendar.google.com\"\n    }\n  }\n}","includeOtherFields":true,"options":{}},"id":"83f81b76-6201-4f6a-914f-2f8d0c027f0f","name":"Globals1","type":"n8n-nodes-base.set","typeVersion":3.4,"position":[-3808,3744]},{"parameters":{"content":"# Copy the Globals from above and paste here","height":380.06310703196385,"width":319.61007431942534},"id":"72b55551-35c0-4f1f-ba7d-1689ff281f1b","name":"Sticky Note14","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-3904,4512]},{"parameters":{"mode":"raw","jsonOutput":"{\n  \"Globals\": {\n    \n    \"n8nConnectionUserId\": \"a07174da-0c76-4695-a1e1-ceab14e1c47e\",\n    \n    \"Todo\": {\n      \"databaseId\": \"218dcbfd-8835-8008-a2bd-c164ab084ed3\",\n      \"calendarId\": \"5ee2a7975418d942ddaa25d4e85643ceba794eaff453aa23aaf7336d5511c2a1@group.calendar.google.com\"\n    },\n\n    \"Meetings\": {\n      \"databaseId\": \"24ddcbfd-8835-80fe-ab1d-fa7270343d5b\",\n      \"calendarId\": \"617e0bd5b14375f1fa01d4aebef864122bc67b93e8f8e98fcd867cde5b89b430@group.calendar.google.com\"\n    }\n  }\n}","includeOtherFields":true,"options":{}},"id":"af9ab594-04a0-45dc-aa1a-119623682da4","name":"Globals2","type":"n8n-nodes-base.set","typeVersion":3.4,"position":[-3808,4704]},{"parameters":{"jsCode":"const items = $input.all();\nconst updatedItems = items.map(item => {\n  const calendarId = item.json.organizer.email;\n  let currentDatabaseId = null;\n\n  // Searches the Globals object to find the matching field\n  for (const key in item.json.Globals) {\n    if (item.json.Globals[key].calendarId === calendarId) {\n      currentDatabaseId = item.json.Globals[key].databaseId;\n      break;\n    }\n  }\n\n  // Rebuild the Globals object with only the desired fields\n  item.json.Globals = {\n    n8nConnectionUserId: item.json.Globals.n8nConnectionUserId,\n    calendarId: calendarId,\n    databaseId: currentDatabaseId\n  };\n  \n  return item;\n});\n\nreturn updatedItems;"},"id":"452e0700-ca11-428b-97a2-cf239e1b0894","name":"Set the current database and calendar IDs2","type":"n8n-nodes-base.code","typeVersion":2,"position":[-3504,4704]},{"parameters":{"content":"## Use this node for testing\nReplace the Event Updated trigger by this node","height":305.14255210487977,"width":315.66399727154976},"id":"02ae0bb4-3c02-480e-ad21-5106bc67284c","name":"Sticky Note16","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-5440,3264]},{"parameters":{"content":"## Add two triggers for each Google Calendar that you want to sync","height":665.1419819421769,"width":365.7122508375314},"id":"829b2695-82b6-4ca0-b341-cd83a9dd7987","name":"Sticky Note17","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4448,3264]},{"parameters":{"content":"## Add one trigger for each Google Calendar that you want to sync","height":641.5966864244806,"width":283.9419368038477},"id":"06334426-06f2-423c-af48-7a684172cbc3","name":"Sticky Note34","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4400,4240]},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"calendarId":{"__rl":true,"value":"5ee2a7975418d942ddaa25d4e85643ceba794eaff453aa23aaf7336d5511c2a1@group.calendar.google.com","mode":"list","cachedResultName":"ToDo Cal"},"triggerOn":"eventUpdated","options":{}},"id":"248c39f3-0415-4cd1-b3ef-b9989c7d529b","name":"Event Updated","type":"n8n-nodes-base.googleCalendarTrigger","typeVersion":1,"position":[-4240,3392],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{},"id":"5b720c9d-bdfd-4485-82fa-a8965d3282b3","name":"When clicking \"Test workflow\"","type":"n8n-nodes-base.manualTrigger","typeVersion":1,"position":[-5696,1584],"disabled":true},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"calendarId":{"__rl":true,"value":"5ee2a7975418d942ddaa25d4e85643ceba794eaff453aa23aaf7336d5511c2a1@group.calendar.google.com","mode":"list","cachedResultName":"ToDo Cal"},"triggerOn":"eventCreated","options":{}},"id":"faafe23c-1386-446f-9895-417030f12815","name":"Event Created","type":"n8n-nodes-base.googleCalendarTrigger","typeVersion":1,"position":[-4400,3392],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"content":"# Tasks","height":99.22146266772059,"width":196.39800582684305,"color":7},"id":"22a605e1-064f-435c-be14-7bcf14c8fe67","name":"Sticky Note35","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4656,3392]},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $json.extendedProperties.shared.notionPageId }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"Data|date","includeTime":false,"date":"={{ $json.start.date }}"},{"key":"Task name|title","title":"={{ $json.summary }}"}]},"options":{}},"id":"a478b55d-7781-4558-b43d-ae893c735180","name":"Update page1 - continue on error","type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-1520,4112],"onError":"continueRegularOutput"},{"parameters":{"content":"### Allowing these Notion nodes to continue on error prevents deleted pages from stopping the workflow.\n\nThe deleted pages go to another branch to be deleted in Google Calendar.","height":324.9384888466118,"color":7},"id":"a5dc938d-c7eb-44fe-8c27-5c6d6c1ccd5d","name":"Sticky Note36","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-1344,3920]},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"186dc8f2-4a6d-416c-9900-1b4ee8e7418b","leftValue":"={{ $json.in_trash }}","rightValue":"true","operator":{"type":"boolean","operation":"true","singleValue":true}}],"combinator":"and"},"options":{}},"id":"568660e7-1ecc-44f8-a77c-c1a0928d03e6","name":"Find deleted pages1","type":"n8n-nodes-base.filter","typeVersion":2,"position":[-2576,2352]},{"parameters":{"operation":"delete","calendar":{"__rl":true,"value":"={{ $('Only calendarId').item.json.calendarId }}","mode":"id"},"eventId":"={{ $json.properties['GCal ID'].rich_text[0].text.content }}","options":{}},"id":"f90fc6e2-c294-4391-9198-7a080f426a22","name":"Delete event3","type":"n8n-nodes-base.googleCalendar","typeVersion":1,"position":[-2400,2352],"alwaysOutputData":false,"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"content":"## This flow checks if any Notion page was deleted and deletes the event\nWe have to do this because there's no way to retrieve deleted pages using the Notion API.\n\nAnd the \"page updated\" trigger uses the Notion API to check for updates, so it never detects when a page was deleted.","height":306.9481514579442,"width":286.9846072927019,"color":7},"id":"e2509483-1bcb-4988-a056-7fea46c67659","name":"Sticky Note38","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4416,2224]},{"parameters":{"operation":"getAll","calendar":{"__rl":true,"value":"={{ $json.calendarId }}","mode":"id"},"returnAll":true,"options":{"timeMin":"={{ $today.minus(1, 'days') }}"}},"id":"bc2f9956-d986-476a-8a09-b7c64d865875","name":"Get future events1","type":"n8n-nodes-base.googleCalendar","typeVersion":1.1,"position":[-3120,2352],"alwaysOutputData":false,"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"resource":"databasePage","operation":"get","pageId":{"__rl":true,"value":"={{ $json.extendedProperties.shared.notionPageId }}","mode":"id"},"simple":false},"id":"6775d703-ab32-4912-81ca-2bb1a1b3130c","name":"Find related pages1","type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-2768,2352],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"7a2065ef-7d16-4d67-aea0-e2d9185562cd","leftValue":"={{ $json.extendedProperties.shared.notionPageId }}","rightValue":"","operator":{"type":"string","operation":"exists","singleValue":true}}],"combinator":"and"},"options":{}},"id":"3028614a-92bb-421b-8996-bf4e1579f25e","name":"extendedProperties exist?","type":"n8n-nodes-base.filter","typeVersion":2,"position":[-2944,2352]},{"parameters":{"jsCode":"const items = $input.all();\nconst updatedItems = items.map(item => {\n  const calendarId = item.json.organizer.email;\n  let currentDatabaseId = null;\n\n  // Searches the Globals object to find the matching field\n  for (const key in item.json.Globals) {\n    if (item.json.Globals[key].calendarId === calendarId) {\n      currentDatabaseId = item.json.Globals[key].databaseId;\n      break;\n    }\n  }\n\n  // Rebuild the Globals object with only the desired fields\n  item.json.Globals = {\n    n8nConnectionUserId: item.json.Globals.n8nConnectionUserId,\n    calendarId: calendarId,\n    databaseId: currentDatabaseId\n  };\n  \n  return item;\n});\n\nreturn updatedItems;"},"id":"d229c49a-c726-42b2-b357-cc5f5a5445ed","name":"Set the current database and calendar IDs1","type":"n8n-nodes-base.code","typeVersion":2,"position":[-3504,3744]},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $json.extendedProperties.shared.notionPageId }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"Date|date","range":true,"dateStart":"={{ $json.start.dateTime }}","dateEnd":"={{ $json.end.dateTime }}"},{"key":"Name|title","title":"={{ $json.summary }}"}]},"options":{}},"id":"3c13b43b-6f95-424e-abbf-2c7063e4d86a","name":"Update page2 - continue on error","type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-2144,3808],"onError":"continueRegularOutput"},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $json.extendedProperties.shared.notionPageId }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"Date|date","range":true,"includeTime":false,"dateStart":"={{ $json.start.date }}","dateEnd":"={{ $json.notiondEndDate }}"},{"key":"Name|title","title":"={{ $json.summary }}"}]},"options":{}},"id":"761b1d61-806b-40bb-9ab0-f292b8631716","name":"Update page - continue on error","type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-1520,3920],"onError":"continueRegularOutput"},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"={{ $json.Globals.databaseId }}","mode":"id"},"title":"={{ $json.summary }}","propertiesUi":{"propertyValues":[{"key":"Date|date","range":true,"dateStart":"={{ $json.start.dateTime }}","dateEnd":"={{ $json.end.dateTime }}"},{"key":"GCal ID|rich_text","textContent":"={{ $json.id }}"}]},"options":{}},"id":"f17e6e0d-bcb2-42ab-98f4-8ba26069a6bc","name":"Create page","type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-2576,3312]},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $json.Globals.calendarId }}/events/{{ $json.GCal_ID }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"bodyParameters":{"parameters":[{"name":"start","value":"={{ {\n  \"dateTime\": $json.notionDate.date.start,\n  \"date\": null\n} }}"},{"name":"end","value":"={{ {\n  \"dateTime\": $json.notionDate.date.end,\n  \"date\": null\n} }}"},{"name":"summary","value":"={{ $json.notionName }}"},{"name":"status","value":"confirmed"},{"name":"description","value":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>"}]},"options":{}},"id":"e8a679e9-4386-43d2-b80c-96c022b055a8","name":"Update dateTime event","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[0,352],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"fields":{"values":[{"name":"notionID","stringValue":"={{ $json.id }}"},{"name":"notionName","stringValue":"={{ $json.properties['Name'].title[0].text.content }}"},{"name":"notionDate","type":"objectValue","objectValue":"={{ $json.properties.Date }}"},{"name":"GCal_ID","stringValue":"={{ $json.properties['GCal ID'].rich_text[0].text.content }}"}]},"include":"selected","includeFields":"archived,Globals","options":{}},"id":"d3f12790-73db-4fe2-8699-73bb392bd863","name":"Set some fields","type":"n8n-nodes-base.set","typeVersion":3.2,"position":[-2976,1632]},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"event":"pagedUpdatedInDatabase","databaseId":{"__rl":true,"value":"24ddcbfd-8835-80fe-ab1d-fa7270343d5b","mode":"list","cachedResultName":"Meetings","cachedResultUrl":"https://www.notion.so/24ddcbfd883580feab1dfa7270343d5b"},"simple":false},"id":"dd7f4acb-1332-41e1-b28d-d7d20177299c","name":"Page Updated - Meetings","type":"n8n-nodes-base.notionTrigger","typeVersion":1,"position":[-4336,1520],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"calendarId":{"__rl":true,"value":"a1dbc9e1d2ad0ef57f8fd3c79dd8def8a01ba4bcfb7ffdd0f4c87e790a095aa0@group.calendar.google.com","mode":"list","cachedResultName":"Notion Reuniões"},"triggerOn":"eventUpdated","options":{}},"id":"dad2bbe3-71af-407d-bd38-11da7c6e8fed","name":"Event Updated1","type":"n8n-nodes-base.googleCalendarTrigger","typeVersion":1,"position":[-4240,3584]},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"calendarId":{"__rl":true,"value":"a1dbc9e1d2ad0ef57f8fd3c79dd8def8a01ba4bcfb7ffdd0f4c87e790a095aa0@group.calendar.google.com","mode":"list","cachedResultName":"Notion Reuniões"},"triggerOn":"eventCreated","options":{}},"id":"187e76b8-bf54-4edb-8325-fe6a2ae012c7","name":"Event Created1","type":"n8n-nodes-base.googleCalendarTrigger","typeVersion":1,"position":[-4400,3584]},{"parameters":{"content":"# Meetings","height":99.22146266772059,"width":196.39800582684305,"color":7},"id":"de6ba8f1-7ff6-41b4-8033-523e7f024217","name":"Sticky Note37","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4656,3584]},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"calendarId":{"__rl":true,"value":"72fb857fe78a97c9ad2d361a2b433518df6549ac7149192c8cca38c73b919eca@group.calendar.google.com","mode":"list","cachedResultName":"Notion Tasks"},"triggerOn":"eventCancelled","options":{}},"id":"5fbe3656-2737-4985-be6c-5dd5b3e4b9e3","name":"Deleted - Tasks","type":"n8n-nodes-base.googleCalendarTrigger","typeVersion":1,"position":[-4320,4384]},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"calendarId":{"__rl":true,"value":"a1dbc9e1d2ad0ef57f8fd3c79dd8def8a01ba4bcfb7ffdd0f4c87e790a095aa0@group.calendar.google.com","mode":"list","cachedResultName":"Notion Reuniões"},"triggerOn":"eventCancelled","options":{}},"id":"a1ddcb4e-064b-4ee8-9a49-b57d05e7a72f","name":"Deleted - Meetings","type":"n8n-nodes-base.googleCalendarTrigger","typeVersion":1,"position":[-4320,4560]},{"parameters":{"mode":"raw","jsonOutput":"{\n  \"Globals\": {\n    \n    \"n8nConnectionUserId\": \"a07174da-0c76-4695-a1e1-ceab14e1c47e\",\n    \n    \"Todo\": {\n      \"databaseId\": \"218dcbfd-8835-8008-a2bd-c164ab084ed3\",\n      \"calendarId\": \"5ee2a7975418d942ddaa25d4e85643ceba794eaff453aa23aaf7336d5511c2a1@group.calendar.google.com\"\n    },\n\n    \"Meetings\": {\n      \"databaseId\": \"24ddcbfd-8835-80fe-ab1d-fa7270343d5b\",\n      \"calendarId\": \"617e0bd5b14375f1fa01d4aebef864122bc67b93e8f8e98fcd867cde5b89b430@group.calendar.google.com\"\n    }\n  }\n}","includeOtherFields":true,"options":{}},"id":"601591be-86f6-40f6-bc75-c3fe37ac814b","name":"Globals3","type":"n8n-nodes-base.set","typeVersion":3.4,"position":[-3808,2352]},{"parameters":{"fieldToSplitOut":"Globals","options":{}},"id":"288d6b55-0d5d-4daf-bd65-67e09d859273","name":"Split fields","type":"n8n-nodes-base.splitOut","typeVersion":1,"position":[-3552,2336]},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"b2a5f692-c6c4-4691-b5cf-fcf57bcd2523","leftValue":"={{ $json.calendarId }}","rightValue":"","operator":{"type":"string","operation":"exists","singleValue":true}}],"combinator":"and"},"options":{}},"id":"d87e2b94-8261-4c9e-8d96-ac00c7eb985f","name":"Only calendarId","type":"n8n-nodes-base.filter","typeVersion":2,"position":[-3296,2352]},{"parameters":{"content":"# Copy the Globals from above and paste here","height":388.29901720463954,"width":319.61007431942534},"id":"ba7bc384-3999-4da3-9507-e45a4f0c7647","name":"Sticky Note41","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-3904,2144]},{"parameters":{"rule":{"interval":[{"field":"minutes","minutesInterval":3}]}},"id":"6b97df9a-95c2-4ece-bd4e-db6e2b94865f","name":"Every 3min","type":"n8n-nodes-base.scheduleTrigger","typeVersion":1.2,"position":[-4080,2352]},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"event":"pagedUpdatedInDatabase","databaseId":{"__rl":true,"value":"218dcbfd-8835-8008-a2bd-c164ab084ed3","mode":"list","cachedResultName":"TODO ","cachedResultUrl":"https://www.notion.so/218dcbfd88358008a2bdc164ab084ed3"},"simple":false},"id":"0991ddbc-171a-4fae-89d9-6913bb576735","name":"Page Updated - Todo","type":"n8n-nodes-base.notionTrigger","typeVersion":1,"position":[-4336,1344],"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}}],"connections":{"Google Calendar1":{"main":[[{"node":"Add extendedProperties to Google event6","type":"main","index":0}]]},"Add GCal ID":{"main":[[{"node":"Loop","type":"main","index":0}]]},"Remove GCal ID2":{"main":[[{"node":"Loop3","type":"main","index":0}]]},"Does it have a date?":{"main":[[{"node":"Does it have a time?","type":"main","index":0}],[{"node":"Loop3","type":"main","index":0}]]},"Does it have a time?":{"main":[[{"node":"Does it have an end date?1","type":"main","index":0}],[{"node":"Does it have an end date?3","type":"main","index":0}]]},"Delete event1":{"main":[[{"node":"Remove GCal ID2","type":"main","index":0}]]},"Does it have a date?1":{"main":[[{"node":"Does it have a time?1","type":"main","index":0}],[{"node":"No Operation, do nothing","type":"main","index":0}]]},"Does it have a time?1":{"main":[[{"node":"Does it have an end date?","type":"main","index":0}],[{"node":"Does it have an end date?2","type":"main","index":0}]]},"Find Task":{"main":[[{"node":"Remove GCal ID and Date","type":"main","index":0}]]},"Notion":{"main":[[{"node":"Merge","type":"main","index":0}]]},"Google Calendar3":{"main":[[{"node":"Add extendedProperties to Google event5","type":"main","index":0}]]},"Google Calendar":{"main":[[{"node":"Add extendedProperties to Google event4","type":"main","index":0}]]},"Add GCal ID3":{"main":[[{"node":"Loop2","type":"main","index":0}]]},"Does it have an end date?":{"main":[[{"node":"Loop2","type":"main","index":0}],[{"node":"Loop1","type":"main","index":0}]]},"Add GCal ID1":{"main":[[{"node":"Loop1","type":"main","index":0}]]},"Loop":{"main":[[],[{"node":"Add 1 day to end date1","type":"main","index":0}]]},"Loop1":{"main":[[],[{"node":"Google Calendar3","type":"main","index":0}]]},"Loop2":{"main":[[],[{"node":"Google Calendar","type":"main","index":0}]]},"Loop3":{"main":[[],[{"node":"Delete event1","type":"main","index":0}]]},"Creates defaultEndDate with 1h duration":{"main":[[{"node":"GCal_ID exists in Notion?","type":"main","index":0}]]},"Delete event2":{"main":[[{"node":"Loop4","type":"main","index":0}]]},"Loop4":{"main":[[],[{"node":"Delete event2","type":"main","index":0}]]},"Notion1":{"main":[[{"node":"Merge","type":"main","index":1}]]},"Does it have an end date?1":{"main":[[{"node":"Update dateTime event","type":"main","index":0}],[{"node":"Update dateTime event1","type":"main","index":0}]]},"Does it have an end date?2":{"main":[[{"node":"Loop","type":"main","index":0}],[{"node":"Loop5","type":"main","index":0}]]},"Google Calendar2":{"main":[[{"node":"Add extendedProperties to Google event7","type":"main","index":0}]]},"Add GCal ID2":{"main":[[{"node":"Loop5","type":"main","index":0}]]},"Loop5":{"main":[[],[{"node":"Google Calendar2","type":"main","index":0}]]},"GCal_ID exists in Notion?":{"main":[[{"node":"Is the page deleted?","type":"main","index":0}],[{"node":"Does it have a date?1","type":"main","index":0}]]},"Is the page deleted?":{"main":[[{"node":"Loop4","type":"main","index":0}],[{"node":"Does it have a date?","type":"main","index":0}]]},"Does it have an end date?3":{"main":[[{"node":"Add 1 day to end date","type":"main","index":0}],[{"node":"Update to All Day event2","type":"main","index":0}]]},"Add 1 day to end date":{"main":[[{"node":"Format date","type":"main","index":0}]]},"Format date":{"main":[[{"node":"Update to All Day event","type":"main","index":0}]]},"Update to All Day event":{"main":[[{"node":"Add extendedProperties to Google event2","type":"main","index":0}]]},"Update to All Day event2":{"main":[[{"node":"Add extendedProperties to Google event3","type":"main","index":0}]]},"Update dateTime event1":{"main":[[{"node":"Add extendedProperties to Google event1","type":"main","index":0}]]},"Add 1 day to end date1":{"main":[[{"node":"Format date1","type":"main","index":0}]]},"Format date1":{"main":[[{"node":"Google Calendar1","type":"main","index":0}]]},"Page edited by a user?":{"main":[[{"node":"Set some fields","type":"main","index":0}],[{"node":"Do nothing","type":"main","index":0}]]},"Calculate timeDifference between Google's updated_at  and our own updated_at fields":{"main":[[{"node":"Only events that were edited 2s after the last update","type":"main","index":0}]]},"Only events that were edited 2s after the last update":{"main":[[{"node":"Does it have a time?2","type":"main","index":0}]]},"Does it have a time?2":{"main":[[{"node":"Update page2 - continue on error","type":"main","index":0}],[{"node":"Subtract 1 day from end_date","type":"main","index":0}]]},"Subtract 1 day from end_date":{"main":[[{"node":"Format end_date","type":"main","index":0}]]},"Is it a new event?":{"main":[[{"node":"Does it have a time?3","type":"main","index":0}],[{"node":"Calculate timeDifference between Google's updated_at  and our own updated_at fields","type":"main","index":0}]]},"Format end_date":{"main":[[{"node":"Does it really have an end_date?","type":"main","index":0}]]},"Add extendedProperties to Google event4":{"main":[[{"node":"Add GCal ID3","type":"main","index":0}]]},"Add extendedProperties to Google event5":{"main":[[{"node":"Add GCal ID1","type":"main","index":0}]]},"Add extendedProperties to Google event6":{"main":[[{"node":"Add GCal ID","type":"main","index":0}]]},"Add extendedProperties to Google event7":{"main":[[{"node":"Add GCal ID2","type":"main","index":0}]]},"Does it really have an end_date?":{"main":[[{"node":"Update page - continue on error","type":"main","index":0}],[{"node":"Update page1 - continue on error","type":"main","index":0}]]},"Does it have a time?3":{"main":[[{"node":"Create page","type":"main","index":0}],[{"node":"Subtract 1 day from end_date1","type":"main","index":0}]]},"Subtract 1 day from end_date1":{"main":[[{"node":"Format end_date1","type":"main","index":0}]]},"Format end_date1":{"main":[[{"node":"Does it really have an end_date?1","type":"main","index":0}]]},"Does it really have an end_date?1":{"main":[[{"node":"Create page1","type":"main","index":0}],[{"node":"Create page2","type":"main","index":0}]]},"Create page1":{"main":[[{"node":"Add extendedProperties to Google event9","type":"main","index":0}]]},"Create page2":{"main":[[{"node":"Add extendedProperties to Google event10","type":"main","index":0}]]},"Globals":{"main":[[{"node":"Set the current database and calendar IDs","type":"main","index":0}]]},"Set the current database and calendar IDs":{"main":[[{"node":"Page edited by a user?","type":"main","index":0}]]},"Globals1":{"main":[[{"node":"Set the current database and calendar IDs1","type":"main","index":0}]]},"Globals2":{"main":[[{"node":"Set the current database and calendar IDs2","type":"main","index":0}]]},"Set the current database and calendar IDs2":{"main":[[{"node":"Find Task","type":"main","index":0}]]},"Event Updated":{"main":[[{"node":"Globals1","type":"main","index":0}]]},"When clicking \"Test workflow\"":{"main":[[{"node":"Notion1","type":"main","index":0},{"node":"Notion","type":"main","index":0}]]},"Event Created":{"main":[[{"node":"Globals1","type":"main","index":0}]]},"Find deleted pages1":{"main":[[{"node":"Delete event3","type":"main","index":0}]]},"Get future events1":{"main":[[{"node":"extendedProperties exist?","type":"main","index":0}]]},"Find related pages1":{"main":[[{"node":"Find deleted pages1","type":"main","index":0}]]},"extendedProperties exist?":{"main":[[{"node":"Find related pages1","type":"main","index":0}]]},"Set the current database and calendar IDs1":{"main":[[{"node":"Is it a new event?","type":"main","index":0}]]},"Create page":{"main":[[{"node":"Add extendedProperties to Google event8","type":"main","index":0}]]},"Update dateTime event":{"main":[[{"node":"Add extendedProperties to Google event","type":"main","index":0}]]},"Set some fields":{"main":[[{"node":"Creates defaultEndDate with 1h duration","type":"main","index":0}]]},"Event Updated1":{"main":[[{"node":"Globals1","type":"main","index":0}]]},"Event Created1":{"main":[[{"node":"Globals1","type":"main","index":0}]]},"Deleted - Tasks":{"main":[[{"node":"Globals2","type":"main","index":0}]]},"Deleted - Meetings":{"main":[[{"node":"Globals2","type":"main","index":0}]]},"Globals3":{"main":[[{"node":"Split fields","type":"main","index":0}]]},"Split fields":{"main":[[{"node":"Only calendarId","type":"main","index":0}]]},"Only calendarId":{"main":[[{"node":"Get future events1","type":"main","index":0}]]},"Every 3min":{"main":[[{"node":"Globals3","type":"main","index":0}]]},"Page Updated - Meetings":{"main":[[{"node":"Globals","type":"main","index":0}]]},"Page Updated - Todo":{"main":[[{"node":"Globals","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":null,"pinData":{},"versionId":"c7ee992f-db82-4568-97e5-a0b06e90216b","triggerCount":0,"tags":[],"shared":[{"createdAt":"2025-08-20T15:06:24.497Z","updatedAt":"2025-08-20T15:06:24.497Z","role":"workflow:owner","workflowId":"Hzl9tkzVfFoRv6Gq","projectId":"DQC8ik4pLkhZ4ZDm","project":{"createdAt":"2025-08-19T19:25:16.723Z","updatedAt":"2025-08-19T19:26:16.591Z","id":"DQC8ik4pLkhZ4ZDm","name":"Ben Hex <bhochster@gmail.com>","type":"personal","icon":null,"description":null}}]},{"createdAt":"2025-08-20T16:44:19.644Z","updatedAt":"2025-09-11T23:49:06.000Z","id":"ijgoeTFIa0wOWEIl","name":"My workflow 6","active":false,"isArchived":true,"nodes":[{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"triggerOn":"specificFolder","folderToWatch":{"__rl":true,"value":"1tOOiWR1_m0AVN_8ggtBMjU6IRTtMS39v","mode":"list","cachedResultName":"Scanned Documents","cachedResultUrl":"https://drive.google.com/drive/folders/1tOOiWR1_m0AVN_8ggtBMjU6IRTtMS39v"},"event":"fileCreated","options":{}},"type":"n8n-nodes-base.googleDriveTrigger","typeVersion":1,"position":[0,0],"id":"26091499-61ad-4314-88e3-d28ae851f95a","name":"Google Drive Trigger","credentials":{"googleDriveOAuth2Api":{"id":"KUrcceziR6IJKjXk","name":"Google Drive account"}}},{"parameters":{"operation":"download","fileId":{"__rl":true,"value":"={{ $json.id }}","mode":"id"},"options":{"binaryPropertyName":"data"}},"type":"n8n-nodes-base.googleDrive","typeVersion":3,"position":[208,0],"id":"39c091b4-af14-44da-914d-529d18e61274","name":"Download file","credentials":{"googleDriveOAuth2Api":{"id":"KUrcceziR6IJKjXk","name":"Google Drive account"}}}],"connections":{"Google Drive Trigger":{"main":[[{"node":"Download file","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":{"templateCredsSetupCompleted":true},"pinData":{},"versionId":"36a80eb1-25c1-4d2b-8bf5-f034106baef9","triggerCount":0,"tags":[],"shared":[{"createdAt":"2025-08-20T16:44:19.649Z","updatedAt":"2025-08-20T16:44:19.649Z","role":"workflow:owner","workflowId":"ijgoeTFIa0wOWEIl","projectId":"DQC8ik4pLkhZ4ZDm","project":{"createdAt":"2025-08-19T19:25:16.723Z","updatedAt":"2025-08-19T19:26:16.591Z","id":"DQC8ik4pLkhZ4ZDm","name":"Ben Hex <bhochster@gmail.com>","type":"personal","icon":null,"description":null}}]},{"createdAt":"2025-08-20T17:01:08.024Z","updatedAt":"2025-09-11T23:48:39.000Z","id":"Eun9ugdnL2gmh1Ce","name":"My workflow 7","active":false,"isArchived":true,"nodes":[{"parameters":{"calendar":{"__rl":true,"value":"={{ $json.Globals.calendarId }}","mode":"id"},"start":"={{ $json.notionDate.date.start }}","end":"={{ $json.endDateTime_Adjusted }}","additionalFields":{"allday":"yes","description":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>","summary":"={{ $json[\"notionName\"] }}"}},"id":"abb33a1e-46e2-477c-9fe9-457563f10fdc","name":"Google Calendar1","type":"n8n-nodes-base.googleCalendar","typeVersion":1,"position":[80,2400]},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $('Loop').item.json.notionID }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"GCal ID|rich_text","textContent":"={{ $json.id }}"}]},"options":{}},"id":"75e464c7-f42f-4312-800c-71ae5f43ba75","name":"Add GCal ID","type":"n8n-nodes-base.notion","typeVersion":2,"position":[496,2400]},{"parameters":{},"id":"e12ee292-2ed3-4ad4-ab9d-b42cc9e4a264","name":"No Operation, do nothing","type":"n8n-nodes-base.noOp","typeVersion":1,"position":[-1072,2320]},{"parameters":{"content":"# Create event","height":80,"width":288.259119644621,"color":7},"id":"fad17ecb-5165-4630-b097-c40f4d920251","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-1600,2224]},{"parameters":{"content":"# Update Event","height":80,"width":299.54925745153224,"color":7},"id":"811771de-2447-456a-a6ae-a20d2583aba4","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-1920,688]},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $('Loop3').item.json.notionID }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"GCal ID|rich_text"}]},"options":{}},"id":"de5a1674-79dc-44fa-bd3b-0ba9864087c9","name":"Remove GCal ID2","type":"n8n-nodes-base.notion","typeVersion":2,"position":[496,1152]},{"parameters":{"content":"## This flow deletes GCal ID and Date, when the event is cancelled in Google.","height":162.57090146831365,"width":256.72937811647864,"color":7},"id":"9cccd0ef-4515-4b6a-bb85-fc4eb3b8b08e","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4400,4384]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date }}","operation":"isNotEmpty"}]}},"id":"85de403a-6ff2-4a95-92e0-fe4b6584880f","name":"Does it have a date?","type":"n8n-nodes-base.if","typeVersion":1,"position":[-1296,704]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date.start }}","operation":"contains","value2":"T"}]}},"id":"49bfe71a-09b4-4a0c-9785-7832a03a786f","name":"Does it have a time?","type":"n8n-nodes-base.if","typeVersion":1,"position":[-896,608]},{"parameters":{"operation":"delete","calendar":{"__rl":true,"value":"={{ $json.Globals.calendarId }}","mode":"id"},"eventId":"={{ $json.GCal_ID }}","options":{}},"id":"b172523c-6fa8-45a9-9b5c-92482b243cc6","name":"Delete event1","type":"n8n-nodes-base.googleCalendar","typeVersion":1,"position":[288,1152],"alwaysOutputData":false},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date }}","operation":"isNotEmpty"}]}},"id":"2f1a5433-176b-4a95-9c1b-4af751b7be65","name":"Does it have a date?1","type":"n8n-nodes-base.if","typeVersion":1,"position":[-1296,2224]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date.start }}","operation":"contains","value2":"T"}]}},"id":"9b71be79-e3ba-4166-be1f-bd7f26dfcf42","name":"Does it have a time?1","type":"n8n-nodes-base.if","typeVersion":1,"position":[-1072,2160]},{"parameters":{"resource":"databasePage","operation":"getAll","databaseId":{"__rl":true,"value":"={{ $json.Globals.databaseId }}","mode":"id"},"returnAll":true,"filterType":"manual","filters":{"conditions":[{"key":"GCal ID|rich_text","condition":"equals","richTextValue":"={{ $json.id }}"}]},"options":{}},"id":"3d719aca-6c48-463e-8fba-0fe27b5dc4b2","name":"Find Task","type":"n8n-nodes-base.notion","typeVersion":2,"position":[-2976,4624]},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $json.id }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"GCal ID|rich_text"},{"key":"Date|date"}]},"options":{}},"id":"51d563cc-a3ca-4749-8a44-532e2bacb2b7","name":"Remove GCal ID and Date","type":"n8n-nodes-base.notion","typeVersion":2,"position":[-2736,4624]},{"parameters":{"resource":"databasePage","operation":"getAll","databaseId":{"__rl":true,"value":"dad4835c-1acc-4209-aac2-11440b13c475","mode":"list","cachedResultName":"Tasks","cachedResultUrl":"https://www.notion.so/dad4835c1acc4209aac211440b13c475"},"returnAll":true,"simple":false,"filterType":"manual","matchType":"allFilters","filters":{"conditions":[{"key":"Data|date","condition":"is_not_empty"},{"key":"Status|status","condition":"does_not_equal","statusValue":"Done"},{"key":"Status|status","condition":"does_not_equal","statusValue":"Archived"}]},"options":{}},"id":"d303b73e-3672-4ebc-80d3-f0ff93ee9fdf","name":"Notion","type":"n8n-nodes-base.notion","typeVersion":2.1,"position":[-5088,1424]},{"parameters":{"calendar":{"__rl":true,"value":"={{ $json.Globals.calendarId }}","mode":"id"},"start":"={{ $json.notionDate.date.start }}","end":"={{ $json.defaultEndDate }}","additionalFields":{"allday":"no","description":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>","summary":"={{ $json.notionName }}"}},"id":"26034fd1-b578-4d4f-a5f0-975a67aea2a8","name":"Google Calendar3","type":"n8n-nodes-base.googleCalendar","typeVersion":1,"position":[80,2048]},{"parameters":{"calendar":{"__rl":true,"value":"={{ $json.Globals.calendarId }}","mode":"id"},"start":"={{ $json.notionDate.date.start }}","end":"={{ $json.notionDate.date.end }}","additionalFields":{"allday":"no","description":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>","summary":"={{ $json.notionName }}"}},"id":"e862c05e-b6c6-4874-872c-d759d30c4c95","name":"Google Calendar","type":"n8n-nodes-base.googleCalendar","typeVersion":1,"position":[80,1808]},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $('Loop2').item.json.notionID }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"GCal ID|rich_text","textContent":"={{ $json.id }}"}]},"options":{}},"id":"dac7e817-b821-40f7-9bb8-cdba6452d3d7","name":"Add GCal ID3","type":"n8n-nodes-base.notion","typeVersion":2,"position":[496,1808]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date.end }}","operation":"isNotEmpty"}]}},"id":"a620b8e9-5690-4cc2-8b24-01ea62c4893a","name":"Does it have an end date?","type":"n8n-nodes-base.if","typeVersion":1,"position":[-752,1952]},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $('Loop1').item.json.notionID }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"GCal ID|rich_text","textContent":"={{ $json.id }}"}]},"options":{}},"id":"78e8fb32-821d-4c40-964e-74b22672495c","name":"Add GCal ID1","type":"n8n-nodes-base.notion","typeVersion":2,"position":[496,2048]},{"parameters":{"options":{"reset":false}},"id":"e7c97696-b487-4a19-9f8f-ad8113831f63","name":"Loop","type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[-496,2400]},{"parameters":{"options":{"reset":false}},"id":"a9fb1b24-d819-43db-8c7d-7be7b54ecc5c","name":"Loop1","type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[-112,2048]},{"parameters":{"options":{"reset":false}},"id":"2e8761f5-0df9-42dc-bd1f-e3a69da3cd60","name":"Loop2","type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[-112,1808]},{"parameters":{"options":{"reset":false}},"id":"023f3ecd-4f97-48aa-8910-613ca9aa705e","name":"Loop3","type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[80,1152]},{"parameters":{"content":"## Choose your default event duration\nWhen pushing an event from Notion to Google Calendar, what is going to be the default duration?","height":334.192512604689,"width":259.7926186615935},"id":"b64a878f-944b-4a74-b311-c3b194465923","name":"Sticky Note11","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-2496,1392]},{"parameters":{"operation":"addToDate","magnitude":"={{ $json.notionDate.date.start }}","timeUnit":"hours","duration":1,"outputFieldName":"defaultEndDate","options":{"includeInputFields":true}},"id":"41e03a82-f05a-4b75-9b0e-ecc088bf224c","name":"Creates defaultEndDate with 1h duration","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-2416,1552]},{"parameters":{"content":"## Use these nodes for testing\nReplace the Notion \"Page Updated\" trigger by these 4 nodes to help simulate the behavior of the trigger.\n\nYou can create different filters and enable or disable the upper and lower nodes, depending on what tasks you need to test.\n\nThe only pages that won't work during testing are the deleted ones.","height":632.2029116375359,"width":880.8180923381184},"id":"eb6835bd-ea74-490c-b8c7-ce709f4f81d1","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-5472,1184]},{"parameters":{"operation":"delete","calendar":{"__rl":true,"value":"={{ $json.Globals.calendarId }}","mode":"id"},"eventId":"={{ $json.GCal_ID }}","options":{}},"id":"9ac10cad-cbf7-427c-95be-a2866992f2bd","name":"Delete event2","type":"n8n-nodes-base.googleCalendar","typeVersion":1,"position":[496,-80],"alwaysOutputData":false},{"parameters":{"options":{"reset":false}},"id":"aacb6d30-3a2e-4134-b86f-284999ae3cda","name":"Loop4","type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[288,-80]},{"parameters":{"resource":"databasePage","operation":"getAll","databaseId":{"__rl":true,"value":"dad4835c-1acc-4209-aac2-11440b13c475","mode":"list","cachedResultName":"Tasks","cachedResultUrl":"https://www.notion.so/dad4835c1acc4209aac211440b13c475"},"returnAll":true,"simple":false,"filterType":"manual","matchType":"allFilters","filters":{"conditions":[{"key":"GCal ID|rich_text","condition":"is_not_empty"},{"key":"Status|status","condition":"does_not_equal","statusValue":"Done"},{"key":"Status|status","condition":"does_not_equal","statusValue":"Archived"}]},"options":{}},"id":"3f96690a-1210-4fe4-83e2-65e1a40f968f","name":"Notion1","type":"n8n-nodes-base.notion","typeVersion":2.1,"position":[-5088,1584]},{"parameters":{"mode":"combine","mergeByFields":{"values":[{"field1":"id","field2":"id"}]},"joinMode":"keepEverything","options":{}},"id":"489c553a-019d-4efd-aebb-de050bf1a98b","name":"Merge","type":"n8n-nodes-base.merge","typeVersion":2.1,"position":[-4800,1504]},{"parameters":{"content":"## Add one trigger for each Notion database that you want to sync","height":702.7054859554116,"width":289.07844289683123},"id":"4e0e58af-b570-4fc6-abc7-c76b7954bba2","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4128,1120]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date.end }}","operation":"isNotEmpty"}]}},"id":"e9a67110-5504-411f-813f-698b69f678fa","name":"Does it have an end date?1","type":"n8n-nodes-base.if","typeVersion":1,"position":[-608,400]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date.end }}","operation":"isNotEmpty"}]}},"id":"a2aa1fe7-961e-4f92-8632-bb64e165f846","name":"Does it have an end date?2","type":"n8n-nodes-base.if","typeVersion":1,"position":[-752,2544]},{"parameters":{"calendar":{"__rl":true,"value":"={{ $json.Globals.calendarId }}","mode":"id"},"start":"={{ $json.notionDate.date.start }}","end":"={{ $json.notionDate.date.start }}","additionalFields":{"allday":"yes","description":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>","summary":"={{ $json[\"notionName\"] }}"}},"id":"9bd72925-fcea-49db-9087-b079ef4912a5","name":"Google Calendar2","type":"n8n-nodes-base.googleCalendar","typeVersion":1,"position":[80,2640]},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $('Loop5').item.json.notionID }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"GCal ID|rich_text","textContent":"={{ $json.id }}"}]},"options":{}},"id":"cc28be6c-03f7-441b-bd3c-715bb33e3f7f","name":"Add GCal ID2","type":"n8n-nodes-base.notion","typeVersion":2,"position":[496,2640]},{"parameters":{"content":"## YYYY-MM-DD","height":80,"width":190.88107700739067,"color":7},"id":"33cc4b30-53b7-4e41-9ec9-efe8f8e67fc7","name":"Sticky Note18","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[688,2672]},{"parameters":{"options":{"reset":false}},"id":"438c6a5e-5d95-49a2-8cdb-e879736f365a","name":"Loop5","type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[-112,2640]},{"parameters":{"content":"## YYYY-MM-DD\n## YYYY-MM-DD","height":96.35243080295625,"width":190.88107700739073,"color":7},"id":"53b11a1e-c42e-4a0e-bb64-93d9635bb9f3","name":"Sticky Note19","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[688,2432]},{"parameters":{"content":"## YYYY-MM-DD T HH:MM:SS-Z\n## YYYY-MM-DD T HH:MM:SS-Z","height":96.35243080295625,"width":364.9229338011439,"color":7},"id":"d141cf7c-091e-47d1-96b2-73f9eeb28793","name":"Sticky Note20","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[688,1808]},{"parameters":{"content":"## YYYY-MM-DD T HH:MM:SS-Z","height":80,"width":359.18646169567,"color":7},"id":"dd9e5cfa-f736-40a1-a626-2545f96188a2","name":"Sticky Note21","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[688,2064]},{"parameters":{"content":"## YYYY-MM-DD","height":80,"width":190.88107700739067,"color":7},"id":"410bd028-ce09-4df6-a6c5-c7100332caf0","name":"Sticky Note26","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[688,880]},{"parameters":{"content":"## YYYY-MM-DD\n## YYYY-MM-DD","height":96.35243080295625,"width":190.88107700739073,"color":7},"id":"11ab49b8-b77d-4e98-9ae2-a409f8695295","name":"Sticky Note27","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[688,688]},{"parameters":{"content":"## YYYY-MM-DD T HH:MM:SS-Z\n## YYYY-MM-DD T HH:MM:SS-Z","height":109.18668977858542,"width":364.9229338011439,"color":7},"id":"c25336a9-0f01-4a2b-ba1d-4f3179ef8d57","name":"Sticky Note28","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[688,272]},{"parameters":{"content":"## YYYY-MM-DD T HH:MM:SS-Z","height":83.20856474390726,"width":359.18646169567,"color":7},"id":"22cb469b-8ef8-4229-8901-2ff68f429398","name":"Sticky Note29","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[688,464]},{"parameters":{"content":"## Runs when page is deleted in Notion","height":96.35243080295625,"width":364.9229338011439,"color":7},"id":"238284bf-8737-40a7-a1d7-374194c01a4d","name":"Sticky Note31","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[688,-80]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.GCal_ID }}","operation":"isNotEmpty"}]}},"id":"08ab1184-126e-4da1-9751-c8cc8f86753e","name":"GCal_ID exists in Notion?","type":"n8n-nodes-base.if","typeVersion":1,"position":[-2112,1552]},{"parameters":{"conditions":{"boolean":[{"value1":"={{ $json.in_trash }}","value2":"={{ true }}"}]}},"id":"6083e58c-2663-4d03-9c6f-e056b2c34f05","name":"Is the page deleted?","type":"n8n-nodes-base.if","typeVersion":1,"position":[-1600,688]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.notionDate.date.end }}","operation":"isNotEmpty"}]}},"id":"4faadf12-c201-4473-8e6b-8377ec666668","name":"Does it have an end date?3","type":"n8n-nodes-base.if","typeVersion":1,"position":[-608,704]},{"parameters":{"content":"## Runs when date is cleared in Notion","height":96.35243080295625,"width":364.9229338011439,"color":7},"id":"36c0f4d1-b113-44d0-91e8-003e7ae69464","name":"Sticky Note33","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[688,1152]},{"parameters":{"operation":"addToDate","magnitude":"={{ $json.notionDate.date.end.toDateTime() }}","duration":1,"outputFieldName":"endDateTime_Adjusted","options":{"includeInputFields":true}},"id":"0013dded-37ec-45a7-ad21-0549606d195b","name":"Add 1 day to end date","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-112,688],"notesInFlow":true,"notes":"Google Calendar and Notion handle end dates differently, when there's no time set.\n\nIf a date in Notion is from Nov-10 to Nov-12, in Google it will show \"Nov-10 at 00:00\" to \"Nov-12 at 00:00\".\nMeaning the event would end at the beggining of the day in Nov-12, not lasting all day.\n\nSo to make an event last all day in Nov-12 you have to make the end_date \"Nov-13 at 00:00\"."},{"parameters":{"operation":"formatDate","date":"={{ $json.endDateTime_Adjusted }}","format":"yyyy-MM-dd","outputFieldName":"endDate_Adjusted","options":{"includeInputFields":true}},"id":"be4b99a1-9aa9-4a7c-9baa-9a0f3b34f487","name":"Format date","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[80,688]},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $json.Globals.calendarId }}/events/{{ $json.GCal_ID }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"bodyParameters":{"parameters":[{"name":"start","value":"={{ {\n  \"dateTime\": null,\n  \"date\": $json.notionDate.date.start\n} }}"},{"name":"end","value":"={{ {\n  \"dateTime\": null,\n  \"date\": $json.endDate_Adjusted\n} }}"},{"name":"summary","value":"={{ $json.notionName }}"},{"name":"status","value":"confirmed"},{"name":"description","value":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>"}]},"options":{}},"id":"4eb9cb54-bbb9-4385-8b65-7d550ce2b7aa","name":"Update to All Day event","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[288,688]},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $json.Globals.calendarId }}/events/{{ $json.GCal_ID }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"bodyParameters":{"parameters":[{"name":"start","value":"={{ {\n  \"dateTime\": null,\n  \"date\": $json.notionDate.date.start\n} }}"},{"name":"end","value":"={{ {\n  \"dateTime\": null,\n  \"date\": $json.notionDate.date.start\n} }}"},{"name":"summary","value":"={{ $json.notionName }}"},{"name":"status","value":"confirmed"},{"name":"description","value":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>"}]},"options":{}},"id":"ec3ab564-aaf9-4e61-a025-b33249ff1fbc","name":"Update to All Day event2","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[288,880]},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $json.Globals.calendarId }}/events/{{ $json.GCal_ID }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"bodyParameters":{"parameters":[{"name":"start","value":"={{ {\n  \"dateTime\": $json.notionDate.date.start,\n  \"date\": null\n} }}"},{"name":"end","value":"={{ {\n  \"dateTime\": $json.defaultEndDate,\n  \"date\": null\n} }}"},{"name":"summary","value":"={{ $json.notionName }}"},{"name":"status","value":"confirmed"},{"name":"description","value":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>"}]},"options":{}},"id":"0d88f2d6-2bce-4fbc-8dc1-168d9ef6e1bd","name":"Update dateTime event1","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[288,448]},{"parameters":{"operation":"addToDate","magnitude":"={{ $json.notionDate.date.end.toDateTime() }}","duration":1,"outputFieldName":"endDateTime_Adjusted","options":{"includeInputFields":true}},"id":"78f45649-c45c-423c-a2cd-03f2f24142a7","name":"Add 1 day to end date1","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-288,2400],"notesInFlow":true,"notes":"Google Calendar and Notion handle end dates differently, when there's no time set.\n\nIf a date in Notion is from Nov-10 to Nov-12, in Google it will show \"Nov-10 at 00:00\" to \"Nov-12 at 00:00\".\nMeaning the event would end at the beggining of the day in Nov-12, not lasting all day.\n\nSo to make an event last all day in Nov-12 you have to make the end_date \"Nov-13 at 00:00\"."},{"parameters":{"operation":"formatDate","date":"={{ $json.endDateTime_Adjusted }}","format":"yyyy-MM-dd","outputFieldName":"endDate_Adjusted","options":{"includeInputFields":true}},"id":"a478c8eb-f210-4491-a04c-8305571d512b","name":"Format date1","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-112,2400]},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"7bcd3c8e-bdae-43d7-9023-a089298db558","leftValue":"={{ $json.last_edited_by.id }}","rightValue":"={{ $json.Globals.n8nConnectionUserId }}","operator":{"type":"string","operation":"notEquals"}}],"combinator":"and"},"options":{}},"id":"a12e9c2e-b2d1-4d76-9ba7-ee9886ccf0ff","name":"Page edited by a user?","type":"n8n-nodes-base.if","typeVersion":2,"position":[-2928,1568],"notesInFlow":true,"notes":"This prevents infinite loops of pages being edited by n8n and triggering the workflow again and again.\nIt will only update Google Calendar events when a user edits the Notion pages."},{"parameters":{},"id":"e91565f1-70e1-4fd6-b112-e75dce86625a","name":"Do nothing","type":"n8n-nodes-base.noOp","typeVersion":1,"position":[-2688,1744]},{"parameters":{"operation":"getAll","calendar":{"__rl":true,"value":"72fb857fe78a97c9ad2d361a2b433518df6549ac7149192c8cca38c73b919eca@group.calendar.google.com","mode":"list","cachedResultName":"Notion Tasks"},"returnAll":true,"options":{"timeMin":"={{ $today.minus(1, 'days') }}"}},"id":"848c06b9-0eec-4eab-9231-82d8279f01bb","name":"Get future events + yesterday","type":"n8n-nodes-base.googleCalendar","typeVersion":1.1,"position":[-5056,3312]},{"parameters":{"content":"# Notion ➡ Google","height":80,"width":339.3724182117961,"color":7},"id":"2ba66378-8a3b-4d0c-9e77-7d327b24309e","name":"Sticky Note9","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4160,1024]},{"parameters":{"content":"# Google ➡ Notion","height":87.25811154533459,"width":329.84653344771755,"color":7},"id":"e3b1b3af-021e-477c-b2ba-ec4dd50ad633","name":"Sticky Note10","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4128,3088]},{"parameters":{"operation":"getTimeBetweenDates","startDate":"={{ $json.extendedProperties.shared.lastUpdatedByAutomation }}","endDate":"={{ $json.updated }}","units":["second"],"options":{"includeInputFields":true}},"id":"c788b86b-367e-4235-930d-b2db24ca59ea","name":"Calculate timeDifference between Google's updated_at  and our own updated_at fields","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-2496,3824]},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"b2b768dd-1682-42c2-9b6a-cd30a25415ba","leftValue":"={{ $json.timeDifference.seconds }}","rightValue":2,"operator":{"type":"number","operation":"gt"}}],"combinator":"and"},"options":{}},"id":"255b1243-75ce-4f13-ba02-b1ee87285a7e","name":"Only events that were edited 2s after the last update","type":"n8n-nodes-base.filter","typeVersion":2,"position":[-2288,3824],"notesInFlow":true,"notes":"This prevents an infinite loop.\n\nWhen you edit your Notion page, our automation edits the Google event. This would activate the Google trigger again and again.\n\nUsing the field \"lastUpdatedByAutomation\" we can check if the update happened after our automation ran. Meaning the user was the one that edited the event."},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.start.dateTime }}","operation":"contains","value2":"T"}]}},"id":"a82901bf-77ed-4103-85fe-9fe055e3196e","name":"Does it have a time?2","type":"n8n-nodes-base.if","typeVersion":1,"position":[-2080,3824]},{"parameters":{"operation":"subtractFromDate","magnitude":"={{ $json.end.date }}","duration":1,"outputFieldName":"notionDateTimeEnd","options":{"includeInputFields":true}},"id":"58648280-2cf4-44c1-b6c4-691e0a58ac75","name":"Subtract 1 day from end_date","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-1856,3920],"notesInFlow":true,"notes":"Google Calendar and Notion handle end dates differently, when there's no time set.\n\nIf a date in Notion is from Nov-10 to Nov-12, in Google it will show \"Nov-10 at 00:00\" to \"Nov-12 at 00:00\".\n\nWhen you set an event in Google from Nov-12 to Nov-13, it sets the end date to \"Nov-14 at 00:00\" behind the scenes.\nMeaning the event would end at the beggining of Nov-14, lasting all day long during Nov-13.\n\nBut Notion considers Nov-12 to Nov-13 already as all day dates.\nSo Nov-14 in Google must be Nov-13 in Notion."},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"817652c4-64ad-45d7-800a-c58e2e23f9cc","leftValue":"={{ $json.extendedProperties.shared.lastUpdatedByAutomation }}","rightValue":"","operator":{"type":"string","operation":"notExists","singleValue":true}}],"combinator":"and"},"options":{}},"id":"687beff7-d48a-4076-a26e-d4faf79635e0","name":"Is it a new event?","type":"n8n-nodes-base.if","typeVersion":2,"position":[-2752,3664]},{"parameters":{"operation":"formatDate","date":"={{ $json.notionDateTimeEnd }}","format":"yyyy-MM-dd","outputFieldName":"notiondEndDate","options":{"includeInputFields":true}},"id":"1e20fc2a-f9e6-445d-b021-d8211f6f9fa3","name":"Format end_date","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-1648,3920]},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"f42973c2-8188-432c-803b-c6fb760070fd","name":"Add extendedProperties to Google event","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[496,272]},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"3e3fb165-e8b2-43d4-afd6-11da746772ca","name":"Add extendedProperties to Google event1","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[496,448]},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"59051943-6afe-48f8-9eec-2c1efeb26e17","name":"Add extendedProperties to Google event2","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[496,688]},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"e7513ccd-7949-4d31-847f-667e02ffa210","name":"Add extendedProperties to Google event3","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[496,880]},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"e74d0ea8-9f3e-46ff-9410-fcc43d57c4df","name":"Add extendedProperties to Google event4","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[288,1808]},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"4df765e0-15b6-4180-bc4f-a217ef36dfc0","name":"Add extendedProperties to Google event5","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[288,2048]},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"6449a86c-868d-424c-9b4a-9f96436f9bd4","name":"Add extendedProperties to Google event6","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[288,2400]},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs').item.json.Globals.calendarId }}/events/{{ $json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $('Set some fields').item.json.notionID }}\"\n    }\n  }\n}","options":{}},"id":"af122c53-6c98-41ae-b870-bcef14009601","name":"Add extendedProperties to Google event7","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[288,2640]},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"a16200de-0d2b-4144-a5ea-77d52e1eed42","leftValue":"={{ $json.start.date }}","rightValue":"={{ $json.notiondEndDate }}","operator":{"type":"string","operation":"notRegex"}}],"combinator":"and"},"options":{}},"id":"11f83491-07c9-497b-b836-cae394436724","name":"Does it really have an end_date?","type":"n8n-nodes-base.if","typeVersion":2,"position":[-1456,3920]},{"parameters":{"conditions":{"string":[{"value1":"={{ $json.start.dateTime }}","operation":"contains","value2":"T"}]}},"id":"d2525080-b09d-40af-9554-5d12ead22090","name":"Does it have a time?3","type":"n8n-nodes-base.if","typeVersion":1,"position":[-2512,3328]},{"parameters":{"operation":"subtractFromDate","magnitude":"={{ $json.end.date }}","duration":1,"outputFieldName":"notionDateTimeEnd","options":{"includeInputFields":true}},"id":"3302e88a-fcda-49c4-968a-234c8ca179b4","name":"Subtract 1 day from end_date1","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-2288,3424],"notesInFlow":true,"notes":"Google Calendar and Notion handle end dates differently, when there's no time set.\n\nIf a date in Notion is from Nov-10 to Nov-12, in Google it will show \"Nov-10 at 00:00\" to \"Nov-12 at 00:00\".\n\nWhen you set an event in Google from Nov-12 to Nov-13, it sets the end date to \"Nov-14 at 00:00\" behind the scenes.\nMeaning the event would end at the beggining of Nov-14, lasting all day long during Nov-13.\n\nBut Notion considers Nov-12 to Nov-13 already as all day dates.\nSo Nov-14 in Google must be Nov-13 in Notion."},{"parameters":{"operation":"formatDate","date":"={{ $json.notionDateTimeEnd }}","format":"yyyy-MM-dd","outputFieldName":"notiondEndDate","options":{"includeInputFields":true}},"id":"145c94fa-021a-4471-b612-d79251489c90","name":"Format end_date1","type":"n8n-nodes-base.dateTime","typeVersion":2,"position":[-2096,3424]},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"a16200de-0d2b-4144-a5ea-77d52e1eed42","leftValue":"={{ $json.start.date }}","rightValue":"={{ $json.notiondEndDate }}","operator":{"type":"string","operation":"notRegex"}}],"combinator":"and"},"options":{}},"id":"be531405-e6e7-437b-b4d3-def9a5834a07","name":"Does it really have an end_date?1","type":"n8n-nodes-base.if","typeVersion":2,"position":[-1888,3424]},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"={{ $json.Globals.databaseId }}","mode":"id"},"title":"={{ $json.summary }}","propertiesUi":{"propertyValues":[{"key":"Date|date","range":true,"includeTime":false,"dateStart":"={{ $json.start.date }}","dateEnd":"={{ $json.notiondEndDate }}"},{"key":"GCal ID|rich_text","textContent":"={{ $json.id }}"}]},"options":{}},"id":"482b11e5-661a-4eaf-a6cd-d2b82ed24bb9","name":"Create page1","type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-1680,3328]},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"={{ $json.Globals.databaseId }}","mode":"id"},"title":"={{ $json.summary }}","propertiesUi":{"propertyValues":[{"key":"Date|date","includeTime":false,"date":"={{ $json.start.date }}"},{"key":"GCal ID|rich_text","textContent":"={{ $json.id }}"}]},"options":{}},"id":"9c1c1409-b943-4151-9a5c-0554ffe8cbbc","name":"Create page2","type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-1680,3520]},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs1').item.json.Globals.calendarId }}/events/{{ $('Globals1').item.json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $json.id }}\"\n    }\n  },\n  \"description\": \"👉 <a href=https://www.notion.so/{{ $json.id.replaceAll(\"-\", \"\") }} target=_blank><b>View in Notion</b></a>\"\n}","options":{}},"id":"fa3c986e-f2dd-431c-a516-d652b49d1681","name":"Add extendedProperties to Google event8","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[-2096,3232]},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs1').item.json.Globals.calendarId }}/events/{{ $('Globals1').item.json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $json.id }}\"\n    }\n  },\n  \"description\": \"👉 <a href=https://www.notion.so/{{ $json.id.replaceAll(\"-\", \"\") }} target=_blank><b>View in Notion</b></a>\"\n}","options":{}},"id":"28892f93-2ed6-4437-bf24-ffa6fac3beb5","name":"Add extendedProperties to Google event9","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[-1488,3328]},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $('Set the current database and calendar IDs1').item.json.Globals.calendarId }}/events/{{ $('Globals1').item.json.id }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"specifyBody":"json","jsonBody":"={\n  \"extendedProperties\": {\n    \"shared\": {\n      \"lastUpdatedByAutomation\": \"{{ $now.toUTC() }}\",\n      \"notionPageId\": \"{{ $json.id }}\"\n    }\n  },\n  \"description\": \"👉 <a href=https://www.notion.so/{{ $json.id.replaceAll(\"-\", \"\") }} target=_blank><b>View in Notion</b></a>\"\n}","options":{}},"id":"6cf0264c-0c0c-495b-b2d5-79793ac6bd1d","name":"Add extendedProperties to Google event10","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[-1488,3520]},{"parameters":{"mode":"raw","jsonOutput":"{\n  \"Globals\": {\n    \n    \"n8nConnectionUserId\": \"a1b2c3d4-5678-90ab-cdef-1234567890ab\",\n    \n    \"Tasks\": {\n      \"databaseId\": \"abcdef12-3456-7890-abcd-ef1234567890\",\n      \"calendarId\": \"1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef@group.calendar.google.com\"\n    },\n\n    \"Meetings\": {\n      \"databaseId\": \"fedcba98-7654-3210-fedc-ba9876543210\",\n      \"calendarId\": \"abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdef@group.calendar.google.com\"\n    }\n  }\n}","includeOtherFields":true,"options":{}},"id":"92f671b1-dd39-4dde-a894-3335745de161","name":"Globals","type":"n8n-nodes-base.set","typeVersion":3.4,"position":[-3520,1568]},{"parameters":{"content":"# Set some variables here\n## 1️⃣ n8nConnectionUserId\nWhen a page is edited in Notion it registers the ID of the user that made the change.\n\nTo find out what's the ID for your n8n user, use a Notion node to create a database page and check the 'last_edited_by' field.\n\n\n\n\n## 2️⃣ Database and Calendar IDs\nFor each database you want to sync, you have to add the Notion **databaseId** and Google **calendarId** in JSON objects like this:\n\nTasks: {\n   databaseId: \"`72fb8-57fe78a-sgf976`\",\n   calendarId: \"`73b919eca@group.calendar.google.com`\"\n },\n\nMeetings: {\n    databaseId: \"`157fe-78a23f-dfs978`\",\n    calendarId: \"`2a384hfy@group.calendar.google.com`\"\n  }\n\n## 🚨🚨🚨 ATTENTION 🚨🚨🚨\nThe databaseId must include the hyphens, like this:\n`d6e15d95-c538-4795-b1d8-0e5gc778c03c`\n\nThe pattern is:\n8 characters - 4 characters - 4 characters - 4 characters - 12 characters.","height":1341,"width":399},"id":"86579e8f-eeda-4b28-b635-c9d6ed9b3b28","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-3664,752]},{"parameters":{"jsCode":"const items = $input.all();\nconst updatedItems = items.map(item => {\n  const databaseId = item.json.parent.database_id;\n  let currentCalendarId = null;\n\n  // Searches the Globals object to find the matching field\n  for (const key in item.json.Globals) {\n    if (item.json.Globals[key].databaseId === databaseId) {\n      currentCalendarId = item.json.Globals[key].calendarId;\n      break;\n    }\n  }\n\n  // Rebuild the Globals object with only the desired fields\n  item.json.Globals = {\n    n8nConnectionUserId: item.json.Globals.n8nConnectionUserId,\n    calendarId: currentCalendarId,\n    databaseId: databaseId\n  };\n  \n  return item;\n});\n\nreturn updatedItems;"},"id":"e5b22906-6c78-46f9-828e-042021df2800","name":"Set the current database and calendar IDs","type":"n8n-nodes-base.code","typeVersion":2,"position":[-3200,1568]},{"parameters":{"content":"# Copy the Globals from above and paste here","height":388.29901720463954,"width":319.61007431942534},"id":"4e4ce232-e862-4794-bf82-2ae7aadd5cde","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-3616,3472]},{"parameters":{"mode":"raw","jsonOutput":"{\n  \"Globals\": {\n    \n    \"n8nConnectionUserId\": \"a1b2c3d4-5678-90ab-cdef-1234567890ab\",\n    \n    \"Tasks\": {\n      \"databaseId\": \"abcdef12-3456-7890-abcd-ef1234567890\",\n      \"calendarId\": \"1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef@group.calendar.google.com\"\n    },\n\n    \"Meetings\": {\n      \"databaseId\": \"fedcba98-7654-3210-fedc-ba9876543210\",\n      \"calendarId\": \"abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdef@group.calendar.google.com\"\n    }\n  }\n}","includeOtherFields":true,"options":{}},"id":"15398350-57c4-4834-a79a-f18f63981a7f","name":"Globals1","type":"n8n-nodes-base.set","typeVersion":3.4,"position":[-3520,3664]},{"parameters":{"content":"# Copy the Globals from above and paste here","height":380.06310703196385,"width":319.61007431942534},"id":"2597a78f-def7-42bb-9758-6e74d4c29f22","name":"Sticky Note14","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-3616,4432]},{"parameters":{"mode":"raw","jsonOutput":"{\n  \"Globals\": {\n    \n    \"n8nConnectionUserId\": \"a1b2c3d4-5678-90ab-cdef-1234567890ab\",\n    \n    \"Tasks\": {\n      \"databaseId\": \"abcdef12-3456-7890-abcd-ef1234567890\",\n      \"calendarId\": \"1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef@group.calendar.google.com\"\n    },\n\n    \"Meetings\": {\n      \"databaseId\": \"fedcba98-7654-3210-fedc-ba9876543210\",\n      \"calendarId\": \"abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdef@group.calendar.google.com\"\n    }\n  }\n}","includeOtherFields":true,"options":{}},"id":"720d770a-35cd-47f8-aeab-58e44851c788","name":"Globals2","type":"n8n-nodes-base.set","typeVersion":3.4,"position":[-3520,4624]},{"parameters":{"jsCode":"const items = $input.all();\nconst updatedItems = items.map(item => {\n  const calendarId = item.json.organizer.email;\n  let currentDatabaseId = null;\n\n  // Searches the Globals object to find the matching field\n  for (const key in item.json.Globals) {\n    if (item.json.Globals[key].calendarId === calendarId) {\n      currentDatabaseId = item.json.Globals[key].databaseId;\n      break;\n    }\n  }\n\n  // Rebuild the Globals object with only the desired fields\n  item.json.Globals = {\n    n8nConnectionUserId: item.json.Globals.n8nConnectionUserId,\n    calendarId: calendarId,\n    databaseId: currentDatabaseId\n  };\n  \n  return item;\n});\n\nreturn updatedItems;"},"id":"ec2cb823-5cbf-4883-a18f-e19c19936aa9","name":"Set the current database and calendar IDs2","type":"n8n-nodes-base.code","typeVersion":2,"position":[-3216,4624]},{"parameters":{"content":"## Use this node for testing\nReplace the Event Updated trigger by this node","height":305.14255210487977,"width":315.66399727154976},"id":"f399c4d3-5484-4669-ba24-8acf54d22464","name":"Sticky Note16","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-5152,3184]},{"parameters":{"content":"## Add two triggers for each Google Calendar that you want to sync","height":665.1419819421769,"width":365.7122508375314},"id":"a33911e5-6f5b-4eea-85ff-b52304c28e66","name":"Sticky Note17","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4160,3184]},{"parameters":{"content":"## Add one trigger for each Google Calendar that you want to sync","height":641.5966864244806,"width":283.9419368038477},"id":"9acf98f3-9fbc-4611-9d4d-7467bca161ef","name":"Sticky Note34","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4112,4160]},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"calendarId":{"__rl":true,"value":"72fb857fe78a97c9ad2d361a2b433518df6549ac7149192c8cca38c73b919eca@group.calendar.google.com","mode":"list","cachedResultName":"Notion Tasks"},"triggerOn":"eventUpdated","options":{}},"id":"85317c5a-3a45-40d5-895a-926bcc6d3d32","name":"Event Updated","type":"n8n-nodes-base.googleCalendarTrigger","typeVersion":1,"position":[-3952,3312]},{"parameters":{},"id":"37a128f4-b830-4a0b-8db2-e31d275f6233","name":"When clicking \"Test workflow\"","type":"n8n-nodes-base.manualTrigger","typeVersion":1,"position":[-5408,1504],"disabled":true},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"calendarId":{"__rl":true,"value":"5ee2a7975418d942ddaa25d4e85643ceba794eaff453aa23aaf7336d5511c2a1@group.calendar.google.com","mode":"list","cachedResultName":"ToDo Cal"},"triggerOn":"eventCreated","options":{}},"id":"6c1d4f96-f142-4fd5-b9b4-ffcae1887886","name":"Event Created","type":"n8n-nodes-base.googleCalendarTrigger","typeVersion":1,"position":[-4112,3312],"credentials":{"googleCalendarOAuth2Api":{"id":"DdfYd0Ary58P581i","name":"Google Calendar account"}}},{"parameters":{"content":"# Tasks","height":99.22146266772059,"width":196.39800582684305,"color":7},"id":"8839c458-2f34-4632-a3b3-918825fe0f9f","name":"Sticky Note35","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4368,3312]},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $json.extendedProperties.shared.notionPageId }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"Data|date","includeTime":false,"date":"={{ $json.start.date }}"},{"key":"Task name|title","title":"={{ $json.summary }}"}]},"options":{}},"id":"b1a5e66e-6e5f-401f-b568-55b2a1f58a77","name":"Update page1 - continue on error","type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-1232,4032],"onError":"continueRegularOutput"},{"parameters":{"content":"### Allowing these Notion nodes to continue on error prevents deleted pages from stopping the workflow.\n\nThe deleted pages go to another branch to be deleted in Google Calendar.","height":324.9384888466118,"color":7},"id":"718157e8-6128-40bd-bfee-fafe1b0aa952","name":"Sticky Note36","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-1056,3840]},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"186dc8f2-4a6d-416c-9900-1b4ee8e7418b","leftValue":"={{ $json.in_trash }}","rightValue":"true","operator":{"type":"boolean","operation":"true","singleValue":true}}],"combinator":"and"},"options":{}},"id":"5e1aa263-7812-430b-b6c6-07022c98fa41","name":"Find deleted pages1","type":"n8n-nodes-base.filter","typeVersion":2,"position":[-2288,2272]},{"parameters":{"operation":"delete","calendar":{"__rl":true,"value":"={{ $('Only calendarId').item.json.calendarId }}","mode":"id"},"eventId":"={{ $json.properties['GCal ID'].rich_text[0].text.content }}","options":{}},"id":"58c5764b-d44c-4a04-8ac9-b0cbd3a8a938","name":"Delete event3","type":"n8n-nodes-base.googleCalendar","typeVersion":1,"position":[-2112,2272],"alwaysOutputData":false},{"parameters":{"content":"## This flow checks if any Notion page was deleted and deletes the event\nWe have to do this because there's no way to retrieve deleted pages using the Notion API.\n\nAnd the \"page updated\" trigger uses the Notion API to check for updates, so it never detects when a page was deleted.","height":306.9481514579442,"width":286.9846072927019,"color":7},"id":"81124054-4244-4232-ab30-87be46d47f0b","name":"Sticky Note38","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4128,2144]},{"parameters":{"operation":"getAll","calendar":{"__rl":true,"value":"={{ $json.calendarId }}","mode":"id"},"returnAll":true,"options":{"timeMin":"={{ $today.minus(1, 'days') }}"}},"id":"d10a0d65-c7af-4140-9573-e113ed71ebfd","name":"Get future events1","type":"n8n-nodes-base.googleCalendar","typeVersion":1.1,"position":[-2832,2272],"alwaysOutputData":false},{"parameters":{"resource":"databasePage","operation":"get","pageId":{"__rl":true,"value":"={{ $json.extendedProperties.shared.notionPageId }}","mode":"id"},"simple":false},"id":"55efb8a8-cce8-4bc1-950f-4dda084f0bba","name":"Find related pages1","type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-2480,2272]},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"7a2065ef-7d16-4d67-aea0-e2d9185562cd","leftValue":"={{ $json.extendedProperties.shared.notionPageId }}","rightValue":"","operator":{"type":"string","operation":"exists","singleValue":true}}],"combinator":"and"},"options":{}},"id":"71bf52ce-7b3b-4d16-b292-f8cb1930929e","name":"extendedProperties exist?","type":"n8n-nodes-base.filter","typeVersion":2,"position":[-2656,2272]},{"parameters":{"jsCode":"const items = $input.all();\nconst updatedItems = items.map(item => {\n  const calendarId = item.json.organizer.email;\n  let currentDatabaseId = null;\n\n  // Searches the Globals object to find the matching field\n  for (const key in item.json.Globals) {\n    if (item.json.Globals[key].calendarId === calendarId) {\n      currentDatabaseId = item.json.Globals[key].databaseId;\n      break;\n    }\n  }\n\n  // Rebuild the Globals object with only the desired fields\n  item.json.Globals = {\n    n8nConnectionUserId: item.json.Globals.n8nConnectionUserId,\n    calendarId: calendarId,\n    databaseId: currentDatabaseId\n  };\n  \n  return item;\n});\n\nreturn updatedItems;"},"id":"e52995b9-1e10-422b-a160-56a7f464693b","name":"Set the current database and calendar IDs1","type":"n8n-nodes-base.code","typeVersion":2,"position":[-3216,3664]},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $json.extendedProperties.shared.notionPageId }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"Date|date","range":true,"dateStart":"={{ $json.start.dateTime }}","dateEnd":"={{ $json.end.dateTime }}"},{"key":"Name|title","title":"={{ $json.summary }}"}]},"options":{}},"id":"70f4644f-5a94-4ce3-bff0-b36a24e78117","name":"Update page2 - continue on error","type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-1856,3728],"onError":"continueRegularOutput"},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $json.extendedProperties.shared.notionPageId }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"Date|date","range":true,"includeTime":false,"dateStart":"={{ $json.start.date }}","dateEnd":"={{ $json.notiondEndDate }}"},{"key":"Name|title","title":"={{ $json.summary }}"}]},"options":{}},"id":"3ca81faa-a825-4926-8a96-78b85f1588bc","name":"Update page - continue on error","type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-1232,3840],"onError":"continueRegularOutput"},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"={{ $json.Globals.databaseId }}","mode":"id"},"title":"={{ $json.summary }}","propertiesUi":{"propertyValues":[{"key":"Date|date","range":true,"dateStart":"={{ $json.start.dateTime }}","dateEnd":"={{ $json.end.dateTime }}"},{"key":"GCal ID|rich_text","textContent":"={{ $json.id }}"}]},"options":{}},"id":"c97ea335-18db-43b4-b906-d7c9457b94e5","name":"Create page","type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[-2288,3232]},{"parameters":{"method":"PATCH","url":"=https://www.googleapis.com/calendar/v3/calendars/{{ $json.Globals.calendarId }}/events/{{ $json.GCal_ID }}","authentication":"predefinedCredentialType","nodeCredentialType":"googleCalendarOAuth2Api","sendBody":true,"bodyParameters":{"parameters":[{"name":"start","value":"={{ {\n  \"dateTime\": $json.notionDate.date.start,\n  \"date\": null\n} }}"},{"name":"end","value":"={{ {\n  \"dateTime\": $json.notionDate.date.end,\n  \"date\": null\n} }}"},{"name":"summary","value":"={{ $json.notionName }}"},{"name":"status","value":"confirmed"},{"name":"description","value":"=👉 <a href=\"https://www.notion.so/{{ $json.notionID.replaceAll(\"-\", \"\") }}\" target=\"_blank\"><b>View in Notion</b></a>"}]},"options":{}},"id":"a41eba4d-0d9a-491a-a057-40f1d225290b","name":"Update dateTime event","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[288,272]},{"parameters":{"fields":{"values":[{"name":"notionID","stringValue":"={{ $json.id }}"},{"name":"notionName","stringValue":"={{ $json.properties['Name'].title[0].text.content }}"},{"name":"notionDate","type":"objectValue","objectValue":"={{ $json.properties.Date }}"},{"name":"GCal_ID","stringValue":"={{ $json.properties['GCal ID'].rich_text[0].text.content }}"}]},"include":"selected","includeFields":"archived,Globals","options":{}},"id":"c7743dd1-0061-4e4c-b714-54231929cd9c","name":"Set some fields","type":"n8n-nodes-base.set","typeVersion":3.2,"position":[-2688,1552]},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"event":"pagedUpdatedInDatabase","databaseId":{"__rl":true,"value":"24ddcbfd-8835-80fe-ab1d-fa7270343d5b","mode":"list","cachedResultName":"Meetings","cachedResultUrl":"https://www.notion.so/24ddcbfd883580feab1dfa7270343d5b"},"simple":false},"id":"022fda0a-1390-4de3-a672-88fb193e6917","name":"Page Updated - Meetings","type":"n8n-nodes-base.notionTrigger","typeVersion":1,"position":[-4048,1440]},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"event":"pagedUpdatedInDatabase","databaseId":{"__rl":true,"value":"218dcbfd-8835-8008-a2bd-c164ab084ed3","mode":"list","cachedResultName":"TODO ","cachedResultUrl":"https://www.notion.so/218dcbfd88358008a2bdc164ab084ed3"},"simple":false},"id":"12be224b-488b-4ebb-9b07-ab356be7c044","name":"Page Updated - Tasks","type":"n8n-nodes-base.notionTrigger","typeVersion":1,"position":[-4048,1264]},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"calendarId":{"__rl":true,"value":"a1dbc9e1d2ad0ef57f8fd3c79dd8def8a01ba4bcfb7ffdd0f4c87e790a095aa0@group.calendar.google.com","mode":"list","cachedResultName":"Notion Reuniões"},"triggerOn":"eventUpdated","options":{}},"id":"c19b313d-158e-4edb-b186-afc02bac1905","name":"Event Updated1","type":"n8n-nodes-base.googleCalendarTrigger","typeVersion":1,"position":[-3952,3504]},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"calendarId":{"__rl":true,"value":"a1dbc9e1d2ad0ef57f8fd3c79dd8def8a01ba4bcfb7ffdd0f4c87e790a095aa0@group.calendar.google.com","mode":"list","cachedResultName":"Notion Reuniões"},"triggerOn":"eventCreated","options":{}},"id":"a354dffc-2d83-4b85-a1d6-6d01a1e811e7","name":"Event Created1","type":"n8n-nodes-base.googleCalendarTrigger","typeVersion":1,"position":[-4112,3504]},{"parameters":{"content":"# Meetings","height":99.22146266772059,"width":196.39800582684305,"color":7},"id":"ded8b0c0-5aab-4acb-977e-2d3c6b39fccd","name":"Sticky Note37","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-4368,3504]},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"calendarId":{"__rl":true,"value":"72fb857fe78a97c9ad2d361a2b433518df6549ac7149192c8cca38c73b919eca@group.calendar.google.com","mode":"list","cachedResultName":"Notion Tasks"},"triggerOn":"eventCancelled","options":{}},"id":"64b449c1-e247-4df2-b287-f7a534ceb4ba","name":"Deleted - Tasks","type":"n8n-nodes-base.googleCalendarTrigger","typeVersion":1,"position":[-4032,4304]},{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"calendarId":{"__rl":true,"value":"a1dbc9e1d2ad0ef57f8fd3c79dd8def8a01ba4bcfb7ffdd0f4c87e790a095aa0@group.calendar.google.com","mode":"list","cachedResultName":"Notion Reuniões"},"triggerOn":"eventCancelled","options":{}},"id":"2e877a62-abbe-4f41-be7b-29e419f964a7","name":"Deleted - Meetings","type":"n8n-nodes-base.googleCalendarTrigger","typeVersion":1,"position":[-4032,4480]},{"parameters":{"mode":"raw","jsonOutput":"{\n  \"Globals\": {\n    \n    \"n8nConnectionUserId\": \"a1b2c3d4-5678-90ab-cdef-1234567890ab\",\n    \n    \"Tasks\": {\n      \"databaseId\": \"abcdef12-3456-7890-abcd-ef1234567890\",\n      \"calendarId\": \"1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef@group.calendar.google.com\"\n    },\n\n    \"Meetings\": {\n      \"databaseId\": \"fedcba98-7654-3210-fedc-ba9876543210\",\n      \"calendarId\": \"abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdef@group.calendar.google.com\"\n    }\n  }\n}","includeOtherFields":true,"options":{}},"id":"1d8806b5-66ca-47b2-8b7a-3a084555f377","name":"Globals3","type":"n8n-nodes-base.set","typeVersion":3.4,"position":[-3520,2272]},{"parameters":{"fieldToSplitOut":"Globals","options":{}},"id":"bc0616ff-4b24-4afe-a1d6-1098e5fe13c7","name":"Split fields","type":"n8n-nodes-base.splitOut","typeVersion":1,"position":[-3264,2256]},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"b2a5f692-c6c4-4691-b5cf-fcf57bcd2523","leftValue":"={{ $json.calendarId }}","rightValue":"","operator":{"type":"string","operation":"exists","singleValue":true}}],"combinator":"and"},"options":{}},"id":"38cfa666-db36-41c6-9476-3f390271584d","name":"Only calendarId","type":"n8n-nodes-base.filter","typeVersion":2,"position":[-3008,2272]},{"parameters":{"content":"# Copy the Globals from above and paste here","height":388.29901720463954,"width":319.61007431942534},"id":"9fc4ee4d-9d6b-4cfe-8442-aed60741ea8d","name":"Sticky Note41","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-3616,2064]},{"parameters":{"rule":{"interval":[{"field":"minutes","minutesInterval":3}]}},"id":"5406755d-adac-4c5f-8cdf-27f5df4c1b81","name":"Every 3min","type":"n8n-nodes-base.scheduleTrigger","typeVersion":1.2,"position":[-3792,2272]}],"connections":{"Google Calendar1":{"main":[[{"node":"Add extendedProperties to Google event6","type":"main","index":0}]]},"Add GCal ID":{"main":[[{"node":"Loop","type":"main","index":0}]]},"Remove GCal ID2":{"main":[[{"node":"Loop3","type":"main","index":0}]]},"Does it have a date?":{"main":[[{"node":"Does it have a time?","type":"main","index":0}],[{"node":"Loop3","type":"main","index":0}]]},"Does it have a time?":{"main":[[{"node":"Does it have an end date?1","type":"main","index":0}],[{"node":"Does it have an end date?3","type":"main","index":0}]]},"Delete event1":{"main":[[{"node":"Remove GCal ID2","type":"main","index":0}]]},"Does it have a date?1":{"main":[[{"node":"Does it have a time?1","type":"main","index":0}],[{"node":"No Operation, do nothing","type":"main","index":0}]]},"Does it have a time?1":{"main":[[{"node":"Does it have an end date?","type":"main","index":0}],[{"node":"Does it have an end date?2","type":"main","index":0}]]},"Find Task":{"main":[[{"node":"Remove GCal ID and Date","type":"main","index":0}]]},"Notion":{"main":[[{"node":"Merge","type":"main","index":0}]]},"Google Calendar3":{"main":[[{"node":"Add extendedProperties to Google event5","type":"main","index":0}]]},"Google Calendar":{"main":[[{"node":"Add extendedProperties to Google event4","type":"main","index":0}]]},"Add GCal ID3":{"main":[[{"node":"Loop2","type":"main","index":0}]]},"Does it have an end date?":{"main":[[{"node":"Loop2","type":"main","index":0}],[{"node":"Loop1","type":"main","index":0}]]},"Add GCal ID1":{"main":[[{"node":"Loop1","type":"main","index":0}]]},"Loop":{"main":[[],[{"node":"Add 1 day to end date1","type":"main","index":0}]]},"Loop1":{"main":[[],[{"node":"Google Calendar3","type":"main","index":0}]]},"Loop2":{"main":[[],[{"node":"Google Calendar","type":"main","index":0}]]},"Loop3":{"main":[[],[{"node":"Delete event1","type":"main","index":0}]]},"Creates defaultEndDate with 1h duration":{"main":[[{"node":"GCal_ID exists in Notion?","type":"main","index":0}]]},"Delete event2":{"main":[[{"node":"Loop4","type":"main","index":0}]]},"Loop4":{"main":[[],[{"node":"Delete event2","type":"main","index":0}]]},"Notion1":{"main":[[{"node":"Merge","type":"main","index":1}]]},"Does it have an end date?1":{"main":[[{"node":"Update dateTime event","type":"main","index":0}],[{"node":"Update dateTime event1","type":"main","index":0}]]},"Does it have an end date?2":{"main":[[{"node":"Loop","type":"main","index":0}],[{"node":"Loop5","type":"main","index":0}]]},"Google Calendar2":{"main":[[{"node":"Add extendedProperties to Google event7","type":"main","index":0}]]},"Add GCal ID2":{"main":[[{"node":"Loop5","type":"main","index":0}]]},"Loop5":{"main":[[],[{"node":"Google Calendar2","type":"main","index":0}]]},"GCal_ID exists in Notion?":{"main":[[{"node":"Is the page deleted?","type":"main","index":0}],[{"node":"Does it have a date?1","type":"main","index":0}]]},"Is the page deleted?":{"main":[[{"node":"Loop4","type":"main","index":0}],[{"node":"Does it have a date?","type":"main","index":0}]]},"Does it have an end date?3":{"main":[[{"node":"Add 1 day to end date","type":"main","index":0}],[{"node":"Update to All Day event2","type":"main","index":0}]]},"Add 1 day to end date":{"main":[[{"node":"Format date","type":"main","index":0}]]},"Format date":{"main":[[{"node":"Update to All Day event","type":"main","index":0}]]},"Update to All Day event":{"main":[[{"node":"Add extendedProperties to Google event2","type":"main","index":0}]]},"Update to All Day event2":{"main":[[{"node":"Add extendedProperties to Google event3","type":"main","index":0}]]},"Update dateTime event1":{"main":[[{"node":"Add extendedProperties to Google event1","type":"main","index":0}]]},"Add 1 day to end date1":{"main":[[{"node":"Format date1","type":"main","index":0}]]},"Format date1":{"main":[[{"node":"Google Calendar1","type":"main","index":0}]]},"Page edited by a user?":{"main":[[{"node":"Set some fields","type":"main","index":0}],[{"node":"Do nothing","type":"main","index":0}]]},"Calculate timeDifference between Google's updated_at  and our own updated_at fields":{"main":[[{"node":"Only events that were edited 2s after the last update","type":"main","index":0}]]},"Only events that were edited 2s after the last update":{"main":[[{"node":"Does it have a time?2","type":"main","index":0}]]},"Does it have a time?2":{"main":[[{"node":"Update page2 - continue on error","type":"main","index":0}],[{"node":"Subtract 1 day from end_date","type":"main","index":0}]]},"Subtract 1 day from end_date":{"main":[[{"node":"Format end_date","type":"main","index":0}]]},"Is it a new event?":{"main":[[{"node":"Does it have a time?3","type":"main","index":0}],[{"node":"Calculate timeDifference between Google's updated_at  and our own updated_at fields","type":"main","index":0}]]},"Format end_date":{"main":[[{"node":"Does it really have an end_date?","type":"main","index":0}]]},"Add extendedProperties to Google event4":{"main":[[{"node":"Add GCal ID3","type":"main","index":0}]]},"Add extendedProperties to Google event5":{"main":[[{"node":"Add GCal ID1","type":"main","index":0}]]},"Add extendedProperties to Google event6":{"main":[[{"node":"Add GCal ID","type":"main","index":0}]]},"Add extendedProperties to Google event7":{"main":[[{"node":"Add GCal ID2","type":"main","index":0}]]},"Does it really have an end_date?":{"main":[[{"node":"Update page - continue on error","type":"main","index":0}],[{"node":"Update page1 - continue on error","type":"main","index":0}]]},"Does it have a time?3":{"main":[[{"node":"Create page","type":"main","index":0}],[{"node":"Subtract 1 day from end_date1","type":"main","index":0}]]},"Subtract 1 day from end_date1":{"main":[[{"node":"Format end_date1","type":"main","index":0}]]},"Format end_date1":{"main":[[{"node":"Does it really have an end_date?1","type":"main","index":0}]]},"Does it really have an end_date?1":{"main":[[{"node":"Create page1","type":"main","index":0}],[{"node":"Create page2","type":"main","index":0}]]},"Create page1":{"main":[[{"node":"Add extendedProperties to Google event9","type":"main","index":0}]]},"Create page2":{"main":[[{"node":"Add extendedProperties to Google event10","type":"main","index":0}]]},"Globals":{"main":[[{"node":"Set the current database and calendar IDs","type":"main","index":0}]]},"Set the current database and calendar IDs":{"main":[[{"node":"Page edited by a user?","type":"main","index":0}]]},"Globals1":{"main":[[{"node":"Set the current database and calendar IDs1","type":"main","index":0}]]},"Globals2":{"main":[[{"node":"Set the current database and calendar IDs2","type":"main","index":0}]]},"Set the current database and calendar IDs2":{"main":[[{"node":"Find Task","type":"main","index":0}]]},"Event Updated":{"main":[[{"node":"Globals1","type":"main","index":0}]]},"When clicking \"Test workflow\"":{"main":[[{"node":"Notion1","type":"main","index":0},{"node":"Notion","type":"main","index":0}]]},"Event Created":{"main":[[{"node":"Globals1","type":"main","index":0}]]},"Find deleted pages1":{"main":[[{"node":"Delete event3","type":"main","index":0}]]},"Get future events1":{"main":[[{"node":"extendedProperties exist?","type":"main","index":0}]]},"Find related pages1":{"main":[[{"node":"Find deleted pages1","type":"main","index":0}]]},"extendedProperties exist?":{"main":[[{"node":"Find related pages1","type":"main","index":0}]]},"Set the current database and calendar IDs1":{"main":[[{"node":"Is it a new event?","type":"main","index":0}]]},"Create page":{"main":[[{"node":"Add extendedProperties to Google event8","type":"main","index":0}]]},"Update dateTime event":{"main":[[{"node":"Add extendedProperties to Google event","type":"main","index":0}]]},"Set some fields":{"main":[[{"node":"Creates defaultEndDate with 1h duration","type":"main","index":0}]]},"Page Updated - Tasks":{"main":[[{"node":"Globals","type":"main","index":0}]]},"Event Updated1":{"main":[[{"node":"Globals1","type":"main","index":0}]]},"Event Created1":{"main":[[{"node":"Globals1","type":"main","index":0}]]},"Deleted - Tasks":{"main":[[{"node":"Globals2","type":"main","index":0}]]},"Deleted - Meetings":{"main":[[{"node":"Globals2","type":"main","index":0}]]},"Globals3":{"main":[[{"node":"Split fields","type":"main","index":0}]]},"Split fields":{"main":[[{"node":"Only calendarId","type":"main","index":0}]]},"Only calendarId":{"main":[[{"node":"Get future events1","type":"main","index":0}]]},"Every 3min":{"main":[[{"node":"Globals3","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":null,"pinData":{},"versionId":"bad5652b-daf0-4493-a35b-c16cd4aed0b1","triggerCount":0,"tags":[],"shared":[{"createdAt":"2025-08-20T17:01:08.028Z","updatedAt":"2025-08-20T17:01:08.028Z","role":"workflow:owner","workflowId":"Eun9ugdnL2gmh1Ce","projectId":"DQC8ik4pLkhZ4ZDm","project":{"createdAt":"2025-08-19T19:25:16.723Z","updatedAt":"2025-08-19T19:26:16.591Z","id":"DQC8ik4pLkhZ4ZDm","name":"Ben Hex <bhochster@gmail.com>","type":"personal","icon":null,"description":null}}]},{"createdAt":"2025-08-20T17:42:53.064Z","updatedAt":"2025-09-11T23:48:44.000Z","id":"nwfhMwREanyO1Z1b","name":"My workflow 8","active":false,"isArchived":true,"nodes":[{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"databaseId":{"__rl":true,"value":"255dcbfd-8835-8092-a7ba-cac02dc45976","mode":"list","cachedResultName":"whisper transcriber","cachedResultUrl":"https://www.notion.so/255dcbfd88358092a7bacac02dc45976"},"simple":false},"type":"n8n-nodes-base.notionTrigger","typeVersion":1,"position":[0,0],"id":"67fdede8-7e8a-4362-a674-fd3e96914eaf","name":"Notion Trigger","credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"resource":"audio","operation":"transcribe","options":{"language":"HE"}},"type":"@n8n/n8n-nodes-langchain.openAi","typeVersion":1.8,"position":[208,0],"id":"85ca6bbe-b435-428d-9a2d-8f82b2cda3b7","name":"Transcribe a recording","credentials":{"openAiApi":{"id":"gAwL4mjSgmlpPtnq","name":"OpenAi account"}}}],"connections":{"Notion Trigger":{"main":[[{"node":"Transcribe a recording","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":{"templateCredsSetupCompleted":true},"pinData":{},"versionId":"ed008593-0443-4d61-8a3d-a326ed9858db","triggerCount":0,"tags":[],"shared":[{"createdAt":"2025-08-20T17:42:53.066Z","updatedAt":"2025-08-20T17:42:53.066Z","role":"workflow:owner","workflowId":"nwfhMwREanyO1Z1b","projectId":"DQC8ik4pLkhZ4ZDm","project":{"createdAt":"2025-08-19T19:25:16.723Z","updatedAt":"2025-08-19T19:26:16.591Z","id":"DQC8ik4pLkhZ4ZDm","name":"Ben Hex <bhochster@gmail.com>","type":"personal","icon":null,"description":null}}]},{"createdAt":"2025-08-26T11:08:04.457Z","updatedAt":"2025-09-11T23:49:03.000Z","id":"rJbzzwu2Q0YoJLwU","name":"Transcribe & Summarize Audio with Whisper and GPT, from Google Drive to Notion","active":false,"isArchived":true,"nodes":[{"id":"b439f939-2372-44a0-bfa2-57ce9ab82b21","name":"Google Drive Trigger","type":"n8n-nodes-base.googleDriveTrigger","position":[1168,544],"parameters":{"event":"fileCreated","options":{"fileType":"all"},"pollTimes":{"item":[{"mode":"everyMinute"}]},"triggerOn":"specificFolder","folderToWatch":{"__rl":true,"mode":"list","value":"1EMG03GI9ewXAnKj_vT-aAmySU8T-GQZx","cachedResultUrl":"https://drive.google.com/drive/folders/1EMG03GI9ewXAnKj_vT-aAmySU8T-GQZx","cachedResultName":"Ai-Asset Generator"}},"credentials":{"googleDriveOAuth2Api":{"id":"KUrcceziR6IJKjXk","name":"Google Drive account"}},"typeVersion":1},{"id":"e50b6cfd-a9a3-4086-8864-87855e51eeb9","name":"Download file","type":"n8n-nodes-base.googleDrive","position":[1360,544],"parameters":{"fileId":{"__rl":true,"mode":"id","value":"={{ $json.id }}"},"options":{},"operation":"download"},"credentials":{"googleDriveOAuth2Api":{"id":"KUrcceziR6IJKjXk","name":"Google Drive account"}},"typeVersion":3},{"id":"027bcf8f-3653-4661-aef4-ef2909ab2dbc","name":"Transcribe a recording","type":"@n8n/n8n-nodes-langchain.openAi","position":[1584,496],"parameters":{"options":{},"resource":"audio","operation":"transcribe"},"credentials":{"openAiApi":{"id":"gAwL4mjSgmlpPtnq","name":"OpenAi account"}},"typeVersion":1.8},{"id":"e16a789f-8d31-49ef-8074-fd5e761feed9","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[1776,496],"parameters":{"text":"=Just suppose you are a professional Summarizer and helper. \nThis is the data that is coming from a previous node \nAudio-transcribed : {{ $json.text }} \nand its the transcribed version of an mp3 file. Just Summarize the text and return to me a clear and a concize summary of the text.","options":{},"promptType":"define"},"typeVersion":2.1},{"id":"a3e7fc95-5bb7-4c2b-a0a4-0d7eb54d5208","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[1728,688],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4.1-mini"},"options":{}},"credentials":{"openAiApi":{"id":"gAwL4mjSgmlpPtnq","name":"OpenAi account"}},"typeVersion":1.2},{"id":"89801c04-d637-4e8f-b6e5-ce63f20aae95","name":"Create a page","type":"n8n-nodes-base.notion","position":[2224,560],"parameters":{"title":"N8N Output","pageId":{"__rl":true,"mode":"id","value":"234c7c0bc348804da681f5d80eca6712"},"blockUi":{"blockValues":[{"type":"heading_1","textContent":"={{ $json.output }}"}]},"options":{}},"credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}},"typeVersion":2.2},{"id":"19d8919b-ec8a-40d2-bce0-3c385276c62e","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[1552,416],"parameters":{"color":7,"width":560,"height":400,"content":"AI Transcriber and Summarizer Nodes\n"},"typeVersion":1},{"id":"935a24cb-d92c-467a-ac51-5255712e25cb","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[2128,416],"parameters":{"color":3,"width":336,"height":400,"content":"Uploading to the Notion Database\n"},"typeVersion":1},{"id":"d718151b-fff1-492f-b2f9-50c305414dbd","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[1120,416],"parameters":{"width":416,"height":400,"content":"Downloading from Drive(BinarY)\n"},"typeVersion":1},{"id":"8dac6ad8-b94b-4520-a4a9-123107b69e40","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[368,240],"parameters":{"color":5,"width":672,"height":832,"content":"Created by : Abdullah Dilshad\nReach me At : iamabdullahdilshad@gmail.com     \n\nWho It's For 🧑‍💻\nThis system is ideal for individuals or teams who regularly work with audio content and need an efficient way to convert it into text and extract key information. This includes:\n\nResearchers: Quickly transcribe interviews or lectures and get summaries for analysis.\n\nContent Creators: Generate transcripts for podcasts or videos and create quick summaries for social media or show notes.\n\nStudents: Transcribe study materials or lectures and receive summarized notes.\n\nBusiness Professionals: Automate the transcription of meeting recordings and get key takeaways.\n\nHow to Set Up 🛠️\nSetting up this system in n8n involves configuring each of the described nodes:\n\nGoogle Drive Trigger:\n\nConnect your Google Drive account to n8n.\n\nSpecify the exact Google Drive folder that n8n should monitor for new audio file uploads.\n\nConfigure the trigger to download the audio file upon detection.\n\nOpenAI Whisper (Transcribe Recording node):\n\nProvide your OpenAI API key for authentication.\n\nEnsure the node is configured to receive the audio file from the Google Drive Trigger.\n\nGPT-4 (Message Model node):\n\nProvide your OpenAI API key.\n\nConfigure the node to receive the text transcript from the OpenAI Whisper node.\n\nCraft a clear prompt for GPT-4 to ensure it generates the desired type of summary (e.g., \"Provide a clear and concise summary of the following text: [transcript]\").\n\nNotion (Create Page node):\n\nConnect your Notion account to n8n.\n\nSpecify the Notion database or page where the new summaries should be created.\n\nMap the summary output from GPT-4 to a rich text property in Notion.\n\nOptionally, map any relevant metadata (e.g., filename, upload date) to other Notion properties.  "},"typeVersion":1}],"connections":{"AI Agent":{"main":[[{"node":"Create a page","type":"main","index":0}]]},"Download file":{"main":[[{"node":"Transcribe a recording","type":"main","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"Google Drive Trigger":{"main":[[{"node":"Download file","type":"main","index":0}]]},"Transcribe a recording":{"main":[[{"node":"AI Agent","type":"main","index":0}]]}},"settings":null,"staticData":null,"meta":{"templateId":"6139"},"pinData":null,"versionId":"ef4e9df6-6c97-4f21-8b47-78d5c53117fa","triggerCount":0,"tags":[],"shared":[{"createdAt":"2025-08-26T11:08:04.461Z","updatedAt":"2025-08-26T11:08:04.461Z","role":"workflow:owner","workflowId":"rJbzzwu2Q0YoJLwU","projectId":"DQC8ik4pLkhZ4ZDm","project":{"createdAt":"2025-08-19T19:25:16.723Z","updatedAt":"2025-08-19T19:26:16.591Z","id":"DQC8ik4pLkhZ4ZDm","name":"Ben Hex <bhochster@gmail.com>","type":"personal","icon":null,"description":null}}]},{"createdAt":"2025-08-28T21:18:37.557Z","updatedAt":"2025-09-11T23:48:36.000Z","id":"rjlrdDmDHx2I6lzz","name":"My workflow 9","active":false,"isArchived":true,"nodes":[{"parameters":{"rule":{"interval":[{"field":"minutes"}]}},"type":"n8n-nodes-base.scheduleTrigger","typeVersion":1.2,"position":[0,0],"id":"f2892583-bea3-4555-9dd6-35fd2f8487ea","name":"Schedule Trigger"}],"connections":{},"settings":{"executionOrder":"v1"},"staticData":null,"meta":null,"pinData":{},"versionId":"83099142-9aa3-4eac-ba3b-094e75d7a60e","triggerCount":0,"tags":[],"shared":[{"createdAt":"2025-08-28T21:18:37.565Z","updatedAt":"2025-08-28T21:18:37.565Z","role":"workflow:owner","workflowId":"rjlrdDmDHx2I6lzz","projectId":"DQC8ik4pLkhZ4ZDm","project":{"createdAt":"2025-08-19T19:25:16.723Z","updatedAt":"2025-08-19T19:26:16.591Z","id":"DQC8ik4pLkhZ4ZDm","name":"Ben Hex <bhochster@gmail.com>","type":"personal","icon":null,"description":null}}]},{"createdAt":"2025-08-29T13:16:48.136Z","updatedAt":"2025-09-11T23:48:31.000Z","id":"dlMbIUHQiAYGDbKM","name":"My workflow 10","active":false,"isArchived":true,"nodes":[{"parameters":{"rule":{"interval":[{"field":"minutes"}]}},"type":"n8n-nodes-base.scheduleTrigger","typeVersion":1.2,"position":[0,0],"id":"430e95b4-9688-41bc-b7fe-261670c05079","name":"Schedule Trigger"},{"parameters":{"operation":"getAll","returnAll":true,"fields":["*"],"options":{}},"type":"n8n-nodes-base.googleContacts","typeVersion":1,"position":[208,0],"id":"8c852d8b-dea4-46f2-89a8-ed4acf881ed7","name":"Get many contacts","credentials":{"googleContactsOAuth2Api":{"id":"CbUgz1lYbXDmpGRu","name":"Google Contacts account"}}},{"parameters":{"operation":"executeQuery","query":"SELECT EXISTS(\n  SELECT 1\n  FROM synced_contacts\n  WHERE google_id = $1\n) AS exists_flag;","options":{"queryReplacement":"={{$json[\"resourceName\"]}}"}},"type":"n8n-nodes-base.mySql","typeVersion":2.5,"position":[416,0],"id":"1eb01d84-e96f-4ebf-9244-45c1bf69b440","name":"Execute a SQL query","credentials":{"mySql":{"id":"boN9UJNDHnpAKhDe","name":"MySQL account"}}},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"9353d802-7968-4fb7-8179-3c9ae4f1c55f","leftValue":"={{ $json.exists_flag }}","rightValue":0,"operator":{"type":"number","operation":"equals"}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[624,0],"id":"e3cfe4fb-03dc-4308-a750-9ce04f27fcf0","name":"If"},{"parameters":{"operation":"executeQuery","query":"INSERT INTO synced_contacts (google_id)\nVALUES ($1)\nON DUPLICATE KEY UPDATE synced_at = CURRENT_TIMESTAMP;","options":{"queryReplacement":"={{ $('Get many contacts').item.json.resourceName }}"}},"type":"n8n-nodes-base.mySql","typeVersion":2.5,"position":[832,-96],"id":"37c84fb6-7b1e-4400-8529-08ba4fbb7a19","name":"Execute a SQL query1","credentials":{"mySql":{"id":"boN9UJNDHnpAKhDe","name":"MySQL account"}}},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"25ddcbfd-8835-8068-b5a4-ea853e9684e7","mode":"list","cachedResultName":"contacts (1)","cachedResultUrl":"https://www.notion.so/25ddcbfd88358068b5a4ea853e9684e7"},"title":"={{ $('Get many contacts').item.json.names.displayName }}","simple":false,"options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[1040,-96],"id":"afd83a9d-9dc6-405c-a8b2-3396789c8869","name":"Create a database page","credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}}],"connections":{"Schedule Trigger":{"main":[[{"node":"Get many contacts","type":"main","index":0}]]},"Get many contacts":{"main":[[{"node":"Execute a SQL query","type":"main","index":0}]]},"Execute a SQL query":{"main":[[{"node":"If","type":"main","index":0}]]},"If":{"main":[[{"node":"Execute a SQL query1","type":"main","index":0}]]},"Execute a SQL query1":{"main":[[{"node":"Create a database page","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":{"templateCredsSetupCompleted":true},"pinData":{},"versionId":"bd672998-8ab2-4712-ad2d-bd50f74ea943","triggerCount":0,"tags":[],"shared":[{"createdAt":"2025-08-29T13:16:48.142Z","updatedAt":"2025-08-29T13:16:48.142Z","role":"workflow:owner","workflowId":"dlMbIUHQiAYGDbKM","projectId":"DQC8ik4pLkhZ4ZDm","project":{"createdAt":"2025-08-19T19:25:16.723Z","updatedAt":"2025-08-19T19:26:16.591Z","id":"DQC8ik4pLkhZ4ZDm","name":"Ben Hex <bhochster@gmail.com>","type":"personal","icon":null,"description":null}}]},{"createdAt":"2025-09-10T12:02:25.974Z","updatedAt":"2025-09-13T17:24:37.000Z","id":"wspqc3rMbvER3AiV","name":"Transcribe batches","active":false,"isArchived":false,"nodes":[{"parameters":{},"type":"n8n-nodes-base.manualTrigger","typeVersion":1,"position":[-256,0],"id":"da033b1a-69d4-4f09-bcc4-6fbc300aa6c7","name":"When clicking ‘Execute workflow’"},{"parameters":{"fileSelector":"={{$json[\"filePath\"]}}","options":{"dataPropertyName":"data"}},"type":"n8n-nodes-base.readWriteFile","typeVersion":1,"position":[208,0],"id":"4da2eae2-8b9e-47c7-9639-e072773852f4","name":"Read/Write Files from Disk"},{"parameters":{"method":"POST","url":"http://whisper:8000/v1/audio/transcriptions","sendBody":true,"contentType":"multipart-form-data","bodyParameters":{"parameters":[{"parameterType":"formBinaryData","name":"file","inputDataFieldName":"data"},{"name":"response_format","value":"srt"},{"name":"model","value":"ivrit-ai/whisper-large-v3-turbo-ct2"},{"name":"language","value":"he"}]},"options":{"timeout":6000000}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.2,"position":[416,0],"id":"45ff5147-7e89-48cd-a93f-1c6f35e1bdd7","name":"HTTP Request"},{"parameters":{"operation":"toText","sourceProperty":"data","options":{"fileName":"=transcription_of {{ $('Read/Write Files from Disk').item.json.fileName }}.srt"}},"type":"n8n-nodes-base.convertToFile","typeVersion":1.1,"position":[624,0],"id":"2fa0d9f8-529f-45a4-ad74-d96c16a8c46c","name":"Convert to File"},{"parameters":{"driveId":{"__rl":true,"mode":"list","value":"My Drive"},"folderId":{"__rl":true,"value":"1wjnVoDMt2ICKipeSWDozuR2mSj0_kG5m","mode":"list","cachedResultName":"Transcriptions","cachedResultUrl":"https://drive.google.com/drive/folders/1wjnVoDMt2ICKipeSWDozuR2mSj0_kG5m"},"options":{}},"type":"n8n-nodes-base.googleDrive","typeVersion":3,"position":[832,0],"id":"bc2572d2-5264-46c5-ba41-46552674b6f2","name":"Upload file","credentials":{"googleDriveOAuth2Api":{"id":"KUrcceziR6IJKjXk","name":"Google Drive account"}}},{"parameters":{"command":"find /files/call/tst -type f -name \"*.m4a\" -print0\n"},"type":"n8n-nodes-base.executeCommand","typeVersion":1,"position":[-96,-224],"id":"b8584994-9e81-494a-a7f2-24af49372c7e","name":"Execute Command"},{"parameters":{"jsCode":"// Take the raw stdout from Execute Command\nconst raw = items[0].json.stdout;\n\n// Split by nulls, filter empty\nconst files = raw.split('\\u0000').filter(f => f.trim() !== '');\n\n// Return one item per file\nreturn files.map(f => ({\n  json: { filePath: f }\n}));\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[112,-224],"id":"fb781917-00dc-4a0a-95cf-cefc0c47202c","name":"Code"},{"parameters":{"options":{}},"type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[800,-224],"id":"f6c26b0f-a789-439f-be81-5e1d9fcfcb50","name":"Loop Over Items"},{"parameters":{"command":"=mv \"{{ $('Code').item.json.filePath}}\" \"/files/call/processed_calls/\"\n"},"type":"n8n-nodes-base.executeCommand","typeVersion":1,"position":[1040,0],"id":"d0c316b1-5444-40d7-a6ca-66e5056cb01c","name":"Execute Command1"},{"parameters":{"content":"## transcribe batch to srt\n**\n\nlists files in mnt/dat/tmp/tst\ntakes them into a loop one by one.\ncalls whisper to transcribe them as srt using model ivrit.ai.\nsaves the output as srt file in google drive /recordings/transcriptions.\nmoves the file from mnt/data/tmp/tst to mnt mnt/data/tmp/processed_files. \nrepeats loop until dir is empty and all files processed.","height":384,"width":352},"type":"n8n-nodes-base.stickyNote","position":[-416,-464],"typeVersion":1,"id":"5e685a49-a700-4921-bbc0-6c9e7ac4d695","name":"Sticky Note"}],"connections":{"When clicking ‘Execute workflow’":{"main":[[{"node":"Execute Command","type":"main","index":0}]]},"Read/Write Files from Disk":{"main":[[{"node":"HTTP Request","type":"main","index":0}]]},"HTTP Request":{"main":[[{"node":"Convert to File","type":"main","index":0}]]},"Convert to File":{"main":[[{"node":"Upload file","type":"main","index":0}]]},"Execute Command":{"main":[[{"node":"Code","type":"main","index":0}]]},"Code":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Loop Over Items":{"main":[[],[{"node":"Read/Write Files from Disk","type":"main","index":0}]]},"Upload file":{"main":[[{"node":"Execute Command1","type":"main","index":0}]]},"Execute Command1":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]}},"settings":{"executionOrder":"v1","timezone":"Asia/Jerusalem","callerPolicy":"workflowsFromSameOwner","errorWorkflow":"wFI7toXreSsRPAsk","saveExecutionProgress":true},"staticData":null,"meta":{"templateCredsSetupCompleted":true},"pinData":{},"versionId":"14ba0fed-89d1-4a64-b2fa-80398ad83310","triggerCount":0,"tags":[],"shared":[{"createdAt":"2025-09-10T12:02:25.982Z","updatedAt":"2025-09-10T12:02:25.982Z","role":"workflow:owner","workflowId":"wspqc3rMbvER3AiV","projectId":"DQC8ik4pLkhZ4ZDm","project":{"createdAt":"2025-08-19T19:25:16.723Z","updatedAt":"2025-08-19T19:26:16.591Z","id":"DQC8ik4pLkhZ4ZDm","name":"Ben Hex <bhochster@gmail.com>","type":"personal","icon":null,"description":null}}]},{"createdAt":"2025-09-11T15:51:06.274Z","updatedAt":"2025-09-16T00:24:51.000Z","id":"wFI7toXreSsRPAsk","name":"batch transcript error","active":false,"isArchived":false,"nodes":[{"parameters":{},"type":"n8n-nodes-base.errorTrigger","typeVersion":1,"position":[0,0],"id":"b938ea30-be71-48f4-b140-479321d2fa0d","name":"Error Trigger"},{"parameters":{"chatId":"1559527672","text":"=Workflow: batch transcription  Time: {{$now}}","additionalFields":{}},"type":"n8n-nodes-base.telegram","typeVersion":1.2,"position":[208,0],"id":"acc1b7b5-fb6b-432e-ac28-26d5fa56d421","name":"Send a text message","webhookId":"ab494bf7-84ae-47ee-aee5-d654d4bc9cae","credentials":{"telegramApi":{"id":"HbsIszuZLGiRpxz5","name":"Telegram account"}}}],"connections":{"Error Trigger":{"main":[[{"node":"Send a text message","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":{"templateCredsSetupCompleted":true},"pinData":{},"versionId":"7c5070f1-e25f-4759-b702-42be2ecee576","triggerCount":0,"tags":[],"shared":[{"createdAt":"2025-09-11T15:51:06.279Z","updatedAt":"2025-09-11T15:51:06.279Z","role":"workflow:owner","workflowId":"wFI7toXreSsRPAsk","projectId":"DQC8ik4pLkhZ4ZDm","project":{"createdAt":"2025-08-19T19:25:16.723Z","updatedAt":"2025-08-19T19:26:16.591Z","id":"DQC8ik4pLkhZ4ZDm","name":"Ben Hex <bhochster@gmail.com>","type":"personal","icon":null,"description":null}}]},{"createdAt":"2025-09-11T23:55:29.987Z","updatedAt":"2025-09-12T02:57:27.000Z","id":"E1DKQ9yGZunu2n3I","name":"My workflow 11","active":false,"isArchived":false,"nodes":[{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"triggerOn":"specificFolder","folderToWatch":{"__rl":true,"value":"1Rn8GflZsEduQjn44fTWZAyLerEhGti8F","mode":"list","cachedResultName":"samsung_recorder","cachedResultUrl":"https://drive.google.com/drive/folders/1Rn8GflZsEduQjn44fTWZAyLerEhGti8F"},"event":"fileCreated","options":{"fileType":"all"}},"type":"n8n-nodes-base.googleDriveTrigger","typeVersion":1,"position":[0,0],"id":"ac55d9ba-7c38-413d-8cb2-de9238087a0f","name":"Google Drive Trigger","credentials":{"googleDriveOAuth2Api":{"id":"KUrcceziR6IJKjXk","name":"Google Drive account"}}},{"parameters":{"operation":"download","fileId":{"__rl":true,"value":"={{ $json.id }}","mode":"id"},"options":{"binaryPropertyName":"data"}},"type":"n8n-nodes-base.googleDrive","typeVersion":3,"position":[208,0],"id":"9cd007d4-f97e-4153-a34b-89770403cd89","name":"Download file","credentials":{"googleDriveOAuth2Api":{"id":"KUrcceziR6IJKjXk","name":"Google Drive account"}}},{"parameters":{"method":"POST","url":"http://whisper:8000/v1/audio/transcriptions","sendBody":true,"contentType":"multipart-form-data","bodyParameters":{"parameters":[{"parameterType":"formBinaryData","name":"file","inputDataFieldName":"data"},{"name":"response_format","value":"text"},{"name":"model","value":"Systran/faster-distil-whisper-large-v3"}]},"options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.2,"position":[416,0],"id":"85090f92-ab2f-4c47-b4de-cb558fe55e19","name":"HTTP Request"},{"parameters":{"rules":{"values":[{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"leftValue":"={{ $json[\"data\"].toLowerCase().trim() }}","rightValue":"journal entry","operator":{"type":"string","operation":"startsWith"},"id":"59c81b96-fb8f-47a6-b536-5ad0cfe8304a"}],"combinator":"and"}},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"3cafa00d-99b0-492f-a4d3-a5d0bf900e1d","leftValue":"={{ $json[\"data\"].toLowerCase().trim() }}","rightValue":"to do","operator":{"type":"string","operation":"startsWith"}}],"combinator":"and"}},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"6a70091c-f310-4f81-81d9-1d9c04c6accc","leftValue":"={{ $json[\"data\"].toLowerCase().trim() }}","rightValue":"todo","operator":{"type":"string","operation":"startsWith"}}],"combinator":"and"}},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"66ed9dca-160f-44be-965a-4db34c244c1f","leftValue":"={{ $json[\"data\"].toLowerCase().trim() }}","rightValue":"thought","operator":{"type":"string","operation":"startsWith"}}],"combinator":"and"}}]},"options":{}},"type":"n8n-nodes-base.switch","typeVersion":3.2,"position":[624,0],"id":"44989714-4244-4cc1-9bbc-e4e59703e5de","name":"Switch"},{"parameters":{"jsCode":"return {\n  cleanedText: $json[\"data\"]\n    .replace(/^journal entry[\\s\\.,-]*/i, \"\") // remove prefix (case-insensitive, plus punctuation/spaces)\n    .trim()\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[848,-208],"id":"a846fff7-47b5-4ed9-85c0-4306bd23ba8a","name":"Delete journal entry"},{"parameters":{"jsCode":"return {\n  cleanedText: $json[\"data\"]\n    .replace(/^to do[\\s\\.,-]*/i, \"\") // remove prefix (case-insensitive, plus punctuation/spaces)\n    .trim()\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[848,-32],"id":"07930b99-087b-496a-9e56-a88ea8a98e29","name":"Delete to do"},{"parameters":{"jsCode":"return {\n  cleanedText: $json[\"data\"]\n    .replace(/^thought[\\s\\.,-]*/i, \"\") // remove prefix (case-insensitive, plus punctuation/spaces)\n    .trim()\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[848,144],"id":"50a6da9b-62dd-4c38-9efb-afb6006cac35","name":"Delete thought"},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"228dcbfd-8835-80ab-9727-ee036d84f48e","mode":"list","cachedResultName":"Journal Entries","cachedResultUrl":"https://www.notion.so/228dcbfd883580ab9727ee036d84f48e"},"title":"={{ $json.cleanedText }}","options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[1056,-208],"id":"6978d672-12e9-46d9-aef9-b51c8c5a07d8","name":"Create a database page","credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"218dcbfd-8835-8008-a2bd-c164ab084ed3","mode":"list","cachedResultName":"TODO ","cachedResultUrl":"https://www.notion.so/218dcbfd88358008a2bdc164ab084ed3"},"title":"={{ $json.cleanedText }}","options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[1056,-32],"id":"0bc50aed-057e-4298-8d04-6b9a2791131d","name":"Create a database page1","credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"234dcbfd-8835-805f-8ba9-de38ea537985","mode":"list","cachedResultName":"Thoughts","cachedResultUrl":"https://www.notion.so/234dcbfd8835805f8ba9de38ea537985"},"title":"={{ $json.cleanedText }}","options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[1056,144],"id":"818a7914-bfe0-4b02-9b82-70e50bc3d63d","name":"Create a database page2","credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"options":{}},"type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[544,-240],"id":"9db49d36-43c6-42df-bbe1-0882f9298428","name":"Loop Over Items"},{"parameters":{},"type":"n8n-nodes-base.noOp","name":"Replace Me","typeVersion":1,"position":[192,-240],"id":"336f8b56-8a83-46d3-9df3-d1aac4c8d249"}],"connections":{"Google Drive Trigger":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Download file":{"main":[[{"node":"HTTP Request","type":"main","index":0}]]},"HTTP Request":{"main":[[{"node":"Switch","type":"main","index":0}]]},"Switch":{"main":[[{"node":"Delete journal entry","type":"main","index":0}],[{"node":"Delete to do","type":"main","index":0}],[{"node":"Delete to do","type":"main","index":0}],[{"node":"Delete thought","type":"main","index":0}]]},"Delete journal entry":{"main":[[{"node":"Create a database page","type":"main","index":0}]]},"Delete to do":{"main":[[{"node":"Create a database page1","type":"main","index":0}]]},"Delete thought":{"main":[[{"node":"Create a database page2","type":"main","index":0}]]},"Loop Over Items":{"main":[[],[{"node":"Download file","type":"main","index":0}]]},"Replace Me":{"main":[[]]}},"settings":{"executionOrder":"v1","timezone":"Asia/Jerusalem","callerPolicy":"workflowsFromSameOwner","errorWorkflow":"wFI7toXreSsRPAsk","timeSavedPerExecution":1,"saveExecutionProgress":true},"staticData":{"node:Google Drive Trigger":{"lastTimeChecked":"2025-09-12T02:33:00Z"}},"meta":{"templateCredsSetupCompleted":true},"pinData":{},"versionId":"325db019-4bb8-47e3-94e3-699882071606","triggerCount":1,"tags":[],"shared":[{"createdAt":"2025-09-11T23:55:29.992Z","updatedAt":"2025-09-11T23:55:29.992Z","role":"workflow:owner","workflowId":"E1DKQ9yGZunu2n3I","projectId":"DQC8ik4pLkhZ4ZDm","project":{"createdAt":"2025-08-19T19:25:16.723Z","updatedAt":"2025-08-19T19:26:16.591Z","id":"DQC8ik4pLkhZ4ZDm","name":"Ben Hex <bhochster@gmail.com>","type":"personal","icon":null,"description":null}}]},{"createdAt":"2025-09-12T01:41:04.587Z","updatedAt":"2025-09-12T01:44:35.000Z","id":"Zn7eryxAJWEKB3ef","name":"My workflow 11 copy","active":false,"isArchived":true,"nodes":[{"parameters":{"pollTimes":{"item":[{"mode":"everyMinute"}]},"triggerOn":"specificFolder","folderToWatch":{"__rl":true,"value":"1Rn8GflZsEduQjn44fTWZAyLerEhGti8F","mode":"list","cachedResultName":"samsung_recorder","cachedResultUrl":"https://drive.google.com/drive/folders/1Rn8GflZsEduQjn44fTWZAyLerEhGti8F"},"event":"fileCreated","options":{"fileType":"all"}},"type":"n8n-nodes-base.googleDriveTrigger","typeVersion":1,"position":[0,0],"id":"9abb6cd9-542b-4290-a9f9-c1930fd50f2d","name":"Google Drive Trigger","credentials":{"googleDriveOAuth2Api":{"id":"KUrcceziR6IJKjXk","name":"Google Drive account"}}},{"parameters":{"operation":"download","fileId":{"__rl":true,"value":"={{ $json.id }}","mode":"id"},"options":{"binaryPropertyName":"data"}},"type":"n8n-nodes-base.googleDrive","typeVersion":3,"position":[208,0],"id":"a4afe174-634c-47af-8456-42de6dcdb63b","name":"Download file","credentials":{"googleDriveOAuth2Api":{"id":"KUrcceziR6IJKjXk","name":"Google Drive account"}}},{"parameters":{"method":"POST","url":"http://whisper:8000/v1/audio/transcriptions","sendBody":true,"contentType":"multipart-form-data","bodyParameters":{"parameters":[{"parameterType":"formBinaryData","name":"file","inputDataFieldName":"data"},{"name":"response_format","value":"text"},{"name":"model","value":"Systran/faster-distil-whisper-large-v3"}]},"options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.2,"position":[416,0],"id":"683f4eaa-e07c-4665-a9f5-8d3c01f16b22","name":"HTTP Request"},{"parameters":{"rules":{"values":[{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"leftValue":"={{ $json[\"data\"].toLowerCase().trim() }}","rightValue":"journal entry","operator":{"type":"string","operation":"startsWith"},"id":"59c81b96-fb8f-47a6-b536-5ad0cfe8304a"}],"combinator":"and"}},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"3cafa00d-99b0-492f-a4d3-a5d0bf900e1d","leftValue":"={{ $json[\"data\"].toLowerCase().trim() }}","rightValue":"to do","operator":{"type":"string","operation":"startsWith"}}],"combinator":"and"}},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"6a70091c-f310-4f81-81d9-1d9c04c6accc","leftValue":"={{ $json[\"data\"].toLowerCase().trim() }}","rightValue":"todo","operator":{"type":"string","operation":"startsWith"}}],"combinator":"and"}},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"66ed9dca-160f-44be-965a-4db34c244c1f","leftValue":"={{ $json[\"data\"].toLowerCase().trim() }}","rightValue":"thought","operator":{"type":"string","operation":"startsWith"}}],"combinator":"and"}}]},"options":{}},"type":"n8n-nodes-base.switch","typeVersion":3.2,"position":[624,0],"id":"fd4a8c33-fa58-41d5-bbb5-1ce12a7ec836","name":"Switch"},{"parameters":{"jsCode":"return {\n  cleanedText: $json[\"data\"]\n    .replace(/^journal entry[\\s\\.,-]*/i, \"\") // remove prefix (case-insensitive, plus punctuation/spaces)\n    .trim()\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[848,-208],"id":"9922c88a-063c-4336-b648-4514e1859619","name":"Delete journal entry"},{"parameters":{"jsCode":"return {\n  cleanedText: $json[\"data\"]\n    .replace(/^to do[\\s\\.,-]*/i, \"\") // remove prefix (case-insensitive, plus punctuation/spaces)\n    .trim()\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[848,-32],"id":"6beb7157-4d51-43d6-a661-80d54c238c82","name":"Delete to do"},{"parameters":{"jsCode":"return {\n  cleanedText: $json[\"data\"]\n    .replace(/^thought[\\s\\.,-]*/i, \"\") // remove prefix (case-insensitive, plus punctuation/spaces)\n    .trim()\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[848,144],"id":"4f8bd25e-29e3-4db3-9fbc-32a15e6a265a","name":"Delete thought"},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"228dcbfd-8835-80ab-9727-ee036d84f48e","mode":"list","cachedResultName":"Journal Entries","cachedResultUrl":"https://www.notion.so/228dcbfd883580ab9727ee036d84f48e"},"title":"={{ $json.cleanedText }}","options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[1056,-208],"id":"1d3361cf-39e3-4979-98d9-b5b8add92223","name":"Create a database page","credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"218dcbfd-8835-8008-a2bd-c164ab084ed3","mode":"list","cachedResultName":"TODO ","cachedResultUrl":"https://www.notion.so/218dcbfd88358008a2bdc164ab084ed3"},"title":"={{ $json.cleanedText }}","options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[1056,-32],"id":"170fd693-19ae-4a44-a31f-b4c01c27e458","name":"Create a database page1","credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"234dcbfd-8835-805f-8ba9-de38ea537985","mode":"list","cachedResultName":"Thoughts","cachedResultUrl":"https://www.notion.so/234dcbfd8835805f8ba9de38ea537985"},"title":"={{ $json.cleanedText }}","options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[1056,144],"id":"3cb764fd-8436-40ec-9257-3fbb5ba495ba","name":"Create a database page2","credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}}],"connections":{"Google Drive Trigger":{"main":[[{"node":"Download file","type":"main","index":0}]]},"Download file":{"main":[[{"node":"HTTP Request","type":"main","index":0}]]},"HTTP Request":{"main":[[{"node":"Switch","type":"main","index":0}]]},"Switch":{"main":[[{"node":"Delete journal entry","type":"main","index":0}],[{"node":"Delete to do","type":"main","index":0}],[{"node":"Delete to do","type":"main","index":0}],[{"node":"Delete thought","type":"main","index":0}]]},"Delete journal entry":{"main":[[{"node":"Create a database page","type":"main","index":0}]]},"Delete to do":{"main":[[{"node":"Create a database page1","type":"main","index":0}]]},"Delete thought":{"main":[[{"node":"Create a database page2","type":"main","index":0}]]}},"settings":{"executionOrder":"v1","timezone":"Asia/Jerusalem","callerPolicy":"workflowsFromSameOwner","errorWorkflow":"wFI7toXreSsRPAsk"},"staticData":{"node:Google Drive Trigger":{"lastTimeChecked":"2025-09-12T01:33:01Z"}},"meta":{"templateCredsSetupCompleted":true},"pinData":{},"versionId":"d26ed8bd-7b74-43bd-aa97-ba01bfc7476c","triggerCount":1,"tags":[],"shared":[{"createdAt":"2025-09-12T01:41:04.590Z","updatedAt":"2025-09-12T01:41:04.590Z","role":"workflow:owner","workflowId":"Zn7eryxAJWEKB3ef","projectId":"DQC8ik4pLkhZ4ZDm","project":{"createdAt":"2025-08-19T19:25:16.723Z","updatedAt":"2025-08-19T19:26:16.591Z","id":"DQC8ik4pLkhZ4ZDm","name":"Ben Hex <bhochster@gmail.com>","type":"personal","icon":null,"description":null}}]},{"createdAt":"2025-09-12T02:33:07.763Z","updatedAt":"2025-09-16T23:18:11.000Z","id":"m9ePN0F7ghP2wE5V","name":"record to notion","active":false,"isArchived":false,"nodes":[{"parameters":{"operation":"download","fileId":{"__rl":true,"value":"={{ $json.id }}","mode":"id"},"options":{"binaryPropertyName":"data"}},"type":"n8n-nodes-base.googleDrive","typeVersion":3,"position":[208,0],"id":"23b5a1c2-13b6-4a8b-aa0b-20de3230060c","name":"Download file","credentials":{"googleDriveOAuth2Api":{"id":"KUrcceziR6IJKjXk","name":"Google Drive account"}}},{"parameters":{"method":"POST","url":"http://whisper:8000/v1/audio/transcriptions","sendBody":true,"contentType":"multipart-form-data","bodyParameters":{"parameters":[{"parameterType":"formBinaryData","name":"file","inputDataFieldName":"data"},{"name":"response_format","value":"text"},{"name":"model","value":"Systran/faster-whisper-large-v3"},{"name":"temperature","value":"0.0"},{"name":"beam_size","value":"10"},{"name":"patience","value":"1.5"},{"name":"length_penalty","value":"1.15"},{"name":"condition_on_previous_text","value":"false"},{"name":"vad_filter","value":"true"},{"name":"no_speech_threshold","value":"0.45"}]},"options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.2,"position":[352,208],"id":"edc90048-264d-4305-9348-d1148e75e797","name":"HTTP Request"},{"parameters":{"rules":{"values":[{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"leftValue":"={{ $json[\"data\"].toLowerCase().trim() }}","rightValue":"journal entry","operator":{"type":"string","operation":"startsWith"},"id":"59c81b96-fb8f-47a6-b536-5ad0cfe8304a"}],"combinator":"and"}},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"3cafa00d-99b0-492f-a4d3-a5d0bf900e1d","leftValue":"={{ $json[\"data\"].toLowerCase().trim() }}","rightValue":"to do","operator":{"type":"string","operation":"startsWith"}}],"combinator":"and"}},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"6a70091c-f310-4f81-81d9-1d9c04c6accc","leftValue":"={{ $json[\"data\"].toLowerCase().trim() }}","rightValue":"todo","operator":{"type":"string","operation":"startsWith"}}],"combinator":"and"}},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"66ed9dca-160f-44be-965a-4db34c244c1f","leftValue":"={{ $json[\"data\"].toLowerCase().trim() }}","rightValue":"thought","operator":{"type":"string","operation":"startsWith"}}],"combinator":"and"}},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"dbb0f538-2677-467b-81e3-317734614751","leftValue":"={{ $json[\"data\"].toLowerCase().trim() }}","rightValue":"measurements","operator":{"type":"string","operation":"startsWith"}}],"combinator":"and"}}]},"options":{}},"type":"n8n-nodes-base.switch","typeVersion":3.2,"position":[544,64],"id":"13051863-a623-47a2-9a7d-17d355378642","name":"Switch"},{"parameters":{"jsCode":"return {\n  cleanedText: $json[\"data\"]\n    .replace(/^journal entry[\\s\\.,-]*/i, \"\") // remove prefix (case-insensitive, plus punctuation/spaces)\n    .trim()\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[848,-208],"id":"b0092a7d-22a1-4a85-a776-42053b600758","name":"Delete journal entry"},{"parameters":{"jsCode":"return {\n  cleanedText: $json[\"data\"]\n    .replace(/^to do[\\s\\.,-]*/i, \"\") // remove prefix (case-insensitive, plus punctuation/spaces)\n    .trim()\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[848,-32],"id":"3dc64e6a-26ae-41bb-9cd4-c2357a03873b","name":"Delete to do"},{"parameters":{"jsCode":"return {\n  cleanedText: $json[\"data\"]\n    .replace(/^thought[\\s\\.,-]*/i, \"\") // remove prefix (case-insensitive, plus punctuation/spaces)\n    .trim()\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[848,144],"id":"7d3c23ad-a103-4cf8-b1ee-d36368789dd9","name":"Delete thought"},{"parameters":{"options":{}},"type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[608,-480],"id":"09b2824f-023e-46ff-83ca-425cfcc5b666","name":"Loop Over Items"},{"parameters":{"rule":{"interval":[{"field":"minutes"}]}},"type":"n8n-nodes-base.scheduleTrigger","typeVersion":1.2,"position":[-64,-192],"id":"116a8f51-6085-44f8-bb9e-c209b6a9761c","name":"Schedule Trigger"},{"parameters":{"resource":"fileFolder","queryString":"voice","filter":{"folderId":{"__rl":true,"value":"1Rn8GflZsEduQjn44fTWZAyLerEhGti8F","mode":"list","cachedResultName":"samsung_recorder","cachedResultUrl":"https://drive.google.com/drive/folders/1Rn8GflZsEduQjn44fTWZAyLerEhGti8F"}},"options":{}},"type":"n8n-nodes-base.googleDrive","typeVersion":3,"position":[192,-208],"id":"5f421411-d3c9-40a9-ae38-b5d60b530b20","name":"Search files and folders","credentials":{"googleDriveOAuth2Api":{"id":"KUrcceziR6IJKjXk","name":"Google Drive account"}}},{"parameters":{"operation":"deleteFile","fileId":{"__rl":true,"value":"={{ $('Download file').item.json.id }}","mode":"id"},"options":{}},"type":"n8n-nodes-base.googleDrive","typeVersion":3,"position":[1264,-208],"id":"b542d816-a372-411e-948f-128c2355b94a","name":"Delete a file","credentials":{"googleDriveOAuth2Api":{"id":"KUrcceziR6IJKjXk","name":"Google Drive account"}}},{"parameters":{"jsCode":"return {\n  cleanedText: $json[\"data\"]\n    .replace(/^measurements[\\s\\.,-]*/i, \"\") // remove prefix (case-insensitive, plus punctuation/spaces)\n    .trim()\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[848,304],"id":"7150c57d-3276-4228-84d4-713f98e1eca6","name":"Delete measurements"},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"228dcbfd-8835-80ab-9727-ee036d84f48e","mode":"list","cachedResultName":"Journal Entries","cachedResultUrl":"https://www.notion.so/228dcbfd883580ab9727ee036d84f48e"},"title":"={{ $json.cleanedText }}","options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[1120,-320],"id":"c4072aa9-40c7-4951-bd31-dd381d08f2ae","name":"add to journal entries","credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"218dcbfd-8835-8008-a2bd-c164ab084ed3","mode":"list","cachedResultName":"TODO ","cachedResultUrl":"https://www.notion.so/218dcbfd88358008a2bdc164ab084ed3"},"title":"={{ $json.cleanedText }}","options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[1072,-32],"id":"b926bae0-5434-4dd0-a60b-2f4c79eb232c","name":"add to TODO","credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"234dcbfd-8835-805f-8ba9-de38ea537985","mode":"list","cachedResultName":"Thoughts","cachedResultUrl":"https://www.notion.so/234dcbfd8835805f8ba9de38ea537985"},"title":"={{ $json.cleanedText }}","options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[1056,144],"id":"fea50e1d-6eb6-402f-8c69-3d268c9edb63","name":"add to Thoughts","credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"modelId":{"__rl":true,"value":"models/gemini-2.5-pro","mode":"list","cachedResultName":"models/gemini-2.5-pro"},"messages":{"values":[{"content":"=Output  {{ $json.cleanedText }} as CSV with columns: Body weight, blood sugar, ketones"}]},"simplify":false,"options":{}},"type":"@n8n/n8n-nodes-langchain.googleGemini","typeVersion":1,"position":[976,464],"id":"9e3f3ccb-d637-4533-a9f9-0df025db459b","name":"Message a model","credentials":{"googlePalmApi":{"id":"doF6Conz8WNkWBH9","name":"Google Gemini(PaLM) Api account"}}},{"parameters":{"jsCode":"// remove leading/backtick fences if present\nconst raw = $json.candidates[0].content.parts[0].text;\nconst csv = raw\n  .replace(/```[a-z]*\\n?/gi, '')   // opening ``` or ```csv\n  .replace(/```$/,'')              // closing ```\n  .trim();\n\nconst [header, ...rows] = csv.split('\\n');\nconst columns = header.split(',');\n\nreturn rows.map(line => {\n  const values = line.split(',');\n  const obj = {};\n  columns.forEach((col, i) => {\n    let v = values[i]?.trim();\n    // if v looks like a number, convert it\n    obj[col.trim()] = isNaN(v) ? v : Number(v);\n  });\n  return obj;\n});\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[1312,464],"id":"a73210a2-0ed5-4cbc-b78e-02f8960cfe50","name":"Code"},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"26edcbfd-8835-80f3-804a-cf010f2e8796","mode":"list","cachedResultName":"messurements","cachedResultUrl":"https://www.notion.so/26edcbfd883580f3804acf010f2e8796"},"title":"={{ $now.format('M/d HH:mm') }}","simple":false,"propertiesUi":{"propertyValues":[{"key":"Ketones|number","numberValue":"={{ $json.ketones }}"},{"key":"bg|number","numberValue":"={{ $json['blood sugar'] }}"},{"key":"Weight|number","numberValue":"={{ $json['Body weight'] }}"},{"key":"Date|date","includeTime":false,"date":"={{ $now.format('M/d/y HH:mm ') }}","timezone":"Asia/Jerusalem"},{"key":"Time|rich_text","textContent":"={{ $now.format('HH:mm') }}"}]},"options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[1568,224],"id":"b8813d05-44a0-47e6-a317-3d70828e488d","name":"Create a database page","credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"jsCode":"// Pull the tex\nconst input = $json.cleanedText || \"\";\n\n// Split at any of the marker phrases (case-insensitive)\nconst parts = input\n  .split(/description|start time|end time|start date|end date/i)\n  .map(s => s.trim().replace(/^[\\s\\p{P}]+|[\\s\\p{P}]+$/gu, ''));\n\n// Ensure we always return five keys, even if some markers are missing\nreturn {\n  part1: parts[0] || \"\",\n  part2: parts[1] || \"\",\n  part3: parts[2] || \"\",\n  part4: parts[3] || \"\",\n  part5: parts[4] || \"\",\n  part6: parts[5] || \"\",\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[1040,-576],"id":"1c92e1a1-a7d3-4b81-aeb2-7a4ac248c277","name":"split title/description/start/end"},{"parameters":{"jsCode":"const item = items[0];\n\nfunction formatPair(str, separator, type) {\n  if (!str || str.trim() === '') return '';\n\n  const digits = str.match(/\\d+/g);\n  // must have exactly two number groups\n  if (!digits || digits.length !== 2) return '';\n\n  const [aRaw, bRaw] = digits;\n  // total digits must be between 2 and 4\n  const totalDigits = aRaw.length + bRaw.length;\n  if (totalDigits < 2 || totalDigits > 4) return '';\n\n  const a = aRaw.padStart(2, '0');\n  const b = bRaw.padStart(2, '0');\n\n  // extra checks depending on type\n  if (type === 'time') {\n    if (parseInt(a, 10) > 23 || parseInt(b, 10) > 59) return '';\n  }\n  if (type === 'date') {\n    if (parseInt(a, 10) > 31 || parseInt(b, 10) > 12) return '';\n  }\n\n  return `${a}${separator}${b}`;\n}\n\nreturn [{\n  json: {\n    part3new: formatPair(item.json.part3, ':', 'time'),\n    part4new: formatPair(item.json.part4, ':', 'time'),\n    part5new: formatPair(item.json.part5, '/', 'date'),\n    part6new: formatPair(item.json.part6, '/', 'date')\n  }\n}];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[1248,-576],"id":"0f76bce4-0c61-4e05-8ac4-6f8f98ce9178","name":"format timedate"},{"parameters":{"jsCode":"// n8n Code node\nconst item = items[0].json;\n\n// ---------- CONFIG ----------\nconst YEAR = 2025;                   // fixed year\nconst TZ   = 'Asia/Jerusalem';       // IANA zone\n\n// ---------- HELPERS ----------\nconst pad = n => n.toString().padStart(2,'0');\n\nfunction isTime(s){\n  const m = /^(\\d{1,2}):(\\d{1,2})$/.exec((s||'').trim());\n  if(!m) return false;\n  const h = +m[1], mi = +m[2];\n  return h>=0 && h<=23 && mi>=0 && mi<=59;\n}\n\nfunction isDateDM(s){\n  const m = /^(\\d{1,2})\\/(\\d{1,2})$/.exec((s||'').trim());\n  if(!m) return false;\n  const d = +m[1], mo = +m[2];\n  return d>=1 && d<=31 && mo>=1 && mo<=12;\n}\n\nfunction parseDM(s){\n  const [d,m] = s.trim().split('/').map(Number);\n  return {d,m};\n}\n\nfunction parseHM(s){\n  const [h,m] = s.trim().split(':').map(Number);\n  return {h,m};\n}\n\nfunction localIso(y,m,d,h,mi){\n  return `${y}-${pad(m)}-${pad(d)}T${pad(h)}:${pad(mi)}:00`;\n}\n\n// ---------- STEP 1 ----------\nconst now = new Date();\nconst il = new Intl.DateTimeFormat('en-CA',{\n  timeZone: TZ,year:'numeric',month:'2-digit',day:'2-digit',\n  hour:'2-digit',minute:'2-digit',hour12:false\n}).formatToParts(now)\n  .reduce((a,p)=>{if(p.type!=='literal')a[p.type]=+p.value;return a;},{});\n\nlet st = {h:il.hour-1, m:il.minute};\nlet et = {h:il.hour,   m:il.minute};\nlet sd = {d:il.day,    m:il.month};\nlet ed = {d:il.day,    m:il.month};\n\n// if st hour <0 then go to previous day\nif (st.h<0){st.h+=24; const prev=new Date(now); prev.setHours(0,0,0,0); prev.setDate(prev.getDate()-1);\n  const p = new Intl.DateTimeFormat('en-CA',{timeZone:TZ,year:'numeric',month:'2-digit',day:'2-digit'}).formatToParts(prev)\n     .reduce((a,p)=>{if(p.type!=='literal')a[p.type]=+p.value;return a;},{});\n  sd = {d:p.day,m:p.month};\n}\n\n// ---------- STEPS 2–5 (end date/time) ----------\nif (isTime(item.part4new)) {\n  if (isDateDM(item.part6new)) {\n    const {d,m} = parseDM(item.part6new);\n    // if given end date is earlier than today\n    if (new Date(YEAR,m-1,d) < new Date(YEAR,ed.m-1,ed.d)) ed = {d,m};\n  }\n  const {h,m} = parseHM(item.part4new);\n  const today = new Date(YEAR,ed.m-1,ed.d);\n  const etCandidate = {h,m};\n  // if candidate < current time AND ed is today or earlier\n  if (new Date(YEAR,ed.m-1,ed.d,h,m) < now && today <= new Date()) {\n    et = etCandidate;\n  }\n}\n\n// ---------- STEPS 6–9 (start date/time) ----------\nif (isTime(item.part3new)) {\n  if (isDateDM(item.part5new)) {\n    const {d,m} = parseDM(item.part5new);\n    if (new Date(YEAR,m-1,d) <= new Date(YEAR,ed.m-1,ed.d)) sd = {d,m};\n  }\n  const {h,m} = parseHM(item.part3new);\n  const startCandidate = new Date(YEAR,sd.m-1,sd.d,h,m);\n  const endCandidate   = new Date(YEAR,ed.m-1,ed.d,et.h,et.m);\n  if (startCandidate < endCandidate) {\n    st = {h,m};\n  } else {\n    // fallback: 1 hour before end\n    const back = new Date(endCandidate.getTime()-3600000);\n    const p = new Intl.DateTimeFormat('en-CA',{timeZone:TZ,year:'numeric',month:'2-digit',day:'2-digit',\n             hour:'2-digit',minute:'2-digit',hour12:false}).formatToParts(back)\n             .reduce((a,p)=>{if(p.type!=='literal')a[p.type]=+p.value;return a;},{});\n    st = {h:p.hour,m:p.minute};\n    sd = {d:p.day,m:p.month};\n  }\n}\n\n// ---------- STEPS 10–13 ----------\nlet start_time = localIso(YEAR,sd.m,sd.d,st.h,st.m);\nlet end_time   = localIso(YEAR,ed.m,ed.d,et.h,et.m);\n\n// ensure end > start, shift start back by 1 day until ok\nwhile (new Date(end_time) <= new Date(start_time)){\n  const sdate = new Date(start_time);\n  sdate.setDate(sdate.getDate()-1);\n  start_time = localIso(YEAR,sdate.getMonth()+1,sdate.getDate(),st.h,st.m);\n}\n\nreturn [{json:{start_time,end_time}}];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[1456,-576],"id":"1c752b2f-9c05-4efd-8359-34fdf5bb321f","name":"produce actual time dates"},{"parameters":{"url":"https://www.googleapis.com/drive/v3/files","authentication":"predefinedCredentialType","nodeCredentialType":"googleDriveOAuth2Api","sendQuery":true,"specifyQuery":"json","jsonQuery":"={\n  \"q\": \"'1tOOiWR1_m0AVN_8ggtBMjU6IRTtMS39v' in parents and modifiedTime >= '{{ $json.start_time_utc }}' and modifiedTime <= '{{ $json.end_time_utc }}'\",\n  \"fields\": \"files(id,name,mimeType,modifiedTime,thumbnailLink)\",\n  \"pageSize\": \"100\"\n}\n\n","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.2,"position":[1888,-576],"id":"072b342e-1550-4e0f-acb1-b5563f4f5974","name":"HTTP Request1","credentials":{"googleDriveOAuth2Api":{"id":"KUrcceziR6IJKjXk","name":"Google Drive account"}}},{"parameters":{"jsCode":"const TZ = 'Asia/Jerusalem';\n\nfunction tzParts(d) {\n  const fmt = new Intl.DateTimeFormat('en-CA', {\n    timeZone: TZ, year:'numeric', month:'2-digit', day:'2-digit',\n    hour:'2-digit', minute:'2-digit', second:'2-digit', hour12:false\n  });\n  const parts = fmt.formatToParts(d).reduce((a,p) => {\n    if (p.type !== 'literal') a[p.type] = parseInt(p.value, 10);\n    return a;\n  }, {});\n  return parts;\n}\n\nfunction zonedTimeToUtc({year, month, day, hour=0, minute=0, second=0}) {\n  const guess = new Date(Date.UTC(year, month - 1, day, hour, minute, second, 0));\n  const guessTZ = tzParts(guess);\n  const desiredTs = Date.UTC(year, month - 1, day, hour, minute, second, 0);\n  const actualTs  = Date.UTC(guessTZ.year, guessTZ.month - 1, guessTZ.day, guessTZ.hour, guessTZ.minute, guessTZ.second);\n  const diff = actualTs - desiredTs;\n  return new Date(guess.getTime() - diff);\n}\n\nfunction parseLocalIsoLike(s) {\n  // expects 'YYYY-MM-DDTHH:mm:ss'\n  const [d, t] = s.split('T');\n  const [Y, M, D] = d.split('-').map(n => parseInt(n, 10));\n  const [h, m, sec] = t.split(':').map(n => parseInt(n, 10));\n  return { year: Y, month: M, day: D, hour: h, minute: m, second: sec || 0 };\n}\n\nconst out = [];\n\nfor (const i of items) {\n  const st = i.json.start_time; // IL local string from previous node\n  const et = i.json.end_time;\n\n  const sParts = parseLocalIsoLike(st);\n  const eParts = parseLocalIsoLike(et);\n\n  const sUTC = zonedTimeToUtc(sParts);\n  const eUTC = zonedTimeToUtc(eParts);\n\n  out.push({\n    json: {\n      ...i.json,\n      start_time_utc: sUTC.toISOString(),\n      end_time_utc:   eUTC.toISOString(),\n          // 👉 Local IL time for CLI (find) — keep local time!\n      start_time_cli: st.replace('T',' '),\n      end_time_cli:   et.replace('T',' ')\n    }\n  });\n}\n\nreturn out;"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[1664,-576],"id":"92a941d4-8215-4c22-96a1-e9342257dfc9","name":"Code1"},{"parameters":{"command":"=find /mnt/data/nextcloud-data/bhochster/files/InstantUpload/Camera /mnt/data/nextcloud-data/bhochster/files/InstantUpload/Screenshots /mnt/data/nextcloud-data/bhochster/files/InstantUpload/WhatsApp\\ Images -type f -newermt \"{{ $('Code1').item.json.start_time_cli }}\" ! -newermt \"{{ $('Code1').item.json.end_time_cli }}\" -printf \"%TY-%Tm-%Td %TH:%TM:%TS %p\\n\"\n"},"type":"n8n-nodes-base.ssh","typeVersion":1,"position":[2096,-576],"id":"ef6ef24d-5f45-4126-ada1-8ab1146efe6d","name":"Execute a command","credentials":{"sshPassword":{"id":"aPk0SYOJJGJBCluE","name":"SSH Password account"}}}],"connections":{"Download file":{"main":[[{"node":"HTTP Request","type":"main","index":0}]]},"HTTP Request":{"main":[[{"node":"Switch","type":"main","index":0}]]},"Switch":{"main":[[{"node":"Delete journal entry","type":"main","index":0}],[{"node":"Delete to do","type":"main","index":0}],[{"node":"Delete to do","type":"main","index":0}],[{"node":"Delete thought","type":"main","index":0}],[{"node":"Delete measurements","type":"main","index":0}]]},"Delete journal entry":{"main":[[{"node":"split title/description/start/end","type":"main","index":0}]]},"Delete to do":{"main":[[{"node":"add to TODO","type":"main","index":0}]]},"Delete thought":{"main":[[{"node":"add to Thoughts","type":"main","index":0}]]},"Loop Over Items":{"main":[[],[{"node":"Download file","type":"main","index":0}]]},"Schedule Trigger":{"main":[[{"node":"Search files and folders","type":"main","index":0}]]},"Search files and folders":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Delete a file":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"add to journal entries":{"main":[[{"node":"Delete a file","type":"main","index":0}]]},"add to TODO":{"main":[[{"node":"Delete a file","type":"main","index":0}]]},"add to Thoughts":{"main":[[{"node":"Delete a file","type":"main","index":0}]]},"Delete measurements":{"main":[[{"node":"Message a model","type":"main","index":0}]]},"Message a model":{"main":[[{"node":"Code","type":"main","index":0}]]},"Code":{"main":[[{"node":"Create a database page","type":"main","index":0}]]},"Create a database page":{"main":[[{"node":"Delete a file","type":"main","index":0}]]},"split title/description/start/end":{"main":[[{"node":"format timedate","type":"main","index":0}]]},"format timedate":{"main":[[{"node":"produce actual time dates","type":"main","index":0}]]},"produce actual time dates":{"main":[[{"node":"Code1","type":"main","index":0}]]},"HTTP Request1":{"main":[[{"node":"Execute a command","type":"main","index":0}]]},"Code1":{"main":[[{"node":"HTTP Request1","type":"main","index":0}]]}},"settings":{"executionOrder":"v1","callerPolicy":"workflowsFromSameOwner","errorWorkflow":"eT5fOtELZiLLcpbS","timeSavedPerExecution":1,"saveExecutionProgress":true,"timezone":"Asia/Jerusalem"},"staticData":{"node:Google Drive Trigger":{"lastTimeChecked":"2025-09-12T02:33:00Z"},"node:Schedule Trigger":{"recurrenceRules":[]}},"meta":{"templateCredsSetupCompleted":true},"pinData":{},"versionId":"f2c84932-ba46-4e0a-9ffd-dd8689387e0e","triggerCount":1,"tags":[],"shared":[{"createdAt":"2025-09-12T02:33:07.766Z","updatedAt":"2025-09-12T02:33:07.766Z","role":"workflow:owner","workflowId":"m9ePN0F7ghP2wE5V","projectId":"DQC8ik4pLkhZ4ZDm","project":{"createdAt":"2025-08-19T19:25:16.723Z","updatedAt":"2025-08-19T19:26:16.591Z","id":"DQC8ik4pLkhZ4ZDm","name":"Ben Hex <bhochster@gmail.com>","type":"personal","icon":null,"description":null}}]},{"createdAt":"2025-09-14T01:16:14.357Z","updatedAt":"2025-09-14T01:17:04.000Z","id":"LNO2LDUEw99VQQsd","name":"My workflow 12","active":false,"isArchived":true,"nodes":[{"parameters":{},"type":"n8n-nodes-base.manualTrigger","typeVersion":1,"position":[0,0],"id":"0d1fee3a-eb8d-4dba-8daa-8715aef5f137","name":"When clicking ‘Execute workflow’"},{"parameters":{"dataToSave":{"values":[{"key":"mykey","value":"1"}]}},"type":"n8n-nodes-base.executionData","typeVersion":1.1,"position":[208,0],"id":"57275ab3-24e9-42b6-b659-2ad7530d3120","name":"Execution Data"}],"connections":{"When clicking ‘Execute workflow’":{"main":[[{"node":"Execution Data","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":null,"pinData":{"Execution Data":[{"json":{"name":"First item","code":1}},{"json":{"name":"Second item","code":2}}]},"versionId":"69b18fcf-0909-4552-92e5-ba24d587643a","triggerCount":0,"tags":[],"shared":[{"createdAt":"2025-09-14T01:16:14.366Z","updatedAt":"2025-09-14T01:16:14.366Z","role":"workflow:owner","workflowId":"LNO2LDUEw99VQQsd","projectId":"DQC8ik4pLkhZ4ZDm","project":{"createdAt":"2025-08-19T19:25:16.723Z","updatedAt":"2025-08-19T19:26:16.591Z","id":"DQC8ik4pLkhZ4ZDm","name":"Ben Hex <bhochster@gmail.com>","type":"personal","icon":null,"description":null}}]},{"createdAt":"2025-09-14T01:19:16.907Z","updatedAt":"2025-09-14T01:29:26.000Z","id":"TibJv8Xu1emx1zu4","name":"My workflow 13","active":false,"isArchived":true,"nodes":[{"parameters":{},"type":"n8n-nodes-base.manualTrigger","typeVersion":1,"position":[0,0],"id":"200f438a-957a-49f1-af06-4bfdb55e7b74","name":"When clicking ‘Execute workflow’"},{"parameters":{"resource":"audio","operation":"transcribe","options":{}},"type":"@n8n/n8n-nodes-langchain.openAi","typeVersion":1.8,"position":[544,16],"id":"e662b11c-aee3-48e7-ae38-0be47b887e39","name":"Transcribe a recording","credentials":{"openAiApi":{"id":"gAwL4mjSgmlpPtnq","name":"OpenAi account"}}},{"parameters":{"options":{}},"type":"n8n-nodes-base.readWriteFile","typeVersion":1,"position":[208,0],"id":"473eb41a-7c4b-4ad6-8b99-6735d6174002","name":"Read/Write Files from Disk"}],"connections":{"When clicking ‘Execute workflow’":{"main":[[{"node":"Read/Write Files from Disk","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":{"templateCredsSetupCompleted":true},"pinData":{},"versionId":"fa4d86fb-3814-40a4-8fa3-3d0027efdc7f","triggerCount":0,"tags":[],"shared":[{"createdAt":"2025-09-14T01:19:16.913Z","updatedAt":"2025-09-14T01:19:16.913Z","role":"workflow:owner","workflowId":"TibJv8Xu1emx1zu4","projectId":"DQC8ik4pLkhZ4ZDm","project":{"createdAt":"2025-08-19T19:25:16.723Z","updatedAt":"2025-08-19T19:26:16.591Z","id":"DQC8ik4pLkhZ4ZDm","name":"Ben Hex <bhochster@gmail.com>","type":"personal","icon":null,"description":null}}]},{"createdAt":"2025-09-14T01:29:53.240Z","updatedAt":"2025-09-14T02:22:50.000Z","id":"inNzEv6NkKN64ZaC","name":"My workflow 14","active":false,"isArchived":true,"nodes":[{"parameters":{},"type":"n8n-nodes-base.manualTrigger","typeVersion":1,"position":[0,0],"id":"6c41f05d-e75f-4331-b96f-7723c2d254d9","name":"When clicking ‘Execute workflow’"},{"parameters":{"operation":"download","fileId":{"__rl":true,"value":"1F9AgQ4y7xbp0stDV-89vuYOFtyaWPvpd","mode":"list","cachedResultName":"Call recording 053_200616_153453.m4a","cachedResultUrl":"https://drive.google.com/file/d/1F9AgQ4y7xbp0stDV-89vuYOFtyaWPvpd/view?usp=drivesdk"},"options":{}},"type":"n8n-nodes-base.googleDrive","typeVersion":3,"position":[208,0],"id":"f4953a95-1f4f-471f-b27c-b232f5685571","name":"Download file","credentials":{"googleDriveOAuth2Api":{"id":"KUrcceziR6IJKjXk","name":"Google Drive account"}}},{"parameters":{"resource":"audio","modelId":{"__rl":true,"value":"models/gemini-2.0-flash-live-001","mode":"list","cachedResultName":"models/gemini-2.0-flash-live-001"},"audioUrls":"=","options":{}},"type":"@n8n/n8n-nodes-langchain.googleGemini","typeVersion":1,"position":[416,0],"id":"3e3ffa06-8069-42a6-a3e5-452256aa5832","name":"Transcribe a recording","credentials":{"googlePalmApi":{"id":"doF6Conz8WNkWBH9","name":"Google Gemini(PaLM) Api account"}}}],"connections":{"When clicking ‘Execute workflow’":{"main":[[{"node":"Download file","type":"main","index":0}]]},"Download file":{"main":[[{"node":"Transcribe a recording","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":{"templateCredsSetupCompleted":true},"pinData":{},"versionId":"59a18a88-6796-42b1-91a3-0f1d5f9dc8dc","triggerCount":0,"tags":[],"shared":[{"createdAt":"2025-09-14T01:29:53.244Z","updatedAt":"2025-09-14T01:29:53.244Z","role":"workflow:owner","workflowId":"inNzEv6NkKN64ZaC","projectId":"DQC8ik4pLkhZ4ZDm","project":{"createdAt":"2025-08-19T19:25:16.723Z","updatedAt":"2025-08-19T19:26:16.591Z","id":"DQC8ik4pLkhZ4ZDm","name":"Ben Hex <bhochster@gmail.com>","type":"personal","icon":null,"description":null}}]},{"createdAt":"2025-09-14T11:24:06.455Z","updatedAt":"2025-09-14T12:41:05.000Z","id":"86vsJaO2qXMk5vn4","name":"My workflow 15","active":false,"isArchived":true,"nodes":[{"parameters":{},"type":"n8n-nodes-base.manualTrigger","typeVersion":1,"position":[0,0],"id":"6d582171-b3c3-474f-8f10-a56f884f5252","name":"When clicking ‘Execute workflow’"},{"parameters":{"modelId":{"__rl":true,"value":"gpt-4o-mini","mode":"list","cachedResultName":"GPT-4O-MINI"},"messages":{"values":[{},{"content":"hi how are u"}]},"simplify":false,"options":{}},"type":"@n8n/n8n-nodes-langchain.openAi","typeVersion":1.8,"position":[160,16],"id":"be12ca8f-79f6-4204-9e78-b4ff2409e1f9","name":"Message a model","credentials":{"openAiApi":{"id":"gAwL4mjSgmlpPtnq","name":"OpenAi account"}}}],"connections":{"When clicking ‘Execute workflow’":{"main":[[{"node":"Message a model","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":{"templateCredsSetupCompleted":true},"pinData":{},"versionId":"dd238a28-df3a-44c2-8659-fd941cac2a9c","triggerCount":0,"tags":[],"shared":[{"createdAt":"2025-09-14T11:24:06.460Z","updatedAt":"2025-09-14T11:24:06.460Z","role":"workflow:owner","workflowId":"86vsJaO2qXMk5vn4","projectId":"DQC8ik4pLkhZ4ZDm","project":{"createdAt":"2025-08-19T19:25:16.723Z","updatedAt":"2025-08-19T19:26:16.591Z","id":"DQC8ik4pLkhZ4ZDm","name":"Ben Hex <bhochster@gmail.com>","type":"personal","icon":null,"description":null}}]},{"createdAt":"2025-09-16T00:26:53.235Z","updatedAt":"2025-09-21T17:02:45.000Z","id":"eT5fOtELZiLLcpbS","name":"ERROR to telegram","active":true,"isArchived":false,"nodes":[{"parameters":{},"type":"n8n-nodes-base.errorTrigger","typeVersion":1,"position":[0,0],"id":"bb210f83-b304-45fe-aecc-2f6222163f4f","name":"Error Trigger"},{"parameters":{"chatId":"1559527672","text":"=Error. \nWorkflow:  {{ $json.workflow.name }} \nNode:{{ $json.execution.error.node.name }}\nMessage: {{ $json.execution.error.message }}\n","additionalFields":{}},"type":"n8n-nodes-base.telegram","typeVersion":1.2,"position":[208,0],"id":"85209f24-cbe7-417a-94cd-7cdc7169e41e","name":"Send a text message","webhookId":"47543a7c-fa80-4ff4-82a6-566d6a06335d","credentials":{"telegramApi":{"id":"HbsIszuZLGiRpxz5","name":"Telegram account"}}}],"connections":{"Error Trigger":{"main":[[{"node":"Send a text message","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":{"templateCredsSetupCompleted":true},"pinData":{"Error Trigger":[{"json":{"execution":{"id":"2422","url":"https://n8.velvetcld.kozow.com/workflow/m9ePN0F7ghP2wE5V/executions/2422","error":{"level":"warning","tags":{},"timestamp":1758034226517,"context":{"itemIndex":0,"request":{"headers":{"accept":"application/json,text/html,application/xhtml+xml,application/xml,text/*;q=0.9, image/*;q=0.8, */*;q=0.7","content-type":"multipart/form-data; boundary=--------------------------1373d19e9982768ab79ba369"},"method":"POST","uri":"http://whisper:8000/v1/audio/transcriptions","gzip":true,"rejectUnauthorized":true,"followRedirect":true,"resolveWithFullResponse":true,"followAllRedirects":true,"timeout":300000,"formData":{"_overheadLength":1173,"_valueLength":5802662,"_valuesToMeasure":[],"writable":false,"readable":true,"dataSize":0,"maxDataSize":2097152,"pauseStreams":true,"_released":true,"_streams":[],"_currentStream":null,"_insideLoop":false,"_pendingNext":false,"_boundary":"--------------------------1373d19e9982768ab79ba369","_events":{},"_eventsCount":3},"encoding":null,"json":false,"useStream":true}},"functionality":"regular","name":"NodeApiError","node":{"parameters":{"preBuiltAgentsCalloutHttpRequest":"","curlImport":"","method":"POST","url":"http://whisper:8000/v1/audio/transcriptions","authentication":"none","provideSslCertificates":false,"sendQuery":false,"sendHeaders":false,"sendBody":true,"contentType":"multipart-form-data","bodyParameters":{"parameters":[{"parameterType":"formBinaryData","name":"file","inputDataFieldName":"data"},{"parameterType":"formData","name":"response_format","value":"text"},{"parameterType":"formData","name":"model","value":"Systran/faster-whisper-large-v3"},{"parameterType":"formData","name":"temperature","value":"0.0"},{"parameterType":"formData","name":"beam_size","value":"10"},{"parameterType":"formData","name":"patience","value":"1.5"},{"parameterType":"formData","name":"length_penalty","value":"1.15"},{"parameterType":"formData","name":"condition_on_previous_text","value":"false"},{"parameterType":"formData","name":"vad_filter","value":"true"},{"parameterType":"formData","name":"no_speech_threshold","value":"0.45"}]},"options":{},"infoMessage":""},"type":"n8n-nodes-base.httpRequest","typeVersion":4.2,"position":[416,0],"id":"edc90048-264d-4305-9348-d1148e75e797","name":"HTTP Request"},"messages":["timeout of 300000ms exceeded","timeout of 300000ms exceeded"],"httpCode":"ECONNABORTED","message":"The connection was aborted, perhaps the server is offline","stack":"NodeApiError: The connection was aborted, perhaps the server is offline\n    at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@aws-sdk+credential-providers@3.808.0_asn1.js@5_1af219c3f47f2a1223ec4ccec249a974/node_modules/n8n-nodes-base/nodes/HttpRequest/V3/HttpRequestV3.node.ts:780:15)\n    at WorkflowExecute.runNode (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry+api@1.9.0_@opentelemetry+sdk-trace-base@1.30_0c275070fd0434c00ffd62213b2bcae4/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1212:9)\n    at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry+api@1.9.0_@opentelemetry+sdk-trace-base@1.30_0c275070fd0434c00ffd62213b2bcae4/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1582:27\n    at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@opentelemetry+api@1.9.0_@opentelemetry+sdk-trace-base@1.30_0c275070fd0434c00ffd62213b2bcae4/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:2158:11"},"lastNodeExecuted":"HTTP Request","mode":"trigger"},"workflow":{"id":"m9ePN0F7ghP2wE5V","name":"record to notion"}}}]},"versionId":"ba432e0c-e4bc-4f9f-a133-8747ed54c2b9","triggerCount":0,"tags":[],"shared":[{"createdAt":"2025-09-16T00:26:53.248Z","updatedAt":"2025-09-16T00:26:53.248Z","role":"workflow:owner","workflowId":"eT5fOtELZiLLcpbS","projectId":"DQC8ik4pLkhZ4ZDm","project":{"createdAt":"2025-08-19T19:25:16.723Z","updatedAt":"2025-08-19T19:26:16.591Z","id":"DQC8ik4pLkhZ4ZDm","name":"Ben Hex <bhochster@gmail.com>","type":"personal","icon":null,"description":null}}]},{"createdAt":"2025-09-16T23:18:25.406Z","updatedAt":"2025-09-22T08:50:22.000Z","id":"lWlc0brkK1MAkuph","name":"record to notion copy","active":false,"isArchived":false,"nodes":[{"parameters":{"operation":"download","fileId":{"__rl":true,"value":"={{ $json.id }}","mode":"id"},"options":{"binaryPropertyName":"data"}},"type":"n8n-nodes-base.googleDrive","typeVersion":3,"position":[208,0],"id":"9648a45e-61dd-486f-ac2d-b59a30fb6919","name":"Download file","credentials":{"googleDriveOAuth2Api":{"id":"KUrcceziR6IJKjXk","name":"Google Drive account"}}},{"parameters":{"method":"POST","url":"http://whisper:8000/v1/audio/transcriptions","sendBody":true,"contentType":"multipart-form-data","bodyParameters":{"parameters":[{"parameterType":"formBinaryData","name":"file","inputDataFieldName":"data"},{"name":"response_format","value":"text"},{"name":"model","value":"Systran/faster-whisper-large-v3"},{"name":"temperature","value":"0.0"},{"name":"beam_size","value":"10"},{"name":"patience","value":"1.5"},{"name":"length_penalty","value":"1.15"},{"name":"condition_on_previous_text","value":"false"},{"name":"vad_filter","value":"true"},{"name":"no_speech_threshold","value":"0.45"}]},"options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.2,"position":[352,208],"id":"0cbc8700-28c8-4d60-a297-c64bcfce86e4","name":"HTTP Request"},{"parameters":{"rules":{"values":[{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"leftValue":"={{ $json[\"data\"].toLowerCase().trim() }}","rightValue":"journal entry","operator":{"type":"string","operation":"startsWith"},"id":"59c81b96-fb8f-47a6-b536-5ad0cfe8304a"}],"combinator":"and"}},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"9adfef7a-692f-4523-9d7a-588e2f763c16","leftValue":"={{ $json[\"data\"].toLowerCase().trim() }}","rightValue":"journal item","operator":{"type":"string","operation":"startsWith"}}],"combinator":"and"}},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"3cafa00d-99b0-492f-a4d3-a5d0bf900e1d","leftValue":"={{ $json[\"data\"].toLowerCase().trim() }}","rightValue":"to do","operator":{"type":"string","operation":"startsWith"}}],"combinator":"and"}},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"6a70091c-f310-4f81-81d9-1d9c04c6accc","leftValue":"={{ $json[\"data\"].toLowerCase().trim() }}","rightValue":"todo","operator":{"type":"string","operation":"startsWith"}}],"combinator":"and"}},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"66ed9dca-160f-44be-965a-4db34c244c1f","leftValue":"={{ $json[\"data\"].toLowerCase().trim() }}","rightValue":"thought","operator":{"type":"string","operation":"startsWith"}}],"combinator":"and"}},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"dbb0f538-2677-467b-81e3-317734614751","leftValue":"={{ $json[\"data\"].toLowerCase().trim() }}","rightValue":"measurements","operator":{"type":"string","operation":"startsWith"}}],"combinator":"and"}}]},"options":{}},"type":"n8n-nodes-base.switch","typeVersion":3.2,"position":[544,64],"id":"72bf25f8-6853-4d96-95dc-6ad420bcccd0","name":"Switch"},{"parameters":{"jsCode":"return {\n  cleanedText: $json[\"data\"]\n    .replace(/^journal entry[\\s\\.,-]*/i, \"\") // remove prefix (case-insensitive, plus punctuation/spaces)\n    .trim()\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[848,-208],"id":"0d8945fa-d58d-4cfd-a5ac-45919b7cd4be","name":"Delete journal entry"},{"parameters":{"jsCode":"return {\n  cleanedText: $json[\"data\"]\n    .replace(/^to do[\\s\\.,-]*/i, \"\") // remove prefix (case-insensitive, plus punctuation/spaces)\n    .trim()\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[848,-32],"id":"5843d1ea-bfd4-4915-b52d-d8d2c4154ff6","name":"Delete to do"},{"parameters":{"jsCode":"return {\n  cleanedText: $json[\"data\"]\n    .replace(/^thought[\\s\\.,-]*/i, \"\") // remove prefix (case-insensitive, plus punctuation/spaces)\n    .trim()\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[848,144],"id":"fbdffeae-538b-4815-b3b4-3d03187392c3","name":"Delete thought"},{"parameters":{"options":{}},"type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[608,-480],"id":"0cd62b68-036e-410a-b988-dcbdb468b986","name":"Loop Over Items"},{"parameters":{"rule":{"interval":[{"field":"minutes","minutesInterval":3}]}},"type":"n8n-nodes-base.scheduleTrigger","typeVersion":1.2,"position":[-64,-192],"id":"0174abed-e2bb-435f-bbf4-73f0b9ed88bc","name":"Schedule Trigger"},{"parameters":{"resource":"fileFolder","queryString":"voice","filter":{"folderId":{"__rl":true,"value":"1Rn8GflZsEduQjn44fTWZAyLerEhGti8F","mode":"list","cachedResultName":"samsung_recorder","cachedResultUrl":"https://drive.google.com/drive/folders/1Rn8GflZsEduQjn44fTWZAyLerEhGti8F"}},"options":{}},"type":"n8n-nodes-base.googleDrive","typeVersion":3,"position":[192,-208],"id":"499a6b17-db97-439a-ba44-a18e855927ef","name":"Search files and folders","credentials":{"googleDriveOAuth2Api":{"id":"KUrcceziR6IJKjXk","name":"Google Drive account"}}},{"parameters":{"operation":"deleteFile","fileId":{"__rl":true,"value":"={{ $('Download file').item.json.id }}","mode":"id"},"options":{}},"type":"n8n-nodes-base.googleDrive","typeVersion":3,"position":[1264,-208],"id":"9a795ca1-2d72-4aa6-b410-5cd25a37e329","name":"Delete a file","credentials":{"googleDriveOAuth2Api":{"id":"KUrcceziR6IJKjXk","name":"Google Drive account"}}},{"parameters":{"jsCode":"return {\n  cleanedText: $json[\"data\"]\n    .replace(/^measurements[\\s\\.,-]*/i, \"\") // remove prefix (case-insensitive, plus punctuation/spaces)\n    .trim()\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[848,304],"id":"3b060c5b-5609-45ac-807c-4cd2aedf003b","name":"Delete measurements"},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"218dcbfd-8835-8008-a2bd-c164ab084ed3","mode":"list","cachedResultName":"TODO ","cachedResultUrl":"https://www.notion.so/218dcbfd88358008a2bdc164ab084ed3"},"title":"={{ $json.cleanedText }}","options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[1072,-32],"id":"8f319501-fd85-4436-9711-02fd68b7d526","name":"add to TODO","credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"234dcbfd-8835-805f-8ba9-de38ea537985","mode":"list","cachedResultName":"Thoughts","cachedResultUrl":"https://www.notion.so/234dcbfd8835805f8ba9de38ea537985"},"title":"={{ $json.cleanedText }}","options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[1072,144],"id":"818b7c0f-ff7f-4e61-9f16-a57518c49695","name":"add to Thoughts","credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"modelId":{"__rl":true,"value":"models/gemini-2.5-pro","mode":"list","cachedResultName":"models/gemini-2.5-pro"},"messages":{"values":[{"content":"=Output  {{ $json.cleanedText }} as CSV with columns: Body weight, blood sugar, ketones"}]},"simplify":false,"options":{}},"type":"@n8n/n8n-nodes-langchain.googleGemini","typeVersion":1,"position":[976,464],"id":"3563cfd1-b23c-4314-9a73-7e9ee61d6f18","name":"Message a model","credentials":{"googlePalmApi":{"id":"doF6Conz8WNkWBH9","name":"Google Gemini(PaLM) Api account"}}},{"parameters":{"jsCode":"// remove leading/backtick fences if present\nconst raw = $json.candidates[0].content.parts[0].text;\nconst csv = raw\n  .replace(/```[a-z]*\\n?/gi, '')   // opening ``` or ```csv\n  .replace(/```$/,'')              // closing ```\n  .trim();\n\nconst [header, ...rows] = csv.split('\\n');\nconst columns = header.split(',');\n\nreturn rows.map(line => {\n  const values = line.split(',');\n  const obj = {};\n  columns.forEach((col, i) => {\n    let v = values[i]?.trim();\n    // if v looks like a number, convert it\n    obj[col.trim()] = isNaN(v) ? v : Number(v);\n  });\n  return obj;\n});\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[1264,432],"id":"7fed2ae8-646c-4257-a60a-c89d82a40b68","name":"Code"},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"26edcbfd-8835-80f3-804a-cf010f2e8796","mode":"list","cachedResultName":"messurements","cachedResultUrl":"https://www.notion.so/26edcbfd883580f3804acf010f2e8796"},"title":"={{ $now.format('M/d HH:mm') }}","simple":false,"propertiesUi":{"propertyValues":[{"key":"Ketones|number","numberValue":"={{ $json.ketones }}"},{"key":"bg|number","numberValue":"={{ $json['blood sugar'] }}"},{"key":"Weight|number","numberValue":"={{ $json['Body weight'] }}"},{"key":"Date|date","includeTime":false,"date":"={{ $now.format('M/d/y HH:mm ') }}","timezone":"Asia/Jerusalem"},{"key":"Time|rich_text","textContent":"={{ $now.format('HH:mm') }}"}]},"options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[1568,224],"id":"495fde4c-60f9-485c-9147-5db88c4e74cb","name":"Create a database page","credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"jsCode":"// Pull the tex\nconst input = $json.cleanedText || \"\";\n\n// Split at any of the marker phrases (case-insensitive)\nconst parts = input\n  .split(/description|when/i)\n  .map(s => s.trim().replace(/^[\\s\\p{P}]+|[\\s\\p{P}]+$/gu, ''));\n\n// Ensure we always return five keys, even if some markers are missing\nreturn {\n  part1: parts[0] || \"\",\n  part2: parts[1] || \"\",\n  part3: parts[2] || \"\",\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[928,-784],"id":"c97004dd-6945-46a0-956f-eb502357ce21","name":"split title/description/start/end"},{"parameters":{"modelId":{"__rl":true,"value":"models/gemini-2.5-pro","mode":"list","cachedResultName":"models/gemini-2.5-pro"},"messages":{"values":[{"content":"=now is {{ $now }}. extract from \"{{ $json.part3 }}\" 2 outputs:\n\n1. start date-time (exactly in the format \"YYYY-MM-DD hh:mm\" . ignore timezone)\n2. end date-time (exactly in the format \"YYYY-MM-DD hh:mm\" . ignore timezone)\ndo not include anything else in the output. all outputs must be of the current year."}]},"simplify":false,"options":{}},"type":"@n8n/n8n-nodes-langchain.googleGemini","typeVersion":1,"position":[1152,-784],"id":"b45865e0-9fed-42f2-af8e-f3f3542fe8f5","name":"Message a model1","retryOnFail":true,"waitBetweenTries":2000,"maxTries":5,"credentials":{"googlePalmApi":{"id":"doF6Conz8WNkWBH9","name":"Google Gemini(PaLM) Api account"}}},{"parameters":{"jsCode":"// Input: a string like \"2024-08-03 06:00\\n2025-09-17 21:20\\n\"\nconst input = $input.first().json.candidates[0].content.parts[0].text;   // adjust the property name if different\n\nconst lines = input\n  .trim()\n  .split(\"\\n\")\n  .filter(Boolean);\n\nconst outputs = lines.map(line => {\n  const [datePart, timePart] = line.split(\" \");\n  const [year, month, day] = datePart.split(\"-\");\n  const [hour, minute] = timePart.split(\":\");\n\n  // Create a Date in UTC\n  const d = new Date(Date.UTC(\n    parseInt(year),           // year\n    parseInt(month) - 1,       // month is 0-based\n    parseInt(day),\n    parseInt(hour),\n    parseInt(minute),\n    0                          // seconds\n  ));\n\n  // Format as YYYY-MM-DDThh:mm:ssZ\n  const pad = n => n.toString().padStart(2, \"0\");\n  return `${d.getUTCFullYear()}-${pad(d.getUTCMonth()+1)}-${pad(d.getUTCDate())}T${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}:${pad(d.getUTCSeconds())}`;\n});\n\nreturn {\n  StartTime: outputs[0],\n  EndTime: outputs[1]\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[1552,-784],"id":"c0520d54-6682-42b3-92a9-914bc73cd980","name":"Format to standard times"},{"parameters":{"jsCode":"const start = $input.first().json.StartTime;  // e.g. 2025-09-18T09:15:00\nconst end   = $input.first().json.EndTime;    // e.g. 2025-09-18T00:07:00\n\n// ---------- Helper functions ----------\n\n// Find the date of the last Sunday of a given month (1-based)\nfunction lastSunday(year, month) {\n  // month is 1–12\n  const d = new Date(Date.UTC(year, month, 0)); // last day of month in UTC\n  const day = d.getUTCDay(); // 0 = Sunday\n  d.setUTCDate(d.getUTCDate() - day);\n  return d; // Date in UTC at 00:00\n}\n\n// Find the Friday before the last Sunday of March\nfunction fridayBeforeLastSundayOfMarch(year) {\n  const lastSun = lastSunday(year, 3); // March = 3\n  const fri = new Date(lastSun);\n  // back up until Friday (5)\n  while (fri.getUTCDay() !== 5) {\n    fri.setUTCDate(fri.getUTCDate() - 1);\n  }\n  return fri;\n}\n\n// True if the given local date (Israel) is in DST\nfunction isIsraelDST(date) {\n  const y = date.getUTCFullYear();\n  const dstStart = fridayBeforeLastSundayOfMarch(y);\n  const dstEnd   = lastSunday(y, 10); // October\n  // DST starts at 2:00 local → effectively 0:00 UTC +2 = 0:00\n  // Our check is date-only because we only care if it's between these days.\n  return date >= dstStart && date < dstEnd;\n}\n\n// Convert Israel local time to UTC string\nfunction israelLocalToUTC(str) {\n  // Accept underscores or dashes\n  const [datePart, timePart] = str.trim().split(\"T\");\n  const [y,m,d] = datePart.replace(/-/g,\"-\").split(\"-\").map(Number);\n  const [hh,mm,ss=\"0\"] = timePart.split(\":\").map(Number);\n\n  // Create a date representing that local time *as if* it were UTC,\n  // then subtract the correct offset to get true UTC.\n  const local = new Date(Date.UTC(y, m-1, d, hh, mm, ss));\n\n  const offset = isIsraelDST(local) ? 3 : 2; // hours ahead of UTC\n  local.setUTCHours(local.getUTCHours() - offset);\n\n  const pad = n => n.toString().padStart(2,\"0\");\n  return `${local.getUTCFullYear()}-${pad(local.getUTCMonth()+1)}-${pad(local.getUTCDate())}T${pad(local.getUTCHours())}:${pad(local.getUTCMinutes())}:${pad(local.getUTCSeconds())}Z`;\n}\n\n// ---------- Run ----------\nreturn {\n  start_time_utc: israelLocalToUTC(start),\n  end_time_utc:   israelLocalToUTC(end)\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[1840,-784],"id":"c7fcddb8-f830-4ebf-8e39-46691fd782b7","name":"convert to utc"},{"parameters":{"url":"https://www.googleapis.com/drive/v3/files","authentication":"predefinedCredentialType","nodeCredentialType":"googleDriveOAuth2Api","sendQuery":true,"specifyQuery":"json","jsonQuery":"={\n  \"q\": \"'1tOOiWR1_m0AVN_8ggtBMjU6IRTtMS39v' in parents and modifiedTime >= '{{ $json.start_time_utc }}' and modifiedTime <= '{{ $json.end_time_utc }}'\",\n  \"fields\": \"files(id,name,mimeType,modifiedTime,thumbnailLink)\",\n  \"pageSize\": \"100\"\n}\n\n","options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.2,"position":[2096,-784],"id":"1f7f6d4d-243a-4af6-ade0-a02511331458","name":"get docs from drive in time range","credentials":{"googleDriveOAuth2Api":{"id":"KUrcceziR6IJKjXk","name":"Google Drive account"}}},{"parameters":{"command":"touch -t 202509170800 /tmp/start.ref    # 2025-09-17 08:00\ntouch -t 202509171830 /tmp/end.ref      # 2025-09-17 18:30\n\nfind /mnt/data/nextcloud-data/bhochster/files/InstantUpload/Camera/t \\\n   -type f -name \"*.m4a\" \\\n   -newer /tmp/start.ref \\\n   ! -newer /tmp/end.ref \\\n   -print0\n\n"},"type":"n8n-nodes-base.executeCommand","typeVersion":1,"position":[2304,-784],"id":"73509e3e-6c0d-4971-bf4b-f1100104f878","name":"Execute Command"},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"228dcbfd-8835-80ab-9727-ee036d84f48e","mode":"list","cachedResultName":"Journal Entries","cachedResultUrl":"https://www.notion.so/228dcbfd883580ab9727ee036d84f48e"},"title":"={{ $('split title/description/start/end').item.json.part1 }}","simple":false,"propertiesUi":{"propertyValues":[{"key":"actual time|date","range":true,"dateStart":"={{ $json.start_time_utc }}","dateEnd":"={{ $json.end_time_utc }}","timezone":"Asia/Tel_Aviv"},{"key":"Content|rich_text","richText":true,"text":{"text":[{"text":"={{ $('split title/description/start/end').item.json.part2 }}","annotationUi":{}}]}}]},"options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[1936,-560],"id":"c3b7de31-53f6-441d-9f21-b7232e4fbf51","name":"Create a database page1","credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"jsCode":"return [\n  {\n    json: {\n      time1_formatted: $node[\"Format to standard times\"].json.StartTime\n        .replace(/[-:T]/g, \"\")\n        .slice(0, 12),\n\n      time2_formatted: $node[\"Format to standard times\"].json.EndTime\n        .replace(/[-:T]/g, \"\")\n        .slice(0, 12),\n\n      // here is the Notion page id\n      notion_page_id: $node[\"Create a database page1\"].json.id\n    }\n  }\n];"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[2144,-560],"id":"7e7e9292-de9b-4739-8e95-49f62f960c05","name":"Code1"},{"parameters":{"workflowId":{"__rl":true,"value":"sUvmapKEv4loeDlh","mode":"list","cachedResultName":"playground"},"workflowInputs":{"mappingMode":"defineBelow","value":{},"matchingColumns":[],"schema":[],"attemptToConvertTypes":false,"convertFieldsToString":true},"options":{"waitForSubWorkflow":true}},"type":"n8n-nodes-base.executeWorkflow","typeVersion":1.2,"position":[2384,-480],"id":"95fdb282-e98b-4faf-9baa-002a88cca02e","name":"Execute Workflow"}],"connections":{"Download file":{"main":[[{"node":"HTTP Request","type":"main","index":0}]]},"HTTP Request":{"main":[[{"node":"Switch","type":"main","index":0}]]},"Switch":{"main":[[{"node":"Delete journal entry","type":"main","index":0}],[{"node":"Delete journal entry","type":"main","index":0}],[{"node":"Delete to do","type":"main","index":0}],[{"node":"Delete to do","type":"main","index":0}],[{"node":"Delete thought","type":"main","index":0}],[{"node":"Delete measurements","type":"main","index":0}]]},"Delete journal entry":{"main":[[{"node":"split title/description/start/end","type":"main","index":0}]]},"Delete to do":{"main":[[{"node":"add to TODO","type":"main","index":0}]]},"Delete thought":{"main":[[{"node":"add to Thoughts","type":"main","index":0}]]},"Loop Over Items":{"main":[[],[{"node":"Download file","type":"main","index":0}]]},"Schedule Trigger":{"main":[[{"node":"Search files and folders","type":"main","index":0}]]},"Search files and folders":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Delete a file":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"add to TODO":{"main":[[{"node":"Delete a file","type":"main","index":0}]]},"add to Thoughts":{"main":[[{"node":"Delete a file","type":"main","index":0}]]},"Delete measurements":{"main":[[{"node":"Message a model","type":"main","index":0}]]},"Message a model":{"main":[[{"node":"Code","type":"main","index":0}]]},"Code":{"main":[[{"node":"Create a database page","type":"main","index":0}]]},"Create a database page":{"main":[[{"node":"Delete a file","type":"main","index":0}]]},"split title/description/start/end":{"main":[[{"node":"Message a model1","type":"main","index":0}]]},"Message a model1":{"main":[[{"node":"Format to standard times","type":"main","index":0}]]},"Format to standard times":{"main":[[{"node":"convert to utc","type":"main","index":0}]]},"convert to utc":{"main":[[{"node":"Create a database page1","type":"main","index":0}]]},"get docs from drive in time range":{"main":[[{"node":"Execute Command","type":"main","index":0}]]},"Create a database page1":{"main":[[{"node":"Code1","type":"main","index":0}]]},"Code1":{"main":[[{"node":"Execute Workflow","type":"main","index":0}]]},"Execute Workflow":{"main":[[{"node":"Delete a file","type":"main","index":0}]]}},"settings":{"executionOrder":"v1","callerPolicy":"workflowsFromSameOwner","errorWorkflow":"eT5fOtELZiLLcpbS","timeSavedPerExecution":1,"saveExecutionProgress":true,"timezone":"Asia/Jerusalem"},"staticData":{"node:Google Drive Trigger":{"lastTimeChecked":"2025-09-12T02:33:00Z"},"node:Schedule Trigger":{"recurrenceRules":[]}},"meta":{"templateCredsSetupCompleted":true},"pinData":{},"versionId":"1897ead9-d6e0-42bf-b1ce-39f6e640ef7d","triggerCount":1,"tags":[],"shared":[{"createdAt":"2025-09-16T23:18:25.420Z","updatedAt":"2025-09-16T23:18:25.420Z","role":"workflow:owner","workflowId":"lWlc0brkK1MAkuph","projectId":"DQC8ik4pLkhZ4ZDm","project":{"createdAt":"2025-08-19T19:25:16.723Z","updatedAt":"2025-08-19T19:26:16.591Z","id":"DQC8ik4pLkhZ4ZDm","name":"Ben Hex <bhochster@gmail.com>","type":"personal","icon":null,"description":null}}]},{"createdAt":"2025-09-18T00:17:52.730Z","updatedAt":"2025-09-24T18:26:33.000Z","id":"sUvmapKEv4loeDlh","name":"playground","active":false,"isArchived":false,"nodes":[{"parameters":{"command":"=touch -t {{ $json.start_time_touch }} /tmp/start.ref && \\\ntouch -t {{ $json.end_time_touch}} /tmp/end.ref && \\\nfind /mnt/data/nextcloud-data/bhochster/files/InstantUpload/Camera/ \\\n     /mnt/data/nextcloud-data/bhochster/files/InstantUpload/Screenshots/ \\\n     \"/mnt/data/nextcloud-data/bhochster/files/InstantUpload/WhatsApp Images/\" \\\n     -newer /tmp/start.ref ! -newer /tmp/end.ref -print0"},"type":"n8n-nodes-base.executeCommand","typeVersion":1,"position":[464,-16],"id":"dca5b2e6-5c5a-491d-bc62-bdd08da2b38c","name":"Execute Command"},{"parameters":{"jsCode":"return items.map(item => {\n  const raw = $('Execute Command').first().json.stdout;\n  const files = raw.split('\\u0000').filter(f => f.trim() !== '');\n  // output one new item per file\n  return files.map(f => ({ json: { filePath: f } }));\n}).flat();"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[896,-16],"id":"5a90c8ac-376d-4d76-85d5-2fd53f66a45e","name":"Code"},{"parameters":{"fileSelector":"={{ $json.filePath }}","options":{}},"type":"n8n-nodes-base.readWriteFile","typeVersion":1,"position":[1296,-16],"id":"8b002a36-3a44-4c1f-a76f-e63a4591ca7a","name":"Read/Write Files from Disk"},{"parameters":{"operation":"sendPhoto","chatId":"1559527672","binaryData":true,"replyMarkup":"inlineKeyboard","inlineKeyboard":{"rows":[{"row":{"buttons":[{"text":"Accept","additionalFields":{"callback_data":"={{ $('Telegram_send').item.json.Notion_page_id }}"}}]}}]},"additionalFields":{"caption":"= {{ $json.fileName }} entry {{ $('Telegram_send').item.json.NotionTitle }}"}},"type":"n8n-nodes-base.telegram","typeVersion":1.2,"position":[1984,-240],"id":"08af3fcb-d80a-40ec-9284-c8e35b4e5944","name":"Send a photo message","webhookId":"591c198c-d080-4cb6-94b1-b7ce148e71d0","credentials":{"telegramApi":{"id":"HbsIszuZLGiRpxz5","name":"Telegram account"}}},{"parameters":{"workflowInputs":{"values":[{"name":"Notion_page_id"},{"name":"start_time"},{"name":"end_time"},{"name":"NotionTitle"}]}},"type":"n8n-nodes-base.executeWorkflowTrigger","typeVersion":1.1,"position":[0,0],"id":"73b18ef6-4be5-4b01-82eb-a42b337ed1d9","name":"Telegram_send"},{"parameters":{"rules":{"values":[{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"leftValue":"={{ $('Read/Write Files from Disk').item.json.fileType }}","rightValue":"=image","operator":{"type":"string","operation":"equals"},"id":"14160dcf-bfca-4ac1-ae37-c5c13215a016"}],"combinator":"and"}},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"1d2fd8e6-a9c3-4e58-b465-abd41461b600","leftValue":"={{ $('Read/Write Files from Disk').item.json.fileType }}","rightValue":"video","operator":{"type":"string","operation":"equals","name":"filter.operator.equals"}}],"combinator":"and"}},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"2dd0da1b-1ba1-466b-b6c1-2271878a1f0f","leftValue":"={{ $('Read/Write Files from Disk').item.json.fileType }}","rightValue":"document","operator":{"type":"string","operation":"equals","name":"filter.operator.equals"}}],"combinator":"and"}},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"6536ae19-91c8-475b-a96d-1d58df51298f","leftValue":"={{ $('Read/Write Files from Disk').item.json.fileType }}","rightValue":"audio","operator":{"type":"string","operation":"equals","name":"filter.operator.equals"}}],"combinator":"and"}}]},"options":{}},"type":"n8n-nodes-base.switch","typeVersion":3.2,"position":[1584,-48],"id":"e368147c-6efa-4f84-842f-a7ef715ff9c8","name":"Switch"},{"parameters":{"operation":"sendVideo","chatId":"1559527672","binaryData":true,"replyMarkup":"inlineKeyboard","inlineKeyboard":{"rows":[{"row":{"buttons":[{"text":"Accept","additionalFields":{"callback_data":"={{ $('Telegram_send').item.json.Notion_page_id }}"}}]}}]},"additionalFields":{"caption":"= {{ $json.fileName }} entry {{ $('Telegram_send').item.json.NotionTitle }}"}},"type":"n8n-nodes-base.telegram","typeVersion":1.2,"position":[1984,-64],"id":"46751500-09e6-434d-8a85-cb85cd5ff209","name":"Send a video","webhookId":"591c198c-d080-4cb6-94b1-b7ce148e71d0","credentials":{"telegramApi":{"id":"HbsIszuZLGiRpxz5","name":"Telegram account"}}},{"parameters":{"operation":"sendDocument","chatId":"1559527672","binaryData":true,"replyMarkup":"inlineKeyboard","inlineKeyboard":{"rows":[{"row":{"buttons":[{"text":"Accept","additionalFields":{"callback_data":"={{ $('Telegram_send').item.json.Notion_page_id }}"}}]}}]},"additionalFields":{"caption":"= {{ $json.fileName }} entry {{ $('Telegram_send').item.json.NotionTitle }}"}},"type":"n8n-nodes-base.telegram","typeVersion":1.2,"position":[1984,112],"id":"1dda6e2f-9c49-46e5-a6a0-eed168ff408e","name":"Send a document","webhookId":"591c198c-d080-4cb6-94b1-b7ce148e71d0","credentials":{"telegramApi":{"id":"HbsIszuZLGiRpxz5","name":"Telegram account"}}},{"parameters":{"operation":"sendAudio","chatId":"1559527672","binaryData":true,"replyMarkup":"inlineKeyboard","inlineKeyboard":{"rows":[{"row":{"buttons":[{"text":"Accept","additionalFields":{"callback_data":"={{ $('Telegram_send').item.json.Notion_page_id }}"}}]}}]},"additionalFields":{"caption":"= {{ $json.fileName }} entry {{ $('Telegram_send').item.json.NotionTitle }}"}},"type":"n8n-nodes-base.telegram","typeVersion":1.2,"position":[1984,288],"id":"0905ae9c-17d3-4ea8-a173-3ae96efad6b2","name":"Send an audio file","webhookId":"591c198c-d080-4cb6-94b1-b7ce148e71d0","credentials":{"telegramApi":{"id":"HbsIszuZLGiRpxz5","name":"Telegram account"}}},{"parameters":{"jsCode":"// n8n Code node – JavaScript\n// Converts Israel local time (Asia/Jerusalem) to UTC\n\nreturn [\n  {\n    json: {\n      start_time_utc: new Date($json.start_time + ':00+03:00').toISOString(),\n      end_time_utc:   new Date($json.end_time   + ':00+03:00').toISOString()\n    }\n  }\n];"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[128,-304],"id":"f99c81d2-37ed-4d04-aa62-4267e093418c","name":"Convert to utc"},{"parameters":{"jsCode":"// n8n Code node – JavaScript\n// Input: $json.start_time_utc and $json.end_time_utc are ISO UTC strings\n// Output: touch/find compatible time strings like 202509221428.00\n\nfunction toTouchTime(iso) {\n  const d = new Date(iso);\n  const pad = n => n.toString().padStart(2,'0');\n  return (\n    d.getUTCFullYear().toString() +\n    pad(d.getUTCMonth() + 1) +\n    pad(d.getUTCDate()) +\n    pad(d.getUTCHours()) +\n    pad(d.getUTCMinutes()) +\n    '.' +\n    pad(d.getUTCSeconds())\n  );\n}\n\nreturn [\n  {\n    json: {\n      start_time_touch: toTouchTime($json.start_time_utc),\n      end_time_touch:   toTouchTime($json.end_time_utc)\n    }\n  }\n];"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[336,-304],"id":"c0f6531c-ba5e-45ef-a0cb-fe9ea303bd39","name":"Convert to ssh time"},{"parameters":{"content":"## Time conversions for ssh command\n** First to utc than to ssh format","height":304,"width":384},"type":"n8n-nodes-base.stickyNote","position":[96,-432],"typeVersion":1,"id":"233318f3-73ac-41fb-b9bc-52022acf8f2b","name":"Sticky Note"},{"parameters":{"content":"## Get files in time range \n","height":320,"width":816},"type":"n8n-nodes-base.stickyNote","position":[416,-80],"typeVersion":1,"id":"11b21911-3a99-46d6-a759-ada31ce9c640","name":"Sticky Note1"},{"parameters":{},"type":"n8n-nodes-base.stickyNote","position":[768,-64],"typeVersion":1,"id":"d5d02e5d-4ea4-451a-99e7-13ff33857531","name":"Sticky Note2"},{"parameters":{"content":"## switch by file type","height":368,"width":160},"type":"n8n-nodes-base.stickyNote","position":[1568,-128],"typeVersion":1,"id":"8e626258-3ba3-453e-a018-2ff07ec93cd4","name":"Sticky Note3"},{"parameters":{"jsCode":"// This Code node receives the Execute Command node output\nconst out = $json[\"stdout\"];\n\n// Split on NUL (because find -print0 outputs \\u0000)\nconst files = out.split('\\u0000').filter(Boolean);\n\nreturn {\n  files,               // the original list for the rest of your workflow\n  fileCount: files.length\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[672,-16],"id":"b5f3745e-8fc1-48fc-b2c8-c9b17cdae6c7","name":"Code1"},{"parameters":{"chatId":"1559527672","text":"=Add files to notion journal entry: <b> {{ $('Telegram_send').item.json.NotionTitle }} </b>\n\nBetween {{ $('Telegram_send').item.json.start_time }} and {{ $('Telegram_send').item.json.end_time }}\n\nNumber of files:{{ $json.fileCount }}","additionalFields":{"parse_mode":"HTML"}},"type":"n8n-nodes-base.telegram","typeVersion":1.2,"position":[656,384],"id":"33c6250b-4322-4def-a470-9315df926a3b","name":"Send a text message","webhookId":"b6f8d7b6-3a2b-46d5-9eba-6c4ea1b18aeb","credentials":{"telegramApi":{"id":"HbsIszuZLGiRpxz5","name":"Telegram account"}}},{"parameters":{"chatId":"1559527672","text":"=End of <b>{{ $node[\"Telegram_send\"].json.NotionTitle }}</b>\n","additionalFields":{"parse_mode":"HTML"}},"type":"n8n-nodes-base.telegram","typeVersion":1.2,"position":[2544,32],"id":"bbe6480b-7221-42ad-8b45-d61cf88cecf6","name":"Send a text message2","webhookId":"b6f8d7b6-3a2b-46d5-9eba-6c4ea1b18aeb","executeOnce":false,"credentials":{"telegramApi":{"id":"HbsIszuZLGiRpxz5","name":"Telegram account"}}},{"parameters":{"jsCode":"// Collapse all incoming items into a single output item\nreturn [\n  {\n    json: {\n      // keep the values you want to pass through from the first item\n      NotionTitle: items[0].json.NotionTitle,\n      start_time:  items[0].json.start_time,\n      end_time:    items[0].json.end_time,\n\n      // and also keep the complete list of files\n      allFiles: items.map(i => i.json)   // or i.json.result if you only need that part\n    }\n  }\n];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[2288,32],"id":"42674ed8-4e68-4000-997c-6fb1f10bf307","name":"Code2"}],"connections":{"Execute Command":{"main":[[{"node":"Code1","type":"main","index":0}]]},"Code":{"main":[[{"node":"Read/Write Files from Disk","type":"main","index":0}]]},"Read/Write Files from Disk":{"main":[[{"node":"Switch","type":"main","index":0}]]},"Send a photo message":{"main":[[{"node":"Code2","type":"main","index":0}]]},"Telegram_send":{"main":[[{"node":"Convert to utc","type":"main","index":0}]]},"Switch":{"main":[[{"node":"Send a photo message","type":"main","index":0}],[{"node":"Send a video","type":"main","index":0}],[{"node":"Send a document","type":"main","index":0}],[{"node":"Send an audio file","type":"main","index":0}]]},"Convert to utc":{"main":[[{"node":"Convert to ssh time","type":"main","index":0}]]},"Convert to ssh time":{"main":[[{"node":"Execute Command","type":"main","index":0}]]},"Code1":{"main":[[{"node":"Send a text message","type":"main","index":0}]]},"Send a text message":{"main":[[{"node":"Code","type":"main","index":0}]]},"Send a video":{"main":[[{"node":"Code2","type":"main","index":0}]]},"Send a document":{"main":[[{"node":"Code2","type":"main","index":0}]]},"Send an audio file":{"main":[[{"node":"Code2","type":"main","index":0}]]},"Code2":{"main":[[{"node":"Send a text message2","type":"main","index":0}]]}},"settings":{"executionOrder":"v1","saveExecutionProgress":true,"callerPolicy":"workflowsFromSameOwner","errorWorkflow":"eT5fOtELZiLLcpbS","timezone":"Asia/Jerusalem"},"staticData":null,"meta":{"templateCredsSetupCompleted":true},"pinData":{"Telegram_send":[{"json":{"Notion_page_id":"278dcbfd-8835-81bb-8831-d0c31823f93b","start_time":"2025-09-21T09:28","end_time":"2025-09-21T16:28","NotionTitle":"Testing Workflow"}}]},"versionId":"dee96c4e-4676-49cc-8de9-076e9588b21d","triggerCount":0,"tags":[],"shared":[{"createdAt":"2025-09-18T00:17:52.734Z","updatedAt":"2025-09-18T00:17:52.734Z","role":"workflow:owner","workflowId":"sUvmapKEv4loeDlh","projectId":"DQC8ik4pLkhZ4ZDm","project":{"createdAt":"2025-08-19T19:25:16.723Z","updatedAt":"2025-08-19T19:26:16.591Z","id":"DQC8ik4pLkhZ4ZDm","name":"Ben Hex <bhochster@gmail.com>","type":"personal","icon":null,"description":null}}]},{"createdAt":"2025-09-18T11:17:18.275Z","updatedAt":"2025-09-18T11:21:12.000Z","id":"eEodZgLWTjF2l1E1","name":"sub-playground","active":false,"isArchived":false,"nodes":[{"parameters":{"inputSource":"passthrough"},"type":"n8n-nodes-base.executeWorkflowTrigger","typeVersion":1.1,"position":[0,0],"id":"960cae1a-50ae-4abd-b07a-66d76d090c38","name":"When Executed by Another Workflow"}],"connections":{},"settings":{"executionOrder":"v1","saveExecutionProgress":true,"callerPolicy":"workflowsFromSameOwner"},"staticData":null,"meta":null,"pinData":{},"versionId":"9fc972de-f6b5-41cd-aa15-de17611ae18f","triggerCount":0,"tags":[],"shared":[{"createdAt":"2025-09-18T11:17:18.278Z","updatedAt":"2025-09-18T11:17:18.278Z","role":"workflow:owner","workflowId":"eEodZgLWTjF2l1E1","projectId":"DQC8ik4pLkhZ4ZDm","project":{"createdAt":"2025-08-19T19:25:16.723Z","updatedAt":"2025-08-19T19:26:16.591Z","id":"DQC8ik4pLkhZ4ZDm","name":"Ben Hex <bhochster@gmail.com>","type":"personal","icon":null,"description":null}}]},{"createdAt":"2025-09-20T09:01:47.360Z","updatedAt":"2025-09-24T18:36:41.000Z","id":"69DtTxAHb20XBPkn","name":"telegram recieve","active":true,"isArchived":false,"nodes":[{"parameters":{"updates":["callback_query"],"additionalFields":{"download":true}},"type":"n8n-nodes-base.telegramTrigger","typeVersion":1.2,"position":[-176,0],"id":"f8e0ec49-dc22-45e7-a3aa-edc82f3b4624","name":"Telegram Trigger","webhookId":"278d45ac-42fe-423f-b79c-4f3b67a3ac19","credentials":{"telegramApi":{"id":"HbsIszuZLGiRpxz5","name":"Telegram account"}}},{"parameters":{"resource":"file","fileId":"={{\n  $('Telegram Trigger').item.json.callback_query.message.photo?.slice(-1)[0]?.file_id\n  || $('Telegram Trigger').item.json.callback_query.message.video?.file_id\n}}","additionalFields":{}},"type":"n8n-nodes-base.telegram","typeVersion":1.2,"position":[272,0],"id":"28c2ebcf-4890-4f79-8f74-66edb348dcc0","name":"Get a file","webhookId":"b65e8a63-730a-46f7-a398-0c4024b62f64","credentials":{"telegramApi":{"id":"HbsIszuZLGiRpxz5","name":"Telegram account"}}},{"parameters":{"jsCode":"// Access the callback_data value and strip any trailing newline\nreturn items.map(item => {\n  const clean = $('Telegram Trigger').first().json.callback_query.message.reply_markup.inline_keyboard[0][0].callback_data.replace(/\\n/g, '');\n  return { json: { cleaned_data: clean } };\n});\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[64,0],"id":"3deb84a3-5840-44c4-91e8-1f86214c4350","name":"Code"},{"parameters":{"operation":"upload","bucketName":"test","fileName":"={{ $json.result.file_path.replace(/.*\\//, 'photos/') }}","additionalFields":{}},"type":"n8n-nodes-base.s3","typeVersion":1,"position":[480,144],"id":"ccd6ebc8-6d24-4892-ae2c-4f871caaecf9","name":"Upload a file2","credentials":{"s3":{"id":"ro79hRPCP4oEKH1C","name":"S3 account"}}},{"parameters":{"resource":"databasePage","operation":"update","pageId":{"__rl":true,"value":"={{ $('Code').item.json.cleaned_data }}","mode":"id"},"propertiesUi":{"propertyValues":[{"key":"Files & media|files","fileUrls":{"fileUrl":[{"name":"={{ $('Get a file').item.json.result.file_path.replace(/.*\\//, 'photos/') }}\n","url":"=https://min.velvetcld.gleeze.com/test/{{ $('Get a file').item.json.result.file_path.replace(/.*\\//, 'photos/') }}\n"}]}}]},"options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[768,128],"id":"c19312ae-ae60-48f4-9323-e9226eb25293","name":"Update a database page","credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}}],"connections":{"Telegram Trigger":{"main":[[{"node":"Code","type":"main","index":0}]]},"Get a file":{"main":[[{"node":"Upload a file2","type":"main","index":0}]]},"Code":{"main":[[{"node":"Get a file","type":"main","index":0}]]},"Upload a file2":{"main":[[{"node":"Update a database page","type":"main","index":0}]]}},"settings":{"executionOrder":"v1","callerPolicy":"workflowsFromSameOwner","errorWorkflow":"eT5fOtELZiLLcpbS"},"staticData":null,"meta":{"templateCredsSetupCompleted":true},"pinData":{},"versionId":"efb32199-8e2a-4a5e-983c-e37eb36b8cc2","triggerCount":1,"tags":[],"shared":[{"createdAt":"2025-09-20T09:01:47.365Z","updatedAt":"2025-09-20T09:01:47.365Z","role":"workflow:owner","workflowId":"69DtTxAHb20XBPkn","projectId":"DQC8ik4pLkhZ4ZDm","project":{"createdAt":"2025-08-19T19:25:16.723Z","updatedAt":"2025-08-19T19:26:16.591Z","id":"DQC8ik4pLkhZ4ZDm","name":"Ben Hex <bhochster@gmail.com>","type":"personal","icon":null,"description":null}}]},{"createdAt":"2025-09-22T11:17:10.366Z","updatedAt":"2025-09-22T13:29:29.000Z","id":"SKGcnUmgxcjh32dx","name":"record to notion attempt without gemini","active":false,"isArchived":false,"nodes":[{"parameters":{"operation":"download","fileId":{"__rl":true,"value":"={{ $json.id }}","mode":"id"},"options":{"binaryPropertyName":"data"}},"type":"n8n-nodes-base.googleDrive","typeVersion":3,"position":[-64,400],"id":"4140cca6-5d71-4f3e-96c8-f365e57f71ea","name":"Download file","credentials":{"googleDriveOAuth2Api":{"id":"KUrcceziR6IJKjXk","name":"Google Drive account"}}},{"parameters":{"method":"POST","url":"http://whisper:8000/v1/audio/transcriptions","sendBody":true,"contentType":"multipart-form-data","bodyParameters":{"parameters":[{"parameterType":"formBinaryData","name":"file","inputDataFieldName":"data"},{"name":"response_format","value":"text"},{"name":"model","value":"Systran/faster-whisper-large-v3"},{"name":"temperature","value":"0.0"},{"name":"beam_size","value":"10"},{"name":"patience","value":"1.5"},{"name":"length_penalty","value":"1.15"},{"name":"condition_on_previous_text","value":"false"},{"name":"vad_filter","value":"true"},{"name":"no_speech_threshold","value":"0.45"}]},"options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.2,"position":[112,144],"id":"439b3545-6a2d-400b-9199-7632aa187aac","name":"HTTP Request"},{"parameters":{"rules":{"values":[{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"leftValue":"={{ $('HTTP Request').item.json.data }}","rightValue":"journal entry","operator":{"type":"string","operation":"startsWith"},"id":"59c81b96-fb8f-47a6-b536-5ad0cfe8304a"}],"combinator":"and"}},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"9adfef7a-692f-4523-9d7a-588e2f763c16","leftValue":"={{ $('HTTP Request').item.json.data }}","rightValue":"journal item","operator":{"type":"string","operation":"startsWith"}}],"combinator":"and"}},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"3cafa00d-99b0-492f-a4d3-a5d0bf900e1d","leftValue":"={{ $('HTTP Request').item.json.data }}","rightValue":"to do","operator":{"type":"string","operation":"startsWith"}}],"combinator":"and"}},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"6a70091c-f310-4f81-81d9-1d9c04c6accc","leftValue":"={{ $('HTTP Request').item.json.data }}","rightValue":"todo","operator":{"type":"string","operation":"startsWith"}}],"combinator":"and"}},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"66ed9dca-160f-44be-965a-4db34c244c1f","leftValue":"={{ $('HTTP Request').item.json.data }}","rightValue":"thought","operator":{"type":"string","operation":"startsWith"}}],"combinator":"and"}},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"dbb0f538-2677-467b-81e3-317734614751","leftValue":"={{ $('HTTP Request').item.json.data }}","rightValue":"measurements","operator":{"type":"string","operation":"startsWith"}}],"combinator":"and"}},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"a4ad79fc-a2a5-49b1-85c0-d5ee0e1c8e5d","leftValue":"={{ $('HTTP Request').item.json.data }}","rightValue":"fat baloons","operator":{"type":"string","operation":"equals","name":"filter.operator.equals"}}],"combinator":"and"}}]},"options":{"fallbackOutput":6}},"type":"n8n-nodes-base.switch","typeVersion":3.2,"position":[544,64],"id":"2d9798a5-1ec4-4de6-be57-984a5b3e1209","name":"Switch"},{"parameters":{"jsCode":"return {\n  cleanedText: $json[\"data\"]\n    .replace(/^journal entry[\\s\\.,-]*/i, \"\") // remove prefix (case-insensitive, plus punctuation/spaces)\n    .trim()\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[848,-176],"id":"a681bfca-e1e7-482e-b9ab-8ff124d4eefa","name":"Delete journal entry"},{"parameters":{"jsCode":"return {\n  cleanedText: $json[\"data\"]\n    .replace(/^to do[\\s\\.,-]*/i, \"\") // remove prefix (case-insensitive, plus punctuation/spaces)\n    .trim()\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[848,-32],"id":"b10c354a-c5e7-4d66-adf0-b329d9a2c1bb","name":"Delete to do"},{"parameters":{"jsCode":"return {\n  cleanedText: $json[\"data\"]\n    .replace(/^thought[\\s\\.,-]*/i, \"\") // remove prefix (case-insensitive, plus punctuation/spaces)\n    .trim()\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[848,144],"id":"fe5eddd8-ee57-440b-bd92-fa48e09e4705","name":"Delete thought"},{"parameters":{"options":{}},"type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[608,-480],"id":"546ed00b-ac0d-4671-a525-23a166f8975e","name":"Loop Over Items"},{"parameters":{"rule":{"interval":[{"field":"minutes","minutesInterval":3}]}},"type":"n8n-nodes-base.scheduleTrigger","typeVersion":1.2,"position":[-64,-192],"id":"419990f4-e61b-4170-b964-6916073e3701","name":"Schedule Trigger"},{"parameters":{"resource":"fileFolder","queryString":"voice","filter":{"folderId":{"__rl":true,"value":"1Rn8GflZsEduQjn44fTWZAyLerEhGti8F","mode":"list","cachedResultName":"samsung_recorder","cachedResultUrl":"https://drive.google.com/drive/folders/1Rn8GflZsEduQjn44fTWZAyLerEhGti8F"}},"options":{}},"type":"n8n-nodes-base.googleDrive","typeVersion":3,"position":[192,-208],"id":"102e99a6-0fc7-4fa0-802e-0a5a048b1dde","name":"Search files and folders","credentials":{"googleDriveOAuth2Api":{"id":"KUrcceziR6IJKjXk","name":"Google Drive account"}}},{"parameters":{"operation":"deleteFile","fileId":{"__rl":true,"value":"={{ $('Download file').item.json.id }}","mode":"id"},"options":{}},"type":"n8n-nodes-base.googleDrive","typeVersion":3,"position":[1264,-208],"id":"8323c827-7e04-4e65-b22e-95f0847944db","name":"Delete a file","credentials":{"googleDriveOAuth2Api":{"id":"KUrcceziR6IJKjXk","name":"Google Drive account"}}},{"parameters":{"jsCode":"return {\n  cleanedText: $json[\"data\"]\n    .replace(/^measurements[\\s\\.,-]*/i, \"\") // remove prefix (case-insensitive, plus punctuation/spaces)\n    .trim()\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[848,304],"id":"93eb8465-7225-4de7-ac8f-55d27469c0bd","name":"Delete measurements"},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"218dcbfd-8835-8008-a2bd-c164ab084ed3","mode":"list","cachedResultName":"TODO ","cachedResultUrl":"https://www.notion.so/218dcbfd88358008a2bdc164ab084ed3"},"title":"={{ $json.cleanedText }}","options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[1072,-32],"id":"a2266bd5-34ea-4ab5-b803-d855d84c76a4","name":"add to TODO","credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"234dcbfd-8835-805f-8ba9-de38ea537985","mode":"list","cachedResultName":"Thoughts","cachedResultUrl":"https://www.notion.so/234dcbfd8835805f8ba9de38ea537985"},"title":"={{ $json.cleanedText }}","options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[1072,144],"id":"b8001bdf-c957-464d-a303-8ea4a1a84316","name":"add to Thoughts","credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"modelId":{"__rl":true,"value":"models/gemini-2.5-pro","mode":"list","cachedResultName":"models/gemini-2.5-pro"},"messages":{"values":[{"content":"=Output  {{ $json.cleanedText }} as CSV with columns: Body weight, blood sugar, ketones"}]},"simplify":false,"options":{}},"type":"@n8n/n8n-nodes-langchain.googleGemini","typeVersion":1,"position":[976,464],"id":"009d110e-cce1-433b-9936-5ed82e12aeae","name":"Message a model","credentials":{"googlePalmApi":{"id":"doF6Conz8WNkWBH9","name":"Google Gemini(PaLM) Api account"}}},{"parameters":{"jsCode":"// remove leading/backtick fences if present\nconst raw = $json.candidates[0].content.parts[0].text;\nconst csv = raw\n  .replace(/```[a-z]*\\n?/gi, '')   // opening ``` or ```csv\n  .replace(/```$/,'')              // closing ```\n  .trim();\n\nconst [header, ...rows] = csv.split('\\n');\nconst columns = header.split(',');\n\nreturn rows.map(line => {\n  const values = line.split(',');\n  const obj = {};\n  columns.forEach((col, i) => {\n    let v = values[i]?.trim();\n    // if v looks like a number, convert it\n    obj[col.trim()] = isNaN(v) ? v : Number(v);\n  });\n  return obj;\n});\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[1264,432],"id":"219af822-fb0f-447a-a1a0-6ba0ef8c13e7","name":"Code"},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"26edcbfd-8835-80f3-804a-cf010f2e8796","mode":"list","cachedResultName":"messurements","cachedResultUrl":"https://www.notion.so/26edcbfd883580f3804acf010f2e8796"},"title":"={{ $now.format('M/d HH:mm') }}","simple":false,"propertiesUi":{"propertyValues":[{"key":"Ketones|number","numberValue":"={{ $json.ketones }}"},{"key":"bg|number","numberValue":"={{ $json['blood sugar'] }}"},{"key":"Weight|number","numberValue":"={{ $json['Body weight'] }}"},{"key":"Date|date","includeTime":false,"date":"={{ $now.format('M/d/y HH:mm ') }}","timezone":"Asia/Jerusalem"},{"key":"Time|rich_text","textContent":"={{ $now.format('HH:mm') }}"}]},"options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[1568,224],"id":"03712724-94cf-42f3-a708-5209c7e82f55","name":"Create a database page","credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"jsCode":"// Pull the tex\nconst input = $json.cleanedText || \"\";\n\n// Split at any of the marker phrases (case-insensitive)\nconst parts = input\n  .split(/description|when/i)\n  .map(s => s.trim().replace(/^[\\s\\p{P}]+|[\\s\\p{P}]+$/gu, ''));\n\n// Ensure we always return five keys, even if some markers are missing\nreturn {\n  part1: parts[0] || \"\",\n  part2: parts[1] || \"\",\n  part3: parts[2] || \"\",\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[928,-784],"id":"ba7657b5-9b79-4d40-bad2-cc9a469dc6fc","name":"split title/description/start/end"},{"parameters":{"modelId":{"__rl":true,"value":"models/gemini-2.5-pro","mode":"list","cachedResultName":"models/gemini-2.5-pro"},"messages":{"values":[{"content":"=now is {{ $now }}. extract from \"{{ $json.part3 }}\" 2 outputs:\n\n1. start date-time (exactly in the format \"YYYY-MM-DD hh:mm\" . ignore timezone)\n2. end date-time (exactly in the format \"YYYY-MM-DD hh:mm\" . ignore timezone)\ndo not include anything else in the output. all outputs must be of the current year."}]},"simplify":false,"options":{}},"type":"@n8n/n8n-nodes-langchain.googleGemini","typeVersion":1,"position":[1152,-784],"id":"260fd95d-5386-4b37-83f1-bdd430a1c466","name":"Message a model1","retryOnFail":true,"waitBetweenTries":2000,"maxTries":5,"credentials":{"googlePalmApi":{"id":"doF6Conz8WNkWBH9","name":"Google Gemini(PaLM) Api account"}}},{"parameters":{"jsCode":"// Input: a string like \"2024-08-03 06:00\\n2025-09-17 21:20\\n\"\nconst input = $input.first().json.candidates[0].content.parts[0].text;   // adjust the property name if different\n\nconst lines = input\n  .trim()\n  .split(\"\\n\")\n  .filter(Boolean);\n\nconst outputs = lines.map(line => {\n  const [datePart, timePart] = line.split(\" \");\n  const [year, month, day] = datePart.split(\"-\");\n  const [hour, minute] = timePart.split(\":\");\n\n  // Create a Date in UTC\n  const d = new Date(Date.UTC(\n    parseInt(year),           // year\n    parseInt(month) - 1,       // month is 0-based\n    parseInt(day),\n    parseInt(hour),\n    parseInt(minute),\n    0                          // seconds\n  ));\n\n  // Format as YYYY-MM-DDThh:mm:ssZ\n  const pad = n => n.toString().padStart(2, \"0\");\n  return `${d.getUTCFullYear()}-${pad(d.getUTCMonth()+1)}-${pad(d.getUTCDate())}T${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}:${pad(d.getUTCSeconds())}`;\n});\n\nreturn {\n  StartTime: outputs[0],\n  EndTime: outputs[1]\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[1552,-784],"id":"9f22a431-6bca-4aee-8966-b5a6682c2a08","name":"Format to standard times"},{"parameters":{"jsCode":"const start = $input.first().json.StartTime;  // e.g. 2025-09-18T09:15:00\nconst end   = $input.first().json.EndTime;    // e.g. 2025-09-18T00:07:00\n\n// ---------- Helper functions ----------\n\n// Find the date of the last Sunday of a given month (1-based)\nfunction lastSunday(year, month) {\n  // month is 1–12\n  const d = new Date(Date.UTC(year, month, 0)); // last day of month in UTC\n  const day = d.getUTCDay(); // 0 = Sunday\n  d.setUTCDate(d.getUTCDate() - day);\n  return d; // Date in UTC at 00:00\n}\n\n// Find the Friday before the last Sunday of March\nfunction fridayBeforeLastSundayOfMarch(year) {\n  const lastSun = lastSunday(year, 3); // March = 3\n  const fri = new Date(lastSun);\n  // back up until Friday (5)\n  while (fri.getUTCDay() !== 5) {\n    fri.setUTCDate(fri.getUTCDate() - 1);\n  }\n  return fri;\n}\n\n// True if the given local date (Israel) is in DST\nfunction isIsraelDST(date) {\n  const y = date.getUTCFullYear();\n  const dstStart = fridayBeforeLastSundayOfMarch(y);\n  const dstEnd   = lastSunday(y, 10); // October\n  // DST starts at 2:00 local → effectively 0:00 UTC +2 = 0:00\n  // Our check is date-only because we only care if it's between these days.\n  return date >= dstStart && date < dstEnd;\n}\n\n// Convert Israel local time to UTC string\nfunction israelLocalToUTC(str) {\n  // Accept underscores or dashes\n  const [datePart, timePart] = str.trim().split(\"T\");\n  const [y,m,d] = datePart.replace(/-/g,\"-\").split(\"-\").map(Number);\n  const [hh,mm,ss=\"0\"] = timePart.split(\":\").map(Number);\n\n  // Create a date representing that local time *as if* it were UTC,\n  // then subtract the correct offset to get true UTC.\n  const local = new Date(Date.UTC(y, m-1, d, hh, mm, ss));\n\n  const offset = isIsraelDST(local) ? 3 : 2; // hours ahead of UTC\n  local.setUTCHours(local.getUTCHours() - offset);\n\n  const pad = n => n.toString().padStart(2,\"0\");\n  return `${local.getUTCFullYear()}-${pad(local.getUTCMonth()+1)}-${pad(local.getUTCDate())}T${pad(local.getUTCHours())}:${pad(local.getUTCMinutes())}:${pad(local.getUTCSeconds())}Z`;\n}\n\n// ---------- Run ----------\nreturn {\n  start_time_utc: israelLocalToUTC(start),\n  end_time_utc:   israelLocalToUTC(end)\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[1840,-784],"id":"1e6fe4ec-3ce4-43cc-b4f3-4f58ba8c610a","name":"convert to utc"},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"228dcbfd-8835-80ab-9727-ee036d84f48e","mode":"list","cachedResultName":"Journal Entries","cachedResultUrl":"https://www.notion.so/228dcbfd883580ab9727ee036d84f48e"},"title":"={{ $('split title/description/start/end').item.json.part1 }}","simple":false,"propertiesUi":{"propertyValues":[{"key":"actual time|date","range":true,"dateStart":"={{ $json.start_time_utc }}","dateEnd":"={{ $json.end_time_utc }}","timezone":"Asia/Tel_Aviv"},{"key":"Content|rich_text","richText":true,"text":{"text":[{"text":"={{ $('split title/description/start/end').item.json.part2 }}","annotationUi":{}}]}}]},"options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[1936,-560],"id":"730c7489-7437-435c-8cb3-f0940ff8fb09","name":"Create a database page1","credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"jsCode":"return [\n  {\n    json: {\n      time1_formatted: $node[\"Format to standard times\"].json.StartTime\n        .replace(/[-:T]/g, \"\")\n        .slice(0, 12),\n\n      time2_formatted: $node[\"Format to standard times\"].json.EndTime\n        .replace(/[-:T]/g, \"\")\n        .slice(0, 12),\n\n      // here is the Notion page id\n      notion_page_id: $node[\"Create a database page1\"].json.id\n    }\n  }\n];"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[2144,-560],"id":"95dcab4c-4df4-4647-9069-c184a8e9429a","name":"Code1"},{"parameters":{"workflowId":{"__rl":true,"value":"sUvmapKEv4loeDlh","mode":"list","cachedResultName":"playground"},"workflowInputs":{"mappingMode":"defineBelow","value":{},"matchingColumns":[],"schema":[],"attemptToConvertTypes":false,"convertFieldsToString":true},"options":{"waitForSubWorkflow":true}},"type":"n8n-nodes-base.executeWorkflow","typeVersion":1.2,"position":[2384,-480],"id":"75d5d52a-6c4a-449b-b865-04ab9874b3ab","name":"Execute Workflow"},{"parameters":{"model":"llama-3.3-70b-versatile","options":{}},"type":"@n8n/n8n-nodes-langchain.lmChatGroq","typeVersion":1,"position":[2656,80],"id":"6e12a27e-9c34-4f94-867a-23eae768052d","name":"Groq Chat Model1","credentials":{"groqApi":{"id":"BcmSKnbbRuOCbcc6","name":"Groq account"}}},{"parameters":{"jsCode":"return {\n  cleanedText: $json[\"data\"]\n    .replace(/^journal entry[\\s\\.,-]*/i, \"\") // remove prefix (case-insensitive, plus punctuation/spaces)\n    .trim()\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[2704,736],"id":"e9214df8-73c2-439f-a533-a489b1bfb0f7","name":"Delete journal entry2"},{"parameters":{"jsCode":"return [{\n  json: Object.fromEntries(\n    $json.text\n      .split(/\\r?\\n|\\\\n/)        // ✅ handle real line breaks or literal \"\\n\"\n      .filter(Boolean)           // drop any empty strings\n      .map(l => l.split(/:\\s(.+)/))\n      .map(([k,v]) => [\n         k.replace(/^recommended_/,'')\n          .replace(/_([a-z])/g,(_,c)=>c.toUpperCase()),\n         v\n      ])\n  )\n}];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[3008,-96],"id":"b38012e6-6187-4863-8569-6953d2b8cf23","name":"Code2"},{"parameters":{"jsCode":"return [{\n  json: {\n    local_now: `[DateTime: ${\n      new Date().toLocaleString('sv-SE', {\n        timeZone: 'Asia/Jerusalem',   // Israel local time (+02/+03 with DST)\n        hour12: false\n      }).replace(' ', 'T')\n    }.${String(new Date().getMilliseconds()).padStart(3,'0')}+03:00]`\n  }\n}];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[3344,112],"id":"ac12499e-673b-4a50-8f6a-b4eb52c5f73e","name":"Code3"},{"parameters":{"jsCode":"const start = $input.first().json.Start_Time;  // e.g. 2025-09-18T09:15:00\nconst end   = $input.first().json.End_Time;    // e.g. 2025-09-18T00:07:00\n\n// ---------- Helper functions ----------\n\n// Find the date of the last Sunday of a given month (1-based)\nfunction lastSunday(year, month) {\n  // month is 1–12\n  const d = new Date(Date.UTC(year, month, 0)); // last day of month in UTC\n  const day = d.getUTCDay(); // 0 = Sunday\n  d.setUTCDate(d.getUTCDate() - day);\n  return d; // Date in UTC at 00:00\n}\n\n// Find the Friday before the last Sunday of March\nfunction fridayBeforeLastSundayOfMarch(year) {\n  const lastSun = lastSunday(year, 3); // March = 3\n  const fri = new Date(lastSun);\n  // back up until Friday (5)\n  while (fri.getUTCDay() !== 5) {\n    fri.setUTCDate(fri.getUTCDate() - 1);\n  }\n  return fri;\n}\n\n// True if the given local date (Israel) is in DST\nfunction isIsraelDST(date) {\n  const y = date.getUTCFullYear();\n  const dstStart = fridayBeforeLastSundayOfMarch(y);\n  const dstEnd   = lastSunday(y, 10); // October\n  // DST starts at 2:00 local → effectively 0:00 UTC +2 = 0:00\n  // Our check is date-only because we only care if it's between these days.\n  return date >= dstStart && date < dstEnd;\n}\n\n// Convert Israel local time to UTC string\nfunction israelLocalToUTC(str) {\n  // Accept underscores or dashes\n  const [datePart, timePart] = str.trim().split(\"T\");\n  const [y,m,d] = datePart.replace(/-/g,\"-\").split(\"-\").map(Number);\n  const [hh,mm,ss=\"0\"] = timePart.split(\":\").map(Number);\n\n  // Create a date representing that local time *as if* it were UTC,\n  // then subtract the correct offset to get true UTC.\n  const local = new Date(Date.UTC(y, m-1, d, hh, mm, ss));\n\n  const offset = isIsraelDST(local) ? 3 : 2; // hours ahead of UTC\n  local.setUTCHours(local.getUTCHours() - offset);\n\n  const pad = n => n.toString().padStart(2,\"0\");\n  return `${local.getUTCFullYear()}-${pad(local.getUTCMonth()+1)}-${pad(local.getUTCDate())}T${pad(local.getUTCHours())}:${pad(local.getUTCMinutes())}:${pad(local.getUTCSeconds())}Z`;\n}\n\n// ---------- Run ----------\nreturn {\n  start_time_utc: israelLocalToUTC(start),\n  end_time_utc:   israelLocalToUTC(end)\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[3232,-96],"id":"a199c09d-9c18-4698-b7cb-21b4f9d88fc0","name":"format as utc"},{"parameters":{"promptType":"define","text":"=now is {{ $now }}\n. read \"{{ $json.cleanedText }}\" and reply with 4 outputs:\n\n1. start date-time (exactly in the format \"Start_Time: YYYY-MM-DDThh:mm\" )\n2. end date-time (exactly in the format \"End_Time: YYYY-MM-DDThh:mm\" )\n3. a short title (format \"recommended_title: title\").\n4. a descrption. (format \"recommended_description: description\") \n\n\ndon't include reasoning in the output . you're output can only include start date time ,end date time,title and description, \ndo not include anything else in the output.","batching":{}},"type":"@n8n/n8n-nodes-langchain.chainLlm","typeVersion":1.7,"position":[2656,-96],"id":"cb6cc005-8a0e-4156-801c-2e8956e78995","name":"turn into vars"},{"parameters":{"operation":"deleteFile","fileId":{"__rl":true,"value":"={{ $('Download file').item.json.id }}","mode":"id"},"options":{}},"type":"n8n-nodes-base.googleDrive","typeVersion":3,"position":[336,400],"id":"13c5f255-78fb-4653-b73d-ddb86a09d1be","name":"Delete a file1","credentials":{"googleDriveOAuth2Api":{"id":"KUrcceziR6IJKjXk","name":"Google Drive account"}}},{"parameters":{"chatId":"1559527672","text":"=Your recording \"{{ $('HTTP Request').item.json.data }}\" didn't fit anywhere. Please choose manually.","replyMarkup":"inlineKeyboard","inlineKeyboard":{"rows":[{"row":{"buttons":[{"text":"Journal Entry","additionalFields":{"callback_data":"journal entry"}},{"text":"To Do","additionalFields":{"callback_data":"to do"}},{"text":"Messurements","additionalFields":{"callback_data":"messurements"}},{"text":"Thought","additionalFields":{"callback_data":"thoght"}},{"text":"Delete","additionalFields":{"callback_data":"delete"}}]}}]},"additionalFields":{}},"type":"n8n-nodes-base.telegram","typeVersion":1.2,"position":[864,672],"id":"6014c020-3fdc-4641-b56b-44e2c5506598","name":"Send \"No Fit\"","webhookId":"c9e6f23f-5e12-4391-bb6a-011a5b358c7b","credentials":{"telegramApi":{"id":"HbsIszuZLGiRpxz5","name":"Telegram account"}}}],"connections":{"Download file":{"main":[[{"node":"HTTP Request","type":"main","index":0}]]},"HTTP Request":{"main":[[{"node":"Delete a file1","type":"main","index":0}]]},"Switch":{"main":[[{"node":"Delete journal entry","type":"main","index":0}],[{"node":"Delete journal entry","type":"main","index":0}],[{"node":"Delete to do","type":"main","index":0}],[{"node":"Delete to do","type":"main","index":0}],[{"node":"Delete thought","type":"main","index":0}],[{"node":"Delete measurements","type":"main","index":0}],[{"node":"Send \"No Fit\"","type":"main","index":0}]]},"Delete journal entry":{"main":[[{"node":"turn into vars","type":"main","index":0}]]},"Delete to do":{"main":[[{"node":"add to TODO","type":"main","index":0}]]},"Delete thought":{"main":[[{"node":"add to Thoughts","type":"main","index":0}]]},"Loop Over Items":{"main":[[],[{"node":"Download file","type":"main","index":0}]]},"Schedule Trigger":{"main":[[{"node":"Search files and folders","type":"main","index":0}]]},"Search files and folders":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Delete a file":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"add to TODO":{"main":[[{"node":"Delete a file","type":"main","index":0}]]},"add to Thoughts":{"main":[[{"node":"Delete a file","type":"main","index":0}]]},"Delete measurements":{"main":[[{"node":"Message a model","type":"main","index":0}]]},"Message a model":{"main":[[{"node":"Code","type":"main","index":0}]]},"Code":{"main":[[{"node":"Create a database page","type":"main","index":0}]]},"Create a database page":{"main":[[{"node":"Delete a file","type":"main","index":0}]]},"split title/description/start/end":{"main":[[{"node":"Message a model1","type":"main","index":0}]]},"Message a model1":{"main":[[{"node":"Format to standard times","type":"main","index":0}]]},"Format to standard times":{"main":[[{"node":"convert to utc","type":"main","index":0}]]},"convert to utc":{"main":[[{"node":"Create a database page1","type":"main","index":0}]]},"Create a database page1":{"main":[[{"node":"Code1","type":"main","index":0}]]},"Code1":{"main":[[{"node":"Execute Workflow","type":"main","index":0}]]},"Execute Workflow":{"main":[[{"node":"Delete a file","type":"main","index":0}]]},"Groq Chat Model1":{"ai_languageModel":[[{"node":"turn into vars","type":"ai_languageModel","index":0}]]},"Delete journal entry2":{"main":[[]]},"Code2":{"main":[[{"node":"format as utc","type":"main","index":0}]]},"turn into vars":{"main":[[{"node":"Code2","type":"main","index":0}]]},"Delete a file1":{"main":[[{"node":"Switch","type":"main","index":0}]]}},"settings":{"executionOrder":"v1","callerPolicy":"workflowsFromSameOwner","errorWorkflow":"eT5fOtELZiLLcpbS","timeSavedPerExecution":1,"saveExecutionProgress":true,"timezone":"Asia/Jerusalem"},"staticData":{"node:Google Drive Trigger":{"lastTimeChecked":"2025-09-12T02:33:00Z"},"node:Schedule Trigger":{"recurrenceRules":[]}},"meta":{"templateCredsSetupCompleted":true},"pinData":{"Delete journal entry2":[{"json":{"cleanedText":"Prepared Keto Pizza Description I prepared a keto pizza based on flaxseed and psyllium and other flours with cheese and tomato sauce. When? start time was an hour and a haf ago and ended 5 minutes ago."}}],"HTTP Request":[{"json":{"data":" Prepared Keto Pizza Description I prepared a keto pizza based on flaxseed and psyllium and other flours with cheese and tomato sauce. When? Yesterday at 9 o'clock p.m. I started end time yesterday at 11 o'clock p.m."}}]},"versionId":"562c0af4-4bfe-498d-ac61-63e5391fef8b","triggerCount":1,"tags":[],"shared":[{"createdAt":"2025-09-22T11:17:10.370Z","updatedAt":"2025-09-22T11:17:10.370Z","role":"workflow:owner","workflowId":"SKGcnUmgxcjh32dx","projectId":"DQC8ik4pLkhZ4ZDm","project":{"createdAt":"2025-08-19T19:25:16.723Z","updatedAt":"2025-08-19T19:26:16.591Z","id":"DQC8ik4pLkhZ4ZDm","name":"Ben Hex <bhochster@gmail.com>","type":"personal","icon":null,"description":null}}]},{"createdAt":"2025-09-22T13:33:28.504Z","updatedAt":"2025-09-22T15:07:02.000Z","id":"eGK2yMVuVi3paMVD","name":"SPLIT record to notion","active":false,"isArchived":false,"nodes":[{"parameters":{"operation":"download","fileId":{"__rl":true,"value":"={{ $json.id }}","mode":"id"},"options":{"binaryPropertyName":"data"}},"type":"n8n-nodes-base.googleDrive","typeVersion":3,"position":[-64,400],"id":"16019296-96a4-4fda-8efa-058a098cdd1e","name":"Download file","credentials":{"googleDriveOAuth2Api":{"id":"KUrcceziR6IJKjXk","name":"Google Drive account"}}},{"parameters":{"method":"POST","url":"http://whisper:8000/v1/audio/transcriptions","sendBody":true,"contentType":"multipart-form-data","bodyParameters":{"parameters":[{"parameterType":"formBinaryData","name":"file","inputDataFieldName":"data"},{"name":"response_format","value":"text"},{"name":"model","value":"Systran/faster-whisper-large-v3"},{"name":"temperature","value":"0.0"},{"name":"beam_size","value":"10"},{"name":"patience","value":"1.5"},{"name":"length_penalty","value":"1.15"},{"name":"condition_on_previous_text","value":"false"},{"name":"vad_filter","value":"true"},{"name":"no_speech_threshold","value":"0.45"}]},"options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.2,"position":[112,144],"id":"721da583-2048-4363-9781-ff1166b213e3","name":"HTTP Request"},{"parameters":{"rules":{"values":[{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"leftValue":"={{ $('HTTP Request').item.json.data.toLowerCase() }}\n","rightValue":"journal entry","operator":{"type":"string","operation":"startsWith"},"id":"59c81b96-fb8f-47a6-b536-5ad0cfe8304a"}],"combinator":"and"}},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"9adfef7a-692f-4523-9d7a-588e2f763c16","leftValue":"={{ $('HTTP Request').item.json.data.toLowerCase() }}\n","rightValue":"journal item","operator":{"type":"string","operation":"startsWith"}}],"combinator":"and"}},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"3cafa00d-99b0-492f-a4d3-a5d0bf900e1d","leftValue":"={{ $('HTTP Request').item.json.data.toLowerCase() }}\n","rightValue":"to do","operator":{"type":"string","operation":"startsWith"}}],"combinator":"and"}},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"6a70091c-f310-4f81-81d9-1d9c04c6accc","leftValue":"={{ $('HTTP Request').item.json.data.toLowerCase() }}\n","rightValue":"todo","operator":{"type":"string","operation":"startsWith"}}],"combinator":"and"}},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"66ed9dca-160f-44be-965a-4db34c244c1f","leftValue":"={{ $('HTTP Request').item.json.data.toLowerCase() }}\n","rightValue":"thought","operator":{"type":"string","operation":"startsWith"}}],"combinator":"and"}},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"dbb0f538-2677-467b-81e3-317734614751","leftValue":"={{ $('HTTP Request').item.json.data.toLowerCase() }}\n","rightValue":"measurements","operator":{"type":"string","operation":"startsWith"}}],"combinator":"and"}},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"a4ad79fc-a2a5-49b1-85c0-d5ee0e1c8e5d","leftValue":"={{ $('HTTP Request').item.json.data.toLowerCase() }}\n","rightValue":"fat baloons","operator":{"type":"string","operation":"equals","name":"filter.operator.equals"}}],"combinator":"and"}}]},"options":{"fallbackOutput":6}},"type":"n8n-nodes-base.switch","typeVersion":3.2,"position":[752,64],"id":"c4d8915b-6c34-43c8-b6f1-e77f2f0b99d4","name":"Switch"},{"parameters":{"jsCode":"return {\n  cleanedText: $json[\"data\"]\n    .replace(/^to do[\\s\\.,-]*/i, \"\") // remove prefix (case-insensitive, plus punctuation/spaces)\n    .trim()\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[1120,64],"id":"0c63204c-3f65-4226-b77e-4e39bffaf353","name":"Delete to do"},{"parameters":{"jsCode":"return {\n  cleanedText: $json[\"data\"]\n    .replace(/^thought[\\s\\.,-]*/i, \"\") // remove prefix (case-insensitive, plus punctuation/spaces)\n    .trim()\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[1056,176],"id":"cd9e30b8-98aa-43bc-8a28-90c32254e161","name":"Delete thought"},{"parameters":{"options":{}},"type":"n8n-nodes-base.splitInBatches","typeVersion":3,"position":[816,-480],"id":"154d8b2a-e071-4899-8fc5-415a7a434019","name":"Loop Over Items"},{"parameters":{"rule":{"interval":[{"field":"minutes","minutesInterval":3}]}},"type":"n8n-nodes-base.scheduleTrigger","typeVersion":1.2,"position":[-48,-480],"id":"11265d29-ec68-43a7-a88d-cd9994aba227","name":"Schedule Trigger"},{"parameters":{"resource":"fileFolder","queryString":"voice","filter":{"folderId":{"__rl":true,"value":"1Rn8GflZsEduQjn44fTWZAyLerEhGti8F","mode":"list","cachedResultName":"samsung_recorder","cachedResultUrl":"https://drive.google.com/drive/folders/1Rn8GflZsEduQjn44fTWZAyLerEhGti8F"}},"options":{}},"type":"n8n-nodes-base.googleDrive","typeVersion":3,"position":[272,-480],"id":"a7057ccb-8c80-46c4-b597-653703568f46","name":"Search files and folders","credentials":{"googleDriveOAuth2Api":{"id":"KUrcceziR6IJKjXk","name":"Google Drive account"}}},{"parameters":{"operation":"deleteFile","fileId":{"__rl":true,"value":"={{ $('Download file').item.json.id }}","mode":"id"},"options":{}},"type":"n8n-nodes-base.googleDrive","typeVersion":3,"position":[2096,-240],"id":"10553231-de40-4a7c-9860-be057c42aa01","name":"Delete a file","credentials":{"googleDriveOAuth2Api":{"id":"KUrcceziR6IJKjXk","name":"Google Drive account"}}},{"parameters":{"jsCode":"return {\n  cleanedText: $json[\"data\"]\n    .replace(/^measurements[\\s\\.,-]*/i, \"\") // remove prefix (case-insensitive, plus punctuation/spaces)\n    .trim()\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[1056,304],"id":"9f9df5a6-764f-4221-a513-254455e64c9a","name":"Delete measurements"},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"218dcbfd-8835-8008-a2bd-c164ab084ed3","mode":"list","cachedResultName":"TODO ","cachedResultUrl":"https://www.notion.so/218dcbfd88358008a2bdc164ab084ed3"},"title":"={{ $json.cleanedText }}","options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[1280,-32],"id":"602cceb0-1400-43f4-ae23-ac49c673627e","name":"add to TODO","credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"234dcbfd-8835-805f-8ba9-de38ea537985","mode":"list","cachedResultName":"Thoughts","cachedResultUrl":"https://www.notion.so/234dcbfd8835805f8ba9de38ea537985"},"title":"={{ $json.cleanedText }}","options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[1264,224],"id":"e671b7c6-e170-49f2-954f-82bd246903a2","name":"add to Thoughts","credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"modelId":{"__rl":true,"value":"models/gemini-2.5-pro","mode":"list","cachedResultName":"models/gemini-2.5-pro"},"messages":{"values":[{"content":"=Output  {{ $json.cleanedText }} as CSV with columns: Body weight, blood sugar, ketones"}]},"simplify":false,"options":{}},"type":"@n8n/n8n-nodes-langchain.googleGemini","typeVersion":1,"position":[1184,464],"id":"a5a904c2-89e6-4a7b-8c75-6e3f2a2efea3","name":"Message a model","credentials":{"googlePalmApi":{"id":"doF6Conz8WNkWBH9","name":"Google Gemini(PaLM) Api account"}}},{"parameters":{"jsCode":"// remove leading/backtick fences if present\nconst raw = $json.candidates[0].content.parts[0].text;\nconst csv = raw\n  .replace(/```[a-z]*\\n?/gi, '')   // opening ``` or ```csv\n  .replace(/```$/,'')              // closing ```\n  .trim();\n\nconst [header, ...rows] = csv.split('\\n');\nconst columns = header.split(',');\n\nreturn rows.map(line => {\n  const values = line.split(',');\n  const obj = {};\n  columns.forEach((col, i) => {\n    let v = values[i]?.trim();\n    // if v looks like a number, convert it\n    obj[col.trim()] = isNaN(v) ? v : Number(v);\n  });\n  return obj;\n});\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[1472,432],"id":"c1df2d0c-eaf8-4bd9-bc19-1f6d9aa767d9","name":"Code"},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"26edcbfd-8835-80f3-804a-cf010f2e8796","mode":"list","cachedResultName":"messurements","cachedResultUrl":"https://www.notion.so/26edcbfd883580f3804acf010f2e8796"},"title":"={{ $now.format('M/d HH:mm') }}","simple":false,"propertiesUi":{"propertyValues":[{"key":"Ketones|number","numberValue":"={{ $json.ketones }}"},{"key":"bg|number","numberValue":"={{ $json['blood sugar'] }}"},{"key":"Weight|number","numberValue":"={{ $json['Body weight'] }}"},{"key":"Date|date","includeTime":false,"date":"={{ $now.format('M/d/y HH:mm ') }}","timezone":"Asia/Jerusalem"},{"key":"Time|rich_text","textContent":"={{ $now.format('HH:mm') }}"}]},"options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[1776,224],"id":"e27542b9-1f93-4611-bcd7-79b24dd90e10","name":"Create a database page","credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"jsCode":"// Pull the tex\nconst input = $json.cleanedText || \"\";\n\n// Split at any of the marker phrases (case-insensitive)\nconst parts = input\n  .split(/description|when/i)\n  .map(s => s.trim().replace(/^[\\s\\p{P}]+|[\\s\\p{P}]+$/gu, ''));\n\n// Ensure we always return five keys, even if some markers are missing\nreturn {\n  part1: parts[0] || \"\",\n  part2: parts[1] || \"\",\n  part3: parts[2] || \"\",\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[928,-784],"id":"19c307b4-2216-482a-81d4-2f4018c0ec2c","name":"split title/description/start/end"},{"parameters":{"modelId":{"__rl":true,"value":"models/gemini-2.5-pro","mode":"list","cachedResultName":"models/gemini-2.5-pro"},"messages":{"values":[{"content":"=now is {{ $now }}. extract from \"{{ $json.part3 }}\" 2 outputs:\n\n1. start date-time (exactly in the format \"YYYY-MM-DD hh:mm\" . ignore timezone)\n2. end date-time (exactly in the format \"YYYY-MM-DD hh:mm\" . ignore timezone)\ndo not include anything else in the output. all outputs must be of the current year."}]},"simplify":false,"options":{}},"type":"@n8n/n8n-nodes-langchain.googleGemini","typeVersion":1,"position":[1152,-784],"id":"2296716e-1ffd-4cb4-a817-496896f91e9f","name":"Message a model1","retryOnFail":true,"waitBetweenTries":2000,"maxTries":5,"credentials":{"googlePalmApi":{"id":"doF6Conz8WNkWBH9","name":"Google Gemini(PaLM) Api account"}}},{"parameters":{"jsCode":"// Input: a string like \"2024-08-03 06:00\\n2025-09-17 21:20\\n\"\nconst input = $input.first().json.candidates[0].content.parts[0].text;   // adjust the property name if different\n\nconst lines = input\n  .trim()\n  .split(\"\\n\")\n  .filter(Boolean);\n\nconst outputs = lines.map(line => {\n  const [datePart, timePart] = line.split(\" \");\n  const [year, month, day] = datePart.split(\"-\");\n  const [hour, minute] = timePart.split(\":\");\n\n  // Create a Date in UTC\n  const d = new Date(Date.UTC(\n    parseInt(year),           // year\n    parseInt(month) - 1,       // month is 0-based\n    parseInt(day),\n    parseInt(hour),\n    parseInt(minute),\n    0                          // seconds\n  ));\n\n  // Format as YYYY-MM-DDThh:mm:ssZ\n  const pad = n => n.toString().padStart(2, \"0\");\n  return `${d.getUTCFullYear()}-${pad(d.getUTCMonth()+1)}-${pad(d.getUTCDate())}T${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}:${pad(d.getUTCSeconds())}`;\n});\n\nreturn {\n  StartTime: outputs[0],\n  EndTime: outputs[1]\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[1552,-784],"id":"35e398cb-7831-4f65-8c52-0eaa9adb730c","name":"Format to standard times"},{"parameters":{"jsCode":"const start = $input.first().json.StartTime;  // e.g. 2025-09-18T09:15:00\nconst end   = $input.first().json.EndTime;    // e.g. 2025-09-18T00:07:00\n\n// ---------- Helper functions ----------\n\n// Find the date of the last Sunday of a given month (1-based)\nfunction lastSunday(year, month) {\n  // month is 1–12\n  const d = new Date(Date.UTC(year, month, 0)); // last day of month in UTC\n  const day = d.getUTCDay(); // 0 = Sunday\n  d.setUTCDate(d.getUTCDate() - day);\n  return d; // Date in UTC at 00:00\n}\n\n// Find the Friday before the last Sunday of March\nfunction fridayBeforeLastSundayOfMarch(year) {\n  const lastSun = lastSunday(year, 3); // March = 3\n  const fri = new Date(lastSun);\n  // back up until Friday (5)\n  while (fri.getUTCDay() !== 5) {\n    fri.setUTCDate(fri.getUTCDate() - 1);\n  }\n  return fri;\n}\n\n// True if the given local date (Israel) is in DST\nfunction isIsraelDST(date) {\n  const y = date.getUTCFullYear();\n  const dstStart = fridayBeforeLastSundayOfMarch(y);\n  const dstEnd   = lastSunday(y, 10); // October\n  // DST starts at 2:00 local → effectively 0:00 UTC +2 = 0:00\n  // Our check is date-only because we only care if it's between these days.\n  return date >= dstStart && date < dstEnd;\n}\n\n// Convert Israel local time to UTC string\nfunction israelLocalToUTC(str) {\n  // Accept underscores or dashes\n  const [datePart, timePart] = str.trim().split(\"T\");\n  const [y,m,d] = datePart.replace(/-/g,\"-\").split(\"-\").map(Number);\n  const [hh,mm,ss=\"0\"] = timePart.split(\":\").map(Number);\n\n  // Create a date representing that local time *as if* it were UTC,\n  // then subtract the correct offset to get true UTC.\n  const local = new Date(Date.UTC(y, m-1, d, hh, mm, ss));\n\n  const offset = isIsraelDST(local) ? 3 : 2; // hours ahead of UTC\n  local.setUTCHours(local.getUTCHours() - offset);\n\n  const pad = n => n.toString().padStart(2,\"0\");\n  return `${local.getUTCFullYear()}-${pad(local.getUTCMonth()+1)}-${pad(local.getUTCDate())}T${pad(local.getUTCHours())}:${pad(local.getUTCMinutes())}:${pad(local.getUTCSeconds())}Z`;\n}\n\n// ---------- Run ----------\nreturn {\n  start_time_utc: israelLocalToUTC(start),\n  end_time_utc:   israelLocalToUTC(end)\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[1840,-784],"id":"b44598b2-1003-47ec-bce3-641496039019","name":"convert to utc"},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"228dcbfd-8835-80ab-9727-ee036d84f48e","mode":"list","cachedResultName":"Journal Entries","cachedResultUrl":"https://www.notion.so/228dcbfd883580ab9727ee036d84f48e"},"title":"={{ $('split title/description/start/end').item.json.part1 }}","simple":false,"propertiesUi":{"propertyValues":[{"key":"actual time|date","range":true,"dateStart":"={{ $json.start_time_utc }}","dateEnd":"={{ $json.end_time_utc }}","timezone":"Asia/Tel_Aviv"},{"key":"Content|rich_text","richText":true,"text":{"text":[{"text":"={{ $('split title/description/start/end').item.json.part2 }}","annotationUi":{}}]}}]},"options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[2000,-576],"id":"6f1a2abc-fe82-4451-aa41-f67743daa2bf","name":"Create a database page1","credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"jsCode":"return [\n  {\n    json: {\n      time1_formatted: $node[\"Format to standard times\"].json.StartTime\n        .replace(/[-:T]/g, \"\")\n        .slice(0, 12),\n\n      time2_formatted: $node[\"Format to standard times\"].json.EndTime\n        .replace(/[-:T]/g, \"\")\n        .slice(0, 12),\n\n      // here is the Notion page id\n      notion_page_id: $node[\"Create a database page1\"].json.id\n    }\n  }\n];"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[2416,-720],"id":"9545f583-d9c0-45df-85d2-cd7e551a2f44","name":"Code1"},{"parameters":{"workflowId":{"__rl":true,"value":"sUvmapKEv4loeDlh","mode":"list","cachedResultName":"playground"},"workflowInputs":{"mappingMode":"defineBelow","value":{},"matchingColumns":[],"schema":[],"attemptToConvertTypes":false,"convertFieldsToString":true},"options":{"waitForSubWorkflow":true}},"type":"n8n-nodes-base.executeWorkflow","typeVersion":1.2,"position":[2384,-480],"id":"02237429-3b3f-4db0-b7bc-fb52f2856b43","name":"Execute Workflow"},{"parameters":{"jsCode":"return {\n  cleanedText: $json[\"data\"]\n    .replace(/^journal entry[\\s\\.,-]*/i, \"\") // remove prefix (case-insensitive, plus punctuation/spaces)\n    .trim()\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[2704,736],"id":"0e6737e1-3922-44b2-840a-595a7fd91c58","name":"Delete journal entry2"},{"parameters":{"jsCode":"return [{\n  json: {\n    local_now: `[DateTime: ${\n      new Date().toLocaleString('sv-SE', {\n        timeZone: 'Asia/Jerusalem',   // Israel local time (+02/+03 with DST)\n        hour12: false\n      }).replace(' ', 'T')\n    }.${String(new Date().getMilliseconds()).padStart(3,'0')}+03:00]`\n  }\n}];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[3344,112],"id":"7158fa50-92bc-49e9-ae1a-dfc4c8a53469","name":"Code3"},{"parameters":{"operation":"deleteFile","fileId":{"__rl":true,"value":"={{ $('Download file').item.json.id }}","mode":"id"},"options":{}},"type":"n8n-nodes-base.googleDrive","typeVersion":3,"position":[336,400],"id":"6b23e058-59ed-4f53-bc38-9a73e66c2e39","name":"Delete a file1","credentials":{"googleDriveOAuth2Api":{"id":"KUrcceziR6IJKjXk","name":"Google Drive account"}}},{"parameters":{"chatId":"1559527672","text":"=Your recording {{ $('Download file').item.json.name }} produced this:\n\"{{ $('HTTP Request').item.json.data }}\" \nIt didn't fit anywhere. Please choose manually.","replyMarkup":"inlineKeyboard","inlineKeyboard":{"rows":[{"row":{"buttons":[{"text":"Journal Entry","additionalFields":{"callback_data":"journal entry"}},{"text":"To Do","additionalFields":{"callback_data":"to do"}},{"text":"Messurements","additionalFields":{"callback_data":"messurements"}},{"text":"Thought","additionalFields":{"callback_data":"thoght"}},{"text":"Delete","additionalFields":{"callback_data":"delete"}}]}}]},"additionalFields":{}},"type":"n8n-nodes-base.telegram","typeVersion":1.2,"position":[1072,672],"id":"308596ee-d5f1-476a-892e-7c9da6c33cdd","name":"Send \"No Fit\"","webhookId":"16718d81-f3f4-4743-a7d2-2192899e31e7","credentials":{"telegramApi":{"id":"HbsIszuZLGiRpxz5","name":"Telegram account"}}},{"parameters":{"workflowId":{"__rl":true,"value":"d7pxYorZidMv7pN3","mode":"list","cachedResultName":"Journal Entry"},"workflowInputs":{"mappingMode":"defineBelow","value":{"data":"={{ $('HTTP Request').item.json.data }}"},"matchingColumns":["data"],"schema":[{"id":"data","displayName":"data","required":false,"defaultMatch":false,"display":true,"canBeUsedToMatch":true,"removed":false}],"attemptToConvertTypes":false,"convertFieldsToString":true},"options":{"waitForSubWorkflow":true}},"type":"n8n-nodes-base.executeWorkflow","typeVersion":1.2,"position":[592,-256],"id":"79e0cf18-f210-4929-aed6-2441173d29a3","name":"Execute Workflow1"}],"connections":{"Download file":{"main":[[{"node":"HTTP Request","type":"main","index":0}]]},"HTTP Request":{"main":[[{"node":"Delete a file1","type":"main","index":0}]]},"Switch":{"main":[[{"node":"Execute Workflow1","type":"main","index":0}],[{"node":"Execute Workflow1","type":"main","index":0}],[{"node":"Delete to do","type":"main","index":0}],[{"node":"Delete to do","type":"main","index":0}],[{"node":"Delete thought","type":"main","index":0}],[{"node":"Delete measurements","type":"main","index":0}],[{"node":"Send \"No Fit\"","type":"main","index":0}]]},"Delete to do":{"main":[[{"node":"add to TODO","type":"main","index":0}]]},"Delete thought":{"main":[[{"node":"add to Thoughts","type":"main","index":0}]]},"Loop Over Items":{"main":[[],[{"node":"Download file","type":"main","index":0}]]},"Schedule Trigger":{"main":[[{"node":"Search files and folders","type":"main","index":0}]]},"Search files and folders":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Delete a file":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"add to TODO":{"main":[[{"node":"Delete a file","type":"main","index":0}]]},"add to Thoughts":{"main":[[{"node":"Delete a file","type":"main","index":0}]]},"Delete measurements":{"main":[[{"node":"Message a model","type":"main","index":0}]]},"Message a model":{"main":[[{"node":"Code","type":"main","index":0}]]},"Code":{"main":[[{"node":"Create a database page","type":"main","index":0}]]},"Create a database page":{"main":[[{"node":"Delete a file","type":"main","index":0}]]},"split title/description/start/end":{"main":[[{"node":"Message a model1","type":"main","index":0}]]},"Message a model1":{"main":[[{"node":"Format to standard times","type":"main","index":0}]]},"Format to standard times":{"main":[[{"node":"convert to utc","type":"main","index":0}]]},"convert to utc":{"main":[[{"node":"Create a database page1","type":"main","index":0}]]},"Create a database page1":{"main":[[{"node":"Code1","type":"main","index":0}]]},"Code1":{"main":[[{"node":"Execute Workflow","type":"main","index":0}]]},"Execute Workflow":{"main":[[{"node":"Delete a file","type":"main","index":0}]]},"Delete journal entry2":{"main":[[]]},"Delete a file1":{"main":[[{"node":"Switch","type":"main","index":0}]]}},"settings":{"executionOrder":"v1","callerPolicy":"workflowsFromSameOwner","errorWorkflow":"eT5fOtELZiLLcpbS","timeSavedPerExecution":1,"saveExecutionProgress":true,"timezone":"Asia/Jerusalem"},"staticData":{"node:Google Drive Trigger":{"lastTimeChecked":"2025-09-12T02:33:00Z"},"node:Schedule Trigger":{"recurrenceRules":[]}},"meta":{"templateCredsSetupCompleted":true},"pinData":{"Delete journal entry2":[{"json":{"cleanedText":"Prepared Keto Pizza Description I prepared a keto pizza based on flaxseed and psyllium and other flours with cheese and tomato sauce. When? start time was an hour and a haf ago and ended 5 minutes ago."}}]},"versionId":"c1e1d836-ef7c-46cf-ac1d-5ba51043555a","triggerCount":1,"tags":[],"shared":[{"createdAt":"2025-09-22T13:33:28.509Z","updatedAt":"2025-09-22T13:33:28.509Z","role":"workflow:owner","workflowId":"eGK2yMVuVi3paMVD","projectId":"DQC8ik4pLkhZ4ZDm","project":{"createdAt":"2025-08-19T19:25:16.723Z","updatedAt":"2025-08-19T19:26:16.591Z","id":"DQC8ik4pLkhZ4ZDm","name":"Ben Hex <bhochster@gmail.com>","type":"personal","icon":null,"description":null}}]},{"createdAt":"2025-09-22T13:56:20.211Z","updatedAt":"2025-09-24T16:10:24.000Z","id":"d7pxYorZidMv7pN3","name":"Journal Entry","active":false,"isArchived":false,"nodes":[{"parameters":{"workflowInputs":{"values":[{"name":"data","type":"any"}]}},"type":"n8n-nodes-base.executeWorkflowTrigger","typeVersion":1.1,"position":[1408,48],"id":"34f2b59d-9e35-4e7d-9697-8f03577e1078","name":"When Executed by Another Workflow"},{"parameters":{"jsCode":"return {\n  cleanedText: $json[\"data\"]\n    .replace(/^journal entry[\\s\\.,-]*/i, \"\") // remove prefix (case-insensitive, plus punctuation/spaces)\n    .trim()\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[1792,48],"id":"147e3504-f2e2-48be-b2ae-2451a30e19b7","name":"Delete journal entry"},{"parameters":{"model":"llama-3.3-70b-versatile","options":{}},"type":"@n8n/n8n-nodes-langchain.lmChatGroq","typeVersion":1,"position":[2112,240],"id":"9248634d-f9e9-4ff3-b044-11459e3510ad","name":"Groq Chat Model1","credentials":{"groqApi":{"id":"BcmSKnbbRuOCbcc6","name":"Groq account"}}},{"parameters":{"jsCode":"const start = $input.first().json.Start_Time;  // e.g. 2025-09-18T09:15:00\nconst end   = $input.first().json.End_Time;    // e.g. 2025-09-18T00:07:00\n\n// ---------- Helper functions ----------\n\n// Find the date of the last Sunday of a given month (1-based)\nfunction lastSunday(year, month) {\n  // month is 1–12\n  const d = new Date(Date.UTC(year, month, 0)); // last day of month in UTC\n  const day = d.getUTCDay(); // 0 = Sunday\n  d.setUTCDate(d.getUTCDate() - day);\n  return d; // Date in UTC at 00:00\n}\n\n// Find the Friday before the last Sunday of March\nfunction fridayBeforeLastSundayOfMarch(year) {\n  const lastSun = lastSunday(year, 3); // March = 3\n  const fri = new Date(lastSun);\n  // back up until Friday (5)\n  while (fri.getUTCDay() !== 5) {\n    fri.setUTCDate(fri.getUTCDate() - 1);\n  }\n  return fri;\n}\n\n// True if the given local date (Israel) is in DST\nfunction isIsraelDST(date) {\n  const y = date.getUTCFullYear();\n  const dstStart = fridayBeforeLastSundayOfMarch(y);\n  const dstEnd   = lastSunday(y, 10); // October\n  // DST starts at 2:00 local → effectively 0:00 UTC +2 = 0:00\n  // Our check is date-only because we only care if it's between these days.\n  return date >= dstStart && date < dstEnd;\n}\n\n// Convert Israel local time to UTC string\nfunction israelLocalToUTC(str) {\n  // Accept underscores or dashes\n  const [datePart, timePart] = str.trim().split(\"T\");\n  const [y,m,d] = datePart.replace(/-/g,\"-\").split(\"-\").map(Number);\n  const [hh,mm,ss=\"0\"] = timePart.split(\":\").map(Number);\n\n  // Create a date representing that local time *as if* it were UTC,\n  // then subtract the correct offset to get true UTC.\n  const local = new Date(Date.UTC(y, m-1, d, hh, mm, ss));\n\n  const offset = isIsraelDST(local) ? 3 : 2; // hours ahead of UTC\n  local.setUTCHours(local.getUTCHours() - offset);\n\n  const pad = n => n.toString().padStart(2,\"0\");\n  return `${local.getUTCFullYear()}-${pad(local.getUTCMonth()+1)}-${pad(local.getUTCDate())}T${pad(local.getUTCHours())}:${pad(local.getUTCMinutes())}:${pad(local.getUTCSeconds())}Z`;\n}\n\n// ---------- Run ----------\nreturn {\n  start_time_utc: israelLocalToUTC(start),\n  end_time_utc:   israelLocalToUTC(end)\n};\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[2688,48],"id":"e0b6b485-0608-4b3d-9014-435bc67207b1","name":"format as utc"},{"parameters":{"promptType":"define","text":"=now is {{ $now }} keep in mind that the year is always current year.\n. read \"{{ $json.cleanedText }}\" and reply with 4 outputs:\n\n1. start date-time (exactly in the format \"Start_Time: YYYY-MM-DDThh:mm\" )\n2. end date-time (exactly in the format \"End_Time: YYYY-MM-DDThh:mm\" )\n3. a short title (format \"recommended_title: title\").\n4. a descrption. (format \"recommended_description: description\") \n\n\ndon't include reasoning in the output . you're output can only include start date time ,end date time,title and description, \ndo not include anything else in the output.","batching":{}},"type":"@n8n/n8n-nodes-langchain.chainLlm","typeVersion":1.7,"position":[2096,48],"id":"061bbf70-d287-42e2-879d-89f69f5117ad","name":"turn into vars"},{"parameters":{"jsCode":"return [{\n  json: Object.fromEntries(\n    $json.text\n      .split(/\\r?\\n|\\\\n/)        // ✅ handle real line breaks or literal \"\\n\"\n      .filter(Boolean)           // drop any empty strings\n      .map(l => l.split(/:\\s(.+)/))\n      .map(([k,v]) => [\n         k.replace(/^recommended_/,'')\n          .replace(/_([a-z])/g,(_,c)=>c.toUpperCase()),\n         v\n      ])\n  )\n}];\n"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[2464,48],"id":"b2137577-2e61-4b42-8980-901643a6cdef","name":"split to vars"},{"parameters":{"resource":"databasePage","databaseId":{"__rl":true,"value":"228dcbfd-8835-80ab-9727-ee036d84f48e","mode":"list","cachedResultName":"Journal Entries","cachedResultUrl":"https://www.notion.so/228dcbfd883580ab9727ee036d84f48e"},"title":"={{ $('split to vars').item.json.title }}","simple":false,"propertiesUi":{"propertyValues":[{"key":"actual time|date","range":true,"dateStart":"={{ $json.start_time_utc }}","dateEnd":"={{ $json.end_time_utc }}","timezone":"Asia/Tel_Aviv"},{"key":"Content|rich_text","richText":true,"text":{"text":[{"text":"={{ $('split to vars').item.json.description }}","annotationUi":{}}]}}]},"options":{}},"type":"n8n-nodes-base.notion","typeVersion":2.2,"position":[2688,256],"id":"8c939059-1d2d-42b6-9054-c7165a0decdd","name":"Create a database page1","credentials":{"notionApi":{"id":"pzgOPbiXdTOEWf01","name":"Notion account"}}},{"parameters":{"content":"## Deletes the words journal entry ##","height":256},"type":"n8n-nodes-base.stickyNote","position":[1728,-48],"typeVersion":1,"id":"738c43b2-2930-4725-9757-8d5fb49a331f","name":"Sticky Note"},{"parameters":{"content":"## AI returns title descriptions and time range","height":288,"width":256},"type":"n8n-nodes-base.stickyNote","position":[2080,-80],"typeVersion":1,"id":"d912138f-39e0-40d8-a453-d1694c35623f","name":"Sticky Note1"},{"parameters":{"workflowId":{"__rl":true,"value":"sUvmapKEv4loeDlh","mode":"list","cachedResultName":"playground"},"workflowInputs":{"mappingMode":"defineBelow","value":{"NotionTitle":"={{ $json.properties.Title.title[0].text.content }}","Notion_page_id":"={{ $json.id }}","start_time":"={{ $('split to vars').item.json.Start_Time }}","end_time":"={{ $('split to vars').item.json.End_Time }}"},"matchingColumns":[],"schema":[{"id":"Notion_page_id","displayName":"Notion_page_id","required":false,"defaultMatch":false,"display":true,"canBeUsedToMatch":true,"type":"string"},{"id":"start_time","displayName":"start_time","required":false,"defaultMatch":false,"display":true,"canBeUsedToMatch":true,"type":"string"},{"id":"end_time","displayName":"end_time","required":false,"defaultMatch":false,"display":true,"canBeUsedToMatch":true,"type":"string"},{"id":"NotionTitle","displayName":"NotionTitle","required":false,"defaultMatch":false,"display":true,"canBeUsedToMatch":true,"type":"string"}],"attemptToConvertTypes":false,"convertFieldsToString":true},"options":{}},"type":"n8n-nodes-base.executeWorkflow","typeVersion":1.2,"position":[2896,256],"id":"e31fd79a-946c-4c43-9be8-fda25b21aa5a","name":"Execute Workflow1"}],"connections":{"Delete journal entry":{"main":[[{"node":"turn into vars","type":"main","index":0}]]},"Groq Chat Model1":{"ai_languageModel":[[{"node":"turn into vars","type":"ai_languageModel","index":0}]]},"turn into vars":{"main":[[{"node":"split to vars","type":"main","index":0}]]},"When Executed by Another Workflow":{"main":[[{"node":"Delete journal entry","type":"main","index":0}]]},"split to vars":{"main":[[{"node":"format as utc","type":"main","index":0}]]},"format as utc":{"main":[[{"node":"Create a database page1","type":"main","index":0}]]},"Create a database page1":{"main":[[{"node":"Execute Workflow1","type":"main","index":0}]]}},"settings":{"executionOrder":"v1","timezone":"Asia/Jerusalem","callerPolicy":"workflowsFromSameOwner"},"staticData":null,"meta":null,"pinData":{"When Executed by Another Workflow":[{"json":{"data":"Journal entry. I'm testing this workflow. Description. I'm trying to create a workflow for this case that will be a stand-alone sub-workflow in N8N. When I started at 9:28 a.m. on september 21st, and I ended 7 hours later."}}]},"versionId":"a772707c-a16f-4b0f-97a2-d5d924dc55a0","triggerCount":0,"tags":[],"shared":[{"createdAt":"2025-09-22T13:56:20.214Z","updatedAt":"2025-09-22T13:56:20.214Z","role":"workflow:owner","workflowId":"d7pxYorZidMv7pN3","projectId":"DQC8ik4pLkhZ4ZDm","project":{"createdAt":"2025-08-19T19:25:16.723Z","updatedAt":"2025-08-19T19:26:16.591Z","id":"DQC8ik4pLkhZ4ZDm","name":"Ben Hex <bhochster@gmail.com>","type":"personal","icon":null,"description":null}}]},{"createdAt":"2025-09-26T09:52:07.680Z","updatedAt":"2025-09-26T09:52:07.680Z","id":"TS0aMPPiFVAjo24i","name":"My workflow 16","active":false,"isArchived":false,"nodes":[{"parameters":{},"id":"21404416-aac9-42e4-8b64-1d5e0794729b","name":"Manual Trigger","type":"n8n-nodes-base.manualTrigger","typeVersion":1,"position":[-416,144]},{"parameters":{"command":"n8n export:workflow --all --output /data/workflows.json && n8n export:credentials --all --output /data/credentials.json"},"id":"d84edf32-179e-45f3-937e-4a9a07526abc","name":"Export Workflows & Credentials","type":"n8n-nodes-base.executeCommand","typeVersion":1,"position":[-160,160]},{"parameters":{"filePath":"/data/workflows.json"},"id":"9e6efa37-b8a6-4699-9fe7-6652ac3bc396","name":"Read workflows.json","type":"n8n-nodes-base.readBinaryFile","typeVersion":1,"position":[128,80]},{"parameters":{"filePath":"/data/credentials.json"},"id":"e6ac3dec-185d-4462-a79c-f0c287baf8c7","name":"Read credentials.json","type":"n8n-nodes-base.readBinaryFile","typeVersion":1,"position":[640,32]},{"parameters":{"binaryData":true,"name":"Workflows","options":{}},"id":"ab417457-e39c-4d93-b417-2f713b94f275","name":"Upload workflows.json","type":"n8n-nodes-base.googleDrive","typeVersion":2,"position":[432,48],"credentials":{"googleDriveOAuth2Api":{"id":"KUrcceziR6IJKjXk","name":"Google Drive account"}}},{"parameters":{"binaryData":true,"options":{}},"id":"ea9f9d28-d732-4e2f-bfeb-8b96c502e50b","name":"Upload credentials.json","type":"n8n-nodes-base.googleDrive","typeVersion":2,"position":[656,256],"credentials":{"googleDriveOAuth2Api":{"id":"KUrcceziR6IJKjXk","name":"Google Drive account"}}}],"connections":{"Manual Trigger":{"main":[[{"node":"Export Workflows & Credentials","type":"main","index":0}]]},"Export Workflows & Credentials":{"main":[[{"node":"Read workflows.json","type":"main","index":0}]]},"Read workflows.json":{"main":[[{"node":"Upload workflows.json","type":"main","index":0}]]},"Read credentials.json":{"main":[[{"node":"Upload credentials.json","type":"main","index":0}]]},"Upload workflows.json":{"main":[[{"node":"Read credentials.json","type":"main","index":0}]]}},"settings":{"executionOrder":"v1"},"staticData":null,"meta":null,"pinData":{},"versionId":"33e9e1e5-fd3f-4e5b-b830-59efc5c73950","triggerCount":0,"tags":[],"shared":[{"createdAt":"2025-09-26T09:52:07.685Z","updatedAt":"2025-09-26T09:52:07.685Z","role":"workflow:owner","workflowId":"TS0aMPPiFVAjo24i","projectId":"DQC8ik4pLkhZ4ZDm","project":{"createdAt":"2025-08-19T19:25:16.723Z","updatedAt":"2025-08-19T19:26:16.591Z","id":"DQC8ik4pLkhZ4ZDm","name":"Ben Hex <bhochster@gmail.com>","type":"personal","icon":null,"description":null}}]}]