{"name":"Fetch and split deliveries for North Pole Logistics: Global Fulfilment","nodes":[{"parameters":{},"id":"0c824dd5-28c0-506a-a5e9-92cf1fd25349","name":"Start here","type":"n8n-nodes-base.manualTrigger","typeVersion":1,"position":[0,160]},{"parameters":{"mode":"manual","assignments":{"assignments":[{"id":"d03800e9-71ad-5f6b-b814-1269c6315aa7","name":"username","type":"string","value":""},{"id":"71acb8cc-65a7-5a9b-8424-228dc18de3e6","name":"participantKey","type":"string","value":""}]},"options":{}},"id":"ad50305f-b576-5254-b9ba-dba72cad4412","name":"Your account","type":"n8n-nodes-base.set","typeVersion":3.4,"position":[232,160]},{"parameters":{"conditions":{"options":{"caseSensitive":true,"typeValidation":"strict","version":2},"conditions":[{"id":"12ad21c4-5101-56f5-a9de-e35800787921","leftValue":"={{ !!String($json.username || \"\").trim() && !!String($json.participantKey || \"\").trim() }}","rightValue":"","operator":{"type":"boolean","operation":"true","singleValue":true}}],"combinator":"and"},"options":{}},"id":"23403f19-4e51-5d18-98b7-7911f1652d5e","name":"Account fields ready?","type":"n8n-nodes-base.if","typeVersion":2.2,"position":[472,160]},{"parameters":{"method":"GET","url":"https://marketing.app.n8n.cloud/webhook/cwc/challenge-12/data","authentication":"none","sendQuery":true,"sendHeaders":true,"queryParameters":{"parameters":[{"name":"username","value":"={{ $json.username.trim().replace(/^@/, \"\").toLowerCase() }}"}]},"headerParameters":{"parameters":[{"name":"x-participant-key","value":"={{ $json.participantKey.trim() }}"}]},"options":{"timeout":15000,"redirect":{"redirect":{"followRedirects":false}},"response":{"response":{"responseFormat":"json"}}}},"id":"d7fe9af6-cbee-528e-b45a-d4d3327c8d82","name":"Fetch my deliveries","type":"n8n-nodes-base.httpRequest","typeVersion":4.5,"position":[744,112],"retryOnFail":false},{"parameters":{"mode":"manual","assignments":{"assignments":[{"id":"0ac348f1-b702-5eb6-8e0c-76911a94d260","name":"grace_minutes","type":"number","value":"={{ $json.assignment.grace_minutes }}"},{"id":"abfaf97a-d82f-59dd-9217-77c4efa48b43","name":"deliveries","type":"array","value":"={{ $json.assignment.deliveries }}"}]},"options":{}},"id":"12c0fcb5-e44f-5106-a3bf-6398d4b3ea97","name":"Keep list and grace","type":"n8n-nodes-base.set","typeVersion":3.4,"position":[984,112]},{"parameters":{"fieldToSplitOut":"deliveries","include":"selectedOtherFields","fieldsToInclude":"grace_minutes","options":{"destinationFieldName":"delivery"}},"id":"8d308f40-1d14-5443-b3b6-93c2d6f93eeb","name":"One item per delivery","type":"n8n-nodes-base.splitOut","typeVersion":1.1,"position":[1224,112]},{"parameters":{"mode":"manual","assignments":{"assignments":[{"id":"0709e408-985a-5cc1-b3e3-0a23c15e4107","name":"next_step","type":"string","value":"Open the weekly challenge and check C12 is open. Register or use your existing username and participant key. Enter both in Your account and run when ready. Your timer starts on the first successful fetch."},{"id":"28327390-1a73-556d-a827-3694b8a330e9","name":"register","type":"string","value":"https://marketing.app.n8n.cloud/webhook/cwc/site?view=register"},{"id":"e05cfcb6-262c-5cc2-9db5-9b91a8d6d508","name":"rules","type":"string","value":"https://marketing.app.n8n.cloud/webhook/cwc/site?view=challenge#task"},{"id":"cb062417-962b-5b4c-b0c9-963596026740","name":"faq","type":"string","value":"https://marketing.app.n8n.cloud/webhook/cwc/site?view=faq"}]},"options":{}},"id":"fa5c5e68-aa40-512e-8ced-21bac626e038","name":"Read setup help","type":"n8n-nodes-base.set","typeVersion":3.4,"position":[744,352]},{"parameters":{"color":7,"width":472,"height":356,"content":"## North Pole Logistics\n**Community Weekly Challenge 12 · Global Fulfilment**\n\nEach week the n8n community gives you a problem to solve with a workflow. This week, help Comet decide which fictional deliveries can switch to a spare sleigh.\n\n[Read the weekly challenge](https://marketing.app.n8n.cloud/webhook/cwc/site). Start when the site shows C12 is open.\n\nThe fastest eligible C12 entrant wins **one month of n8n Cloud Pro**. [Prize and fair play rules](https://marketing.app.n8n.cloud/webhook/cwc/site?view=faq#fair-play)"},"id":"4aa5d6b0-4b4e-52ad-93cc-17e20d5a8529","name":"Join the weekly challenge","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-96,-320]},{"parameters":{"color":5,"width":456,"height":356,"content":"## Set up before you start\nUse your existing Community Weekly Challenge username and participant key, or [register](https://marketing.app.n8n.cloud/webhook/cwc/site?view=register). [Recover your key](https://marketing.app.n8n.cloud/webhook/cwc/site?view=reset).\n\nLeave **Your account** blank to read setup help. When C12 is open and you’re ready, enter both fields and run the starter.\n\nYour first successful personal fetch starts your timer. Fetching again gives you the same deliveries and keeps the original start time."},"id":"c7c772bf-6ab9-5427-86c7-04936c573a5d","name":"Start when ready","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[400,-320]},{"parameters":{"color":4,"width":496,"height":356,"content":"## Build from these items\n**Fetch my deliveries** downloads one list of 12 deliveries. **Keep list and grace** keeps the list and your allowed delay in minutes.\n\n**One item per delivery** gives you 12 items. Each has a `delivery` and the same `grace_minutes`. Use the **+** after this node to add your own native nodes.\n\nCount the deliveries that switch sleighs, then add up the parcels they carry. Those are your two answers. [Task and field definitions](https://marketing.app.n8n.cloud/webhook/cwc/site?view=challenge#task)"},"id":"60ec6899-bfff-5471-bfc2-93f0940e9d0e","name":"Build from these items","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[880,-320]},{"parameters":{"color":3,"width":496,"height":336,"content":"## Finish on the challenge site\n1. Duplicate your finished workflow. In the copy, clear **Your account**, remove saved credential references and unpin any data. Export the copy as JSON.\n2. Open [Submit](https://marketing.app.n8n.cloud/webhook/cwc/site?view=submit). Enter **Rerouted deliveries** and **Parcels rerouted**, attach the JSON, confirm you worked independently and select **Submit and finish**.\n3. Open [My result](https://marketing.app.n8n.cloud/webhook/cwc/site?view=status) for your receipt and elapsed time. If you lose the reply, check here before retrying.\n\n[Weekly leaderboard](https://marketing.app.n8n.cloud/webhook/cwc/site?view=results) · [FAQ and upload help](https://marketing.app.n8n.cloud/webhook/cwc/site?view=faq)"},"id":"addb19eb-02fc-5993-b0f3-45ad00027248","name":"Submit your workflow","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[984,368]},{"parameters":{"color":6,"width":648,"height":260,"content":"## Which deliveries count?\nA delivery is late enough to switch when its estimated minute minus its promised minute is **greater than** your grace period. A delay exactly at the limit stays on the original sleigh.\n\nFor a late delivery, check its own reserved spare. It must exist, be ready, serve the same route and have room for every parcel. An exact fit counts. If any check fails, leave that delivery out of both totals.\n\n[Read the full rule](https://marketing.app.n8n.cloud/webhook/cwc/site?view=challenge#task)"},"id":"e095820d-1198-4db4-a2bb-ca24a4d0bb49","name":"Which deliveries count?","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-96,368]}],"connections":{"Start here":{"main":[[{"node":"Your account","type":"main","index":0}]]},"Your account":{"main":[[{"node":"Account fields ready?","type":"main","index":0}]]},"Account fields ready?":{"main":[[{"node":"Fetch my deliveries","type":"main","index":0}],[{"node":"Read setup help","type":"main","index":0}]]},"Fetch my deliveries":{"main":[[{"node":"Keep list and grace","type":"main","index":0}]]},"Keep list and grace":{"main":[[{"node":"One item per delivery","type":"main","index":0}]]}},"pinData":{},"active":false,"settings":{"executionOrder":"v1"}}