{
  "name": "Check dependencies before completing Awork tasks (workaround)",
  "nodes": [
    {
      "id": "9459daa3-dfff-46f5-8feb-43f45e51c603",
      "name": "Load dependencies for task",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2540,
        260
      ]
    },
    {
      "id": "00f9880f-f593-481f-91e5-a2b8a45f789f",
      "name": "Aggregate task dependencies",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        2740,
        260
      ]
    },
    {
      "id": "c17bb18c-fb38-4592-92fd-5d8055c1359b",
      "name": "Workflow config",
      "type": "n8n-nodes-base.set",
      "position": [
        240,
        700
      ]
    },
    {
      "id": "e1e12bf5-458e-4e32-a170-7f4f6079f3b5",
      "name": "Fetch task changes",
      "type": "n8n-nodes-base.set",
      "position": [
        660,
        700
      ]
    },
    {
      "id": "e2970d75-6909-423c-a8f2-df64a012a843",
      "name": "Split out task changes",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        880,
        700
      ]
    },
    {
      "id": "408ed681-38a2-401a-9982-f26e67a5e6f2",
      "name": "Filter task status change",
      "type": "n8n-nodes-base.filter",
      "position": [
        1100,
        700
      ]
    },
    {
      "id": "017123eb-5ced-411a-b3e4-66f9a4b9dd3f",
      "name": "Check if task done",
      "type": "n8n-nodes-base.if",
      "position": [
        1540,
        700
      ]
    },
    {
      "id": "fe3c0bb3-975e-4bbb-9800-554d297bdbda",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1060,
        40
      ],
      "parameters": {
        "width": 880,
        "height": 1440,
        "content": "## Awork workaround for done tasks with subtasks or dependencies\n\n\nCurrently, [Awork](https://www.awork.com/) does **not** offer direct support for the following functions:\n\n* If a task has subtasks, "
      }
    },
    {
      "id": "c148d0fd-e82c-4e8f-bf16-ac4d6339389d",
      "name": "Webhook call by Awork",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -60,
        700
      ]
    },
    {
      "id": "d3ccba41-12ff-4715-96dd-593d7064bcde",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        140,
        600
      ],
      "parameters": {
        "width": 360,
        "height": 280,
        "content": "### Workflow config\n* Configure basic settings"
      }
    },
    {
      "id": "95f0bc10-d970-4e7d-97cf-aa48186ac29f",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        620,
        600
      ],
      "parameters": {
        "width": 660,
        "height": 280,
        "content": "### Extract status changes from webhook call payload\n"
      }
    },
    {
      "id": "2317dd27-9d9d-4f38-a4fc-2eb32a2468b7",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1420,
        600
      ],
      "parameters": {
        "width": 380,
        "height": 280,
        "content": "### Check if task status is currently \"done\"\n* If yes, proceed\n* If no, exit workflow"
      }
    },
    {
      "id": "3c3c3fa0-e13f-4716-8b00-10ef90e3b9db",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1940,
        600
      ],
      "parameters": {
        "width": 380,
        "height": 280,
        "content": "### Check if dependencies are enabled\n* If yes, process dependencies\n* If no, check if tree structure is enabled"
      }
    },
    {
      "id": "43794f28-5da6-4e00-a43d-7d094dab163b",
      "name": "Check if dependencies enabled",
      "type": "n8n-nodes-base.if",
      "position": [
        2080,
        700
      ]
    },
    {
      "id": "ebfd5656-ddd0-41e9-9c8e-d56b36aa7776",
      "name": "Load all linked tasks",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3200,
        260
      ]
    },
    {
      "id": "d7b3c05a-a46a-46ef-9b50-a8f20cc2749c",
      "name": "Build filter params",
      "type": "n8n-nodes-base.code",
      "position": [
        2960,
        260
      ]
    },
    {
      "id": "ea9758df-b695-4852-90c8-24a22a05c20f",
      "name": "Filter only open tasks",
      "type": "n8n-nodes-base.filter",
      "position": [
        3420,
        260
      ]
    },
    {
      "id": "2c73026c-1b75-4c2e-b6ce-f15c670b59f0",
      "name": "Aggregate open task IDs",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        3640,
        260
      ]
    },
    {
      "id": "3327aedc-007e-4fea-9245-15b262989a82",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2500,
        160
      ],
      "parameters": {
        "width": 1320,
        "height": 340,
        "content": "### Load task dependencies and filter open tasks\n"
      }
    },
    {
      "id": "a1dfbfe4-b741-4aba-902e-8e489515b699",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3920,
        160
      ],
      "parameters": {
        "width": 420,
        "height": 340,
        "content": "### Check if tasks marked as dependencies are open\n* If yes, roll back status.\n* If not, proceed to tree structure check"
      }
    },
    {
      "id": "2bdf7aca-4436-4b7d-bc28-e7bc548310a6",
      "name": "Check if open tasks exist",
      "type": "n8n-nodes-base.if",
      "position": [
        4080,
        260
      ]
    },
    {
      "id": "d0e09e6e-7c93-4e8d-895c-71ab4e48fbe1",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4440,
        160
      ],
      "parameters": {
        "width": 360,
        "height": 340,
        "content": "### Roll back task status"
      }
    },
    {
      "id": "11ae20ec-fa13-48b0-bb08-8b994f81dc8c",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4900,
        160
      ],
      "parameters": {
        "width": 400,
        "height": 340,
        "content": "### Check if comment should be added to task\n* Exit workflow if no comment should be added"
      }
    },
    {
      "id": "262e5825-a4c2-42a4-8dd5-f2f84883a294",
      "name": "Check if comments are enabled",
      "type": "n8n-nodes-base.if",
      "position": [
        5060,
        260
      ]
    },
    {
      "id": "7936a327-a171-4589-8640-2d40460ed4e8",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5400,
        160
      ],
      "parameters": {
        "width": 460,
        "height": 340,
        "content": "### Add comment to task regarding roll back of task state\n* Add comment and exit workflow"
      }
    },
    {
      "id": "76d2697e-d3b7-4325-847b-4321ae970351",
      "name": "Add comment to tasks",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        5580,
        260
      ]
    },
    {
      "id": "c38bb177-055e-4e07-9197-4315edd34f55",
      "name": "Check if tree structure enabled",
      "type": "n8n-nodes-base.if",
      "position": [
        4540,
        780
      ]
    },
    {
      "id": "5ad89ff4-985d-46f9-b872-1de948c0aec0",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4440,
        680
      ],
      "parameters": {
        "width": 360,
        "height": 340,
        "content": "### Check if tree structure check is enabled\n* Exit workflow if not enabled"
      }
    },
    {
      "id": "44487a9d-abfa-4808-ba02-d57a0f435a41",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4900,
        680
      ],
      "parameters": {
        "width": 400,
        "height": 340,
        "content": "### Check if task has subtasks\n* Exit workflow if no subtasks found"
      }
    },
    {
      "id": "62c3589d-0968-43aa-a2d0-efb916032c35",
      "name": "Check subtasks",
      "type": "n8n-nodes-base.if",
      "position": [
        5020,
        760
      ]
    },
    {
      "id": "4238a520-ea43-45e9-b035-40829d2d0b19",
      "name": "Roll back task status from done to previous state",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        4560,
        260
      ]
    },
    {
      "id": "c8930fa6-4234-4441-bc53-f13357a068f2",
      "name": "Load all open sub tasks",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        5500,
        760
      ]
    },
    {
      "id": "5a3afb99-4c18-417f-97ca-8d540f62c6be",
      "name": "Aggregate task IDs",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        5720,
        760
      ]
    },
    {
      "id": "c02ea6b2-f424-4e75-b9ce-43a5f90370f9",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5400,
        680
      ],
      "parameters": {
        "width": 500,
        "height": 340,
        "content": "### Load subtasks not marked as done"
      }
    },
    {
      "id": "0fa23254-3e0f-4c11-9d3d-e4c19c084baa",
      "name": "Sticky Note14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        6000,
        680
      ],
      "parameters": {
        "width": 400,
        "height": 340,
        "content": "### Check if open subtasks exist\n* Exit workflow if no open subtasks found"
      }
    },
    {
      "id": "4e763c4a-93c0-494e-9a6f-8752a4dc9693",
      "name": "Check open subtasks",
      "type": "n8n-nodes-base.if",
      "position": [
        6120,
        760
      ]
    },
    {
      "id": "e07402d8-d4f9-4e4f-b54b-cd55a8e67c3e",
      "name": "Sticky Note15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        6520,
        680
      ],
      "parameters": {
        "width": 360,
        "height": 340,
        "content": "### Roll back task status"
      }
    },
    {
      "id": "ef73bbef-b9e6-48fc-942e-3779ba5b5134",
      "name": "Sticky Note16",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        6980,
        680
      ],
      "parameters": {
        "width": 400,
        "height": 340,
        "content": "### Check if comment should be added to task\n* Exit workflow if no comment should be added"
      }
    },
    {
      "id": "97fe4f6b-72a4-46ac-b77a-95db9febd5b4",
      "name": "Check if comments are enabled1",
      "type": "n8n-nodes-base.if",
      "position": [
        7140,
        780
      ]
    },
    {
      "id": "0b6ac50f-e277-42b7-9a2d-1cacd3c3850f",
      "name": "Sticky Note17",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        7480,
        680
      ],
      "parameters": {
        "width": 460,
        "height": 340,
        "content": "### Add comment to task regarding roll back of task state\n* Add comment and exit workflow"
      }
    },
    {
      "id": "89827df6-6514-4481-bd62-c91990d8ef4c",
      "name": "Add comment to tasks1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        7660,
        780
      ]
    },
    {
      "id": "0cd3cbfc-eae7-432a-a3c1-cb8f63e9bf82",
      "name": "Roll back task status from done to previous state1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        6640,
        780
      ]
    },
    {
      "id": "6e5bb250-a325-43a3-ae31-09057144a7a8",
      "name": "Sticky Note22",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        40,
        40
      ],
      "parameters": {
        "width": 280,
        "height": null,
        "content": "## Green sticky notes: Logical group of nodes"
      }
    },
    {
      "id": "dd922d3f-415c-4407-acaa-b7aa0bb92ce7",
      "name": "Sticky Note23",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        40
      ],
      "parameters": {
        "width": 280,
        "height": null,
        "content": "## Red sticky notes: Routing and possible workflow exit"
      }
    }
  ],
  "connections": {
    "Check subtasks": {
      "main": [
        [
          {
            "node": "Load all open sub tasks",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Workflow config": {
      "main": [
        [
          {
            "node": "Fetch task changes",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate task IDs": {
      "main": [
        [
          {
            "node": "Check open subtasks",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if task done": {
      "main": [
        [
          {
            "node": "Check if dependencies enabled",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch task changes": {
      "main": [
        [
          {
            "node": "Split out task changes",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build filter params": {
      "main": [
        [
          {
            "node": "Load all linked tasks",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check open subtasks": {
      "main": [
        [
          {
            "node": "Roll back task status from done to previous state1",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Load all linked tasks": {
      "main": [
        [
          {
            "node": "Filter only open tasks",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook call by Awork": {
      "main": [
        [
          {
            "node": "Workflow config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter only open tasks": {
      "main": [
        [
          {
            "node": "Aggregate open task IDs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split out task changes": {
      "main": [
        [
          {
            "node": "Filter task status change",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate open task IDs": {
      "main": [
        [
          {
            "node": "Check if open tasks exist",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Load all open sub tasks": {
      "main": [
        [
          {
            "node": "Aggregate task IDs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if open tasks exist": {
      "main": [
        [
          {
            "node": "Roll back task status from done to previous state",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Check if tree structure enabled",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter task status change": {
      "main": [
        [
          {
            "node": "Check if task done",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Load dependencies for task": {
      "main": [
        [
          {
            "node": "Aggregate task dependencies",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate task dependencies": {
      "main": [
        [
          {
            "node": "Build filter params",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if comments are enabled": {
      "main": [
        [
          {
            "node": "Add comment to tasks",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Check if dependencies enabled": {
      "main": [
        [
          {
            "node": "Load dependencies for task",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Check if tree structure enabled",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if comments are enabled1": {
      "main": [
        [
          {
            "node": "Add comment to tasks1",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Check if tree structure enabled": {
      "main": [
        [
          {
            "node": "Check subtasks",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Roll back task status from done to previous state": {
      "main": [
        [
          {
            "node": "Check if comments are enabled",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Roll back task status from done to previous state1": {
      "main": [
        [
          {
            "node": "Check if comments are enabled1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}