Task: Sync Clockify to Google Calendar

n8n workflow JSON:
{"nodes":[{"name":"Clockify Trigger","type":"n8n-nodes-base.clockifyTrigger","position":[-720,-240],"parameters":{"pollTimes":{"item":[{"hour":3}]}},"credentials":{"clockifyApi":{"id":"3","name":"Clockify account"}},"retryOnFail":false,"typeVersion":1},{"name":"Get Events with ID + loop_id","type":"n8n-nodes-base.googleCalendar","position":[1140,-700],"parameters":{"eventId":"=clocki{{$json[\"clockify\"][\"id\"]}}{{$json[\"loop_id\"]}}","options":{},"calendar":"={{$node[\"Get Events with ID\"].parameter[\"calendar\"]}}","operation":"get"},"credentials":{"googleCalendarOAuth2Api":{"id":"2","name":"Google Calendar"}},"typeVersion":1,"continueOnFail":true},{"name":"Get Events with ID","type":"n8n-nodes-base.googleCalendar","position":[-160,-240],"parameters":{"eventId":"=clocki{{$json[\"id\"]}}","options":{},"operation":"get"},"credentials":{"googleCalendarOAuth2Api":{"id":"2","name":"Google Calendar"}},"typeVersion":1,"continueOnFail":true},{"name":"Create Event","type":"n8n-nodes-base.googleCalendar","position":[680,-160],"parameters":{"end":"={{$json[\"clockify\"][\"timeInterval\"][\"end\"]}}","start":"={{$json[\"clockify\"][\"timeInterval\"][\"start\"]}}","calendar":"={{$node[\"Get Events with ID\"].parameter[\"calendar\"]}}","additionalFields":{"id":"=clocki{{$json[\"clockify\"][\"id\"]}}","summary":"={{$node[\"Config\"].json[\"calendar_entry\"][\"prefix\"] ? $node[\"Config\"].json[\"calendar_entry\"][\"prefix\"]+': ' : ''}}{{$json[\"clockify\"][\"project\"][\"name\"] ? $json[\"clockify\"][\"project\"][\"name\"] : ''}} {{$json[\"clockify\"][\"task\"] ? '- ' + $json[\"clockify\"][\"task\"][\"name\"] : ''}} {{$json[\"clockify\"][\"description\"] ? ': ' + $json[\"clockify\"][\"description\"] : ' '}}","description":"={{$node[\"Translations for created Calendar Event\"].json[\"clockify\"][\"client\"]}}: {{$json[\"clockify\"][\"project\"][\"name\"] ? $json[\"clockify\"][\"project\"][\"clientName\"] : ' '}}\n{{$node[\"Translations for created Calendar Event\"].json[\"clockify\"][\"project\"]}}: {{$json[\"clockify\"][\"project\"][\"name\"] ? $json[\"clockify\"][\"project\"][\"name\"] : ' '}}\n{{$node[\"Translations for created Calendar Event\"].json[\"clockify\"][\"task\"]}}: {{$json[\"clockify\"][\"task\"] ? $json[\"clockify\"][\"task\"][\"name\"] : ' '}}\n{{$node[\"Translations for created Calendar Event\"].json[\"clockify\"][\"description\"]}}: {{$json[\"clockify\"][\"description\"] ? $json[\"clockify\"][\"description\"] : ' '}}\n\n{{$node[\"Translations for created Calendar Event\"].json[\"clockify\"][\"duration\"]}}: {{$json[\"clockify\"][\"timeInterval\"][\"duration\"]}}\n{{$node[\"Translations for created Calendar Event\"].json[\"clockify\"][\"from\"]}} {{$json[\"clockify\"][\"timeInterval\"][\"start\"]}} {{$node[\"Translations for created Calendar Event\"].json[\"clockify\"][\"until\"]}} {{$json[\"clockify\"][\"timeInterval\"][\"end\"]}}\n\nTag: {{$json[\"clockify\"][\"tags\"][0] ? $json[\"clockify\"][\"tags\"][0][\"name\"] : ' '}}\nWorkspace-ID: {{$json[\"clockify\"][\"workspaceId\"]}}\nTimer-ID: {{$json[\"clockify\"][\"id\"]}}"}},"credentials":{"googleCalendarOAuth2Api":{"id":"2","name":"Google Calendar"}},"executeOnce":false,"typeVersion":1,"continueOnFail":true},{"name":"Update Event","type":"n8n-nodes-base.googleCalendar","position":[1140,-320],"parameters":{"eventId":"={{$json[\"calendar\"][\"id\"]}}","calendar":"={{$node[\"Get Events with ID\"].parameter[\"calendar\"]}}","operation":"update","updateFields":{"end":"={{$json[\"clockify\"][\"timeInterval\"][\"end\"]}}","start":"={{$json[\"clockify\"][\"timeInterval\"][\"start\"]}}","summary":"={{$node[\"Config\"].json[\"calendar_entry\"][\"prefix\"] ? $node[\"Config\"].json[\"calendar_entry\"][\"prefix\"]+': ' : ''}}{{$json[\"clockify\"][\"project\"][\"name\"] ? $json[\"clockify\"][\"project\"][\"name\"] : ''}} {{$json[\"clockify\"][\"task\"] ? '- ' + $json[\"clockify\"][\"task\"][\"name\"] : ''}} {{$json[\"clockify\"][\"description\"] ? ': ' + $json[\"clockify\"][\"description\"] : ' '}}","description":"={{$node[\"Translations for created Calendar Event\"].json[\"clockify\"][\"client\"]}}: {{$json[\"clockify\"][\"project\"][\"name\"] ? $json[\"clockify\"][\"project\"][\"clientName\"] : ' '}}\n{{$node[\"Translations for created Calendar Event\"].json[\"clockify\"][\"project\"]}}: {{$json[\"clockify\"][\"project\"][\"name\"] ? $json[\"clockify\"][\"project\"][\"name\"] : ' '}}\n{{$node[\"Translations for created Calendar Event\"].json[\"clockify\"][\"task\"]}}: {{$json[\"clockify\"][\"task\"] ? $json[\"clockify\"][\"task\"][\"name\"] : ' '}}\n{{$node[\"Translations for created Calendar Event\"].json[\"clockify\"][\"description\"]}}: {{$json[\"clockify\"][\"description\"] ? $json[\"clockify\"][\"description\"] : ' '}}\n\n{{$node[\"Translations for created Calendar Event\"].json[\"clockify\"][\"duration\"]}}: {{$json[\"clockify\"][\"timeInterval\"][\"duration\"]}}\n{{$node[\"Translations for created Calendar Event\"].json[\"clockify\"][\"from\"]}} {{$json[\"clockify\"][\"timeInterval\"][\"start\"]}} {{$node[\"Translations for created Calendar Event\"].json[\"clockify\"][\"until\"]}} {{$json[\"clockify\"][\"timeInterval\"][\"end\"]}}\n\nTag: {{$json[\"clockify\"][\"tags\"][0] ? $json[\"clockify\"][\"tags\"][0][\"name\"] : ' '}}\nWorkspace-ID: {{$json[\"clockify\"][\"workspaceId\"]}}\nTimer-ID: {{$json[\"clockify\"][\"id\"]}}"}},"credentials":{"googleCalendarOAuth2Api":{"id":"2","name":"Google Calendar"}},"executeOnce":false,"typeVersion":1,"continueOnFail":true},{"name":"Create Event1","type":"n8n-nodes-base.googleCalendar","position":[2000,-640],"parameters":{"end":"={{$json[\"clockify\"][\"timeInterval\"][\"end\"]}}","start":"={{$json[\"clockify\"][\"timeInterval\"][\"start\"]}}","calendar":"={{$node[\"Get Events with ID\"].parameter[\"calendar\"]}}","additionalFields":{"id":"=clocki{{$json[\"clockify\"][\"id\"]}}{{$json[\"loop_id\"]}}","summary":"={{$node[\"Config\"].json[\"calendar_entry\"][\"prefix\"] ? $node[\"Config\"].json[\"calendar_entry\"][\"prefix\"]+': ' : ''}}{{$json[\"clockify\"][\"project\"][\"name\"] ? $json[\"clockify\"][\"project\"][\"name\"] : ''}} {{$json[\"clockify\"][\"task\"] ? '- ' + $json[\"clockify\"][\"task\"][\"name\"] : ''}} {{$json[\"clockify\"][\"description\"] ? ': ' + $json[\"clockify\"][\"description\"] : ' '}}","description":"={{$node[\"Translations for created Calendar Event\"].json[\"clockify\"][\"client\"]}}: {{$json[\"clockify\"][\"project\"][\"name\"] ? $json[\"clockify\"][\"project\"][\"clientName\"] : ' '}}\n{{$node[\"Translations for created Calendar Event\"].json[\"clockify\"][\"project\"]}}: {{$json[\"clockify\"][\"project\"][\"name\"] ? $json[\"clockify\"][\"project\"][\"name\"] : ' '}}\n{{$node[\"Translations for created Calendar Event\"].json[\"clockify\"][\"task\"]}}: {{$json[\"clockify\"][\"task\"] ? $json[\"clockify\"][\"task\"][\"name\"] : ' '}}\n{{$node[\"Translations for created Calendar Event\"].json[\"clockify\"][\"description\"]}}: {{$json[\"clockify\"][\"description\"] ? $json[\"clockify\"][\"description\"] : ' '}}\n\n{{$node[\"Translations for created Calendar Event\"].json[\"clockify\"][\"duration\"]}}: {{$json[\"clockify\"][\"timeInterval\"][\"duration\"]}}\n{{$node[\"Translations for created Calendar Event\"].json[\"clockify\"][\"from\"]}} {{$json[\"clockify\"][\"timeInterval\"][\"start\"]}} {{$node[\"Translations for created Calendar Event\"].json[\"clockify\"][\"until\"]}} {{$json[\"clockify\"][\"timeInterval\"][\"end\"]}}\n\nTag: {{$json[\"clockify\"][\"tags\"][0] ? $json[\"clockify\"][\"tags\"][0][\"name\"] : ' '}}\nWorkspace-ID: {{$json[\"clockify\"][\"workspaceId\"]}}\nTimer-ID: {{$json[\"clockify\"][\"id\"]}}"}},"credentials":{"googleCalendarOAuth2Api":{"id":"2","name":"Google Calendar"}},"executeOnce":false,"typeVersion":1,"continueOnFail":true},{"name":"Note","type":"n8n-nodes-base.stickyNote","position":[-740,-60],"parameters":{"width":700,"height":200,"content":"## Configuration\nConfigure the **first four nodes** above this note.\nClockify needs authentification and a workspace. \nGoogle Calendar needs authentification and the calendar in which the Clockify entries are being copied. The specified calendar is copied to the other calendar-nodes, so you just have to configure the first one above."},"typeVersion":1},{"name":"Rename to Clockify","type":"n8n-nodes-base.functionItem","position":[40,-460],"parameters":{"functionCode":"clockify = item;\nitem = {};\nitem.clockify = clockify;\nreturn item;"},"typeVersion":1},{"name":"Rename to Calendar","type":"n8n-nodes-base.functionItem","position":[40,-240],"parameters":{"functionCode":"calendar = item;\nitem = {};\nitem.calendar = calendar;\nreturn item;"},"typeVersion":1},{"name":"Config","type":"n8n-nodes-base.set","position":[-520,-240],"parameters":{"values":{"string":[{"name":"calendar_entry.prefix","value":"Clockify"}]},"options":{}},"typeVersion":1},{"name":"Translations for created Calendar Event","type":"n8n-nodes-base.set","position":[-340,-240],"parameters":{"values":{"string":[{"name":"clockify.client","value":"Client"},{"name":"clockify.project","value":"Project"},{"name":"clockify.task","value":"Task"},{"name":"clockify.description","value":"Description"},{"name":"clockify.duration","value":"Duration"},{"name":"clockify.from","value":"From"},{"name":"clockify.until","value":"until"}]},"options":{}},"typeVersion":1},{"name":"Has the event been deleted?","type":"n8n-nodes-base.if","position":[680,-520],"parameters":{"conditions":{"string":[{"value1":"={{$json[\"calendar\"][\"status\"]}}","value2":"cancelled"}]}},"typeVersion":1},{"name":"Rename to Calendar1","type":"n8n-nodes-base.functionItem","position":[1360,-700],"parameters":{"functionCode":"calendar = item;\nitem = {};\nitem.calendar = calendar;\nreturn item;"},"typeVersion":1},{"name":"Do the times match?","type":"n8n-nodes-base.if","position":[900,-400],"parameters":{"conditions":{"string":[{"value1":"={{$json[\"clockify\"][\"timeInterval\"][\"start\"]}}","value2":"={{$json[\"calendar\"][\"start\"][\"dateTime\"]}}"},{"value1":"={{$json[\"clockify\"][\"timeInterval\"][\"end\"]}}","value2":"={{$json[\"calendar\"][\"end\"][\"dateTime\"]}}"}]}},"typeVersion":1},{"name":"Event created again","type":"n8n-nodes-base.noOp","position":[2200,-640],"parameters":{},"typeVersion":1},{"name":"Success","type":"n8n-nodes-base.noOp","position":[2200,-480],"parameters":{},"typeVersion":1},{"name":"Event updated","type":"n8n-nodes-base.noOp","position":[2200,-320],"parameters":{},"typeVersion":1},{"name":"Event created","type":"n8n-nodes-base.noOp","position":[2200,-160],"parameters":{},"typeVersion":1},{"name":"Does the calendar event already exist?","type":"n8n-nodes-base.if","position":[460,-360],"parameters":{"conditions":{"string":[{"value1":"=clocki{{$json[\"clockify\"][\"id\"]}}","value2":"={{$json[\"calendar\"][\"id\"]}}"}]}},"typeVersion":1},{"name":"Merge Clockify and Calendar data","type":"n8n-nodes-base.merge","position":[280,-360],"parameters":{"join":"outer","mode":"mergeByIndex"},"typeVersion":1},{"name":"Merge Clockify and Calendar data1","type":"n8n-nodes-base.merge","position":[1580,-800],"parameters":{"join":"outer","mode":"mergeByIndex"},"typeVersion":1},{"name":"Event exists already","type":"n8n-nodes-base.if","position":[1780,-640],"parameters":{"conditions":{"string":[{"value1":"={{$json[\"calendar\"][\"error\"]}}","operation":"isEmpty"}]}},"typeVersion":1},{"name":"Increment loop_id","type":"n8n-nodes-base.functionItem","position":[900,-820],"parameters":{"functionCode":"if (item.loop_id === undefined){\n  item.loop_id = 1;\n}\nelse{\n  item.loop_id = item.loop_id + 1;\n}\nreturn item;"},"typeVersion":1},{"name":"Note1","type":"n8n-nodes-base.stickyNote","position":[-420,-800],"parameters":{"width":860,"height":200,"content":"# Sync Clockify entries to Google Calendar\nThis flow takes new Clockify entries and creates a new Google Calendar event for each of them."},"typeVersion":1}],"connections":{"Config":{"main":[[{"node":"Translations for created Calendar Event","type":"main","index":0}]]},"Create Event":{"main":[[{"node":"Event created","type":"main","index":0}]]},"Update Event":{"main":[[{"node":"Event updated","type":"main","index":0}]]},"Create Event1":{"main":[[{"node":"Event created again","type":"main","index":0}]]},"Clockify Trigger":{"main":[[{"node":"Config","type":"main","index":0}]]},"Increment loop_id":{"main":[[{"node":"Get Events with ID + loop_id","type":"main","index":0},{"node":"Merge Clockify and Calendar data1","type":"main","index":0}]]},"Get Events with ID":{"main":[[{"node":"Rename to Calendar","type":"main","index":0}]]},"Rename to Calendar":{"main":[[{"node":"Merge Clockify and Calendar data","type":"main","index":1}]]},"Rename to Clockify":{"main":[[{"node":"Merge Clockify and Calendar data","type":"main","index":0}]]},"Do the times match?":{"main":[[{"node":"Success","type":"main","index":0}],[{"node":"Update Event","type":"main","index":0}]]},"Rename to Calendar1":{"main":[[{"node":"Merge Clockify and Calendar data1","type":"main","index":1}]]},"Event exists already":{"main":[[{"node":"Has the event been deleted?","type":"main","index":0}],[{"node":"Create Event1","type":"main","index":0}]]},"Has the event been deleted?":{"main":[[{"node":"Increment loop_id","type":"main","index":0}],[{"node":"Do the times match?","type":"main","index":0}]]},"Get Events with ID + loop_id":{"main":[[{"node":"Rename to Calendar1","type":"main","index":0}]]},"Merge Clockify and Calendar data":{"main":[[{"node":"Does the calendar event already exist?","type":"main","index":0}]]},"Merge Clockify and Calendar data1":{"main":[[{"node":"Event exists already","type":"main","index":0}]]},"Does the calendar event already exist?":{"main":[[{"node":"Has the event been deleted?","type":"main","index":0}],[{"node":"Create Event","type":"main","index":0}]]},"Translations for created Calendar Event":{"main":[[{"node":"Rename to Clockify","type":"main","index":0},{"node":"Get Events with ID","type":"main","index":0}]]}}}