{
  "nodes": [
    {
      "id": "179c1408-eeb6-48e3-a345-4b9b1869858b",
      "name": "Workflow config",
      "type": "n8n-nodes-base.set",
      "position": [
        -780,
        700
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "20b87314-585f-4b03-a87d-cc1b9ff1f9c2",
              "name": "finishedStateLabels",
              "type": "array",
              "value": "=[\"Fertig\",\"Total fertig\"]"
            },
            {
              "id": "16f603e2-3703-4f47-a1b9-92503eb1ea43",
              "name": "forceTimeTracking",
              "type": "boolean",
              "value": true
            },
            {
              "id": "ffd4703d-be65-4c35-b28c-6cafb1050d13",
              "name": "limitForceTimeTrackingToTags",
              "type": "array",
              "value": "[\"Orga\"]"
            },
            {
              "id": "6adacba5-463e-4d5e-9571-54f1a026cb4d",
              "name": "addComments",
              "type": "boolean",
              "value": true
            },
            {
              "id": "a06d3f03-8c2d-4788-b986-4bfc2b2a37c5",
              "name": "commentTimeNotTracked",
              "type": "string",
              "value": "Time not tracked! Status rolled back!"
            },
            {
              "id": "6523a631-b41c-4c52-824a-09f0997b099a",
              "name": "setMinTimeTracking",
              "type": "number",
              "value": 15
            },
            {
              "id": "966f97fd-34f5-4886-a36a-20d930ab1877",
              "name": "minTimeTrackingTags",
              "type": "array",
              "value": "[\"Abrechnen\"]"
            },
            {
              "id": "9d1979f2-cb8e-4ef8-ac1a-8d2a40e394d2",
              "name": "cleanupTimeTracking",
              "type": "boolean",
              "value": true
            },
            {
              "id": "cf342344-7520-450e-ac04-16ca15db1c69",
              "name": "cleanupTimeTrackingInterval",
              "type": "number",
              "value": 15
            },
            {
              "id": "9d75cff6-5b2f-4ee8-b165-e623aa85a0cb",
              "name": "cleanupTimeTrackingTolerance",
              "type": "number",
              "value": 1
            },
            {
              "id": "2ccaff8c-9c16-45a7-ba79-8a676f2ca047",
              "name": "billingTag",
              "type": "array",
              "value": "[\"Abrechnen\"]"
            },
            {
              "id": "f2081a66-3de8-41e2-b399-edb5a3e133c9",
              "name": "forceStartTime",
              "type": "boolean",
              "value": true
            },
            {
              "id": "88cd0d2a-090b-4518-bcec-556aa51fda1a",
              "name": "forceStartTimeText",
              "type": "string",
              "value": "System generated start time"
            },
            {
              "id": "0d88bd24-1306-4986-88c7-8d4b2ffc9d02",
              "name": "systemWorkType",
              "type": "string",
              "value": "System time tracking"
            },
            {
              "id": "ce3be14c-8736-42b5-b5fa-5ff03da56173",
              "name": "systemWorkText",
              "type": "string",
              "value": "System generated time tracking"
            },
            {
              "id": "0886dafd-51e4-4bb8-8b9e-bf3818bc82e2",
              "name": "timeZone",
              "type": "string",
              "value": "Europe/Berlin"
            },
            {
              "id": "683813c2-8a3f-4308-bad4-df694b452b36",
              "name": "systemTimeUserId",
              "type": "string",
              "value": ""
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "3e7a91e0-b098-4b1e-b4f8-34e83457c5e1",
      "name": "Fetch task changes",
      "type": "n8n-nodes-base.set",
      "position": [
        -360,
        700
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "d1e893cd-bdeb-4c9b-8fe0-82dc11c047a7",
              "name": "=changes",
              "type": "array",
              "value": "={{ $('Webhook call by Awork').item.json.body.changes }}"
            },
            {
              "id": "366f0193-6a2d-4766-9d70-1f75659192a0",
              "name": "eventType",
              "type": "string",
              "value": "={{ $('Webhook call by Awork').item.json.body.eventType }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "511f086c-d49f-4ed6-8bf5-73ac32546323",
      "name": "Split out task changes",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -140,
        700
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "changes"
      },
      "typeVersion": 1
    },
    {
      "id": "9b5e7bc8-2c9d-4477-bf9a-89016a289e7b",
      "name": "Filter task status change",
      "type": "n8n-nodes-base.filter",
      "position": [
        80,
        700
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "82923633-648e-4ef0-82dc-cbe35de925b3",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.property }}",
              "rightValue": "TaskStatusId"
            }
          ]
        }
      },
      "typeVersion": 2.2,
      "alwaysOutputData": true
    },
    {
      "id": "0709319c-03ed-49f7-b9ef-479cf2a2d7e0",
      "name": "Check if task done",
      "type": "n8n-nodes-base.if",
      "position": [
        940,
        60
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "e4e5890b-588e-41f1-95c1-02e313fda09a",
              "operator": {
                "type": "array",
                "operation": "contains",
                "rightType": "any"
              },
              "leftValue": "={{ $('Workflow config').item.json.finishedStateLabels }}",
              "rightValue": "={{ $('Webhook call by Awork').item.json.body.entity.taskStatus.name }}"
            },
            {
              "id": "97e159ef-21df-4d1c-bef0-fc7a64ffa0fe",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $('Webhook call by Awork').item.json.body.entity.taskStatus.type }}",
              "rightValue": "done"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "f516a0c5-098b-49c4-8d7c-efd024da4a0c",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2080,
        40
      ],
      "parameters": {
        "width": 880,
        "height": 1900,
        "content": "## Enhanced time tracking features for awork\n\nThis workflow offers several additional features for time tracking with [https://www.awork.com](https://www.awork.com):\n\n* Check whether time has been tracked when closing a task. If not, tasks are reopened and the user is notified. May be restricted to specific tasks by tags.\n* Minimum time tracking for tasks to comply with \"at least 15-minute intervals are billed\" scenarios. May be restricted to specific tasks by tags.\n* Time tracking cleanup to match billing intervals.\n* Add a start time to time entries if it is missing.\n* This workflow **does not use** the Awork community nodes package, as this package does not support all required API calls and is therefore not used here. If you would like to use that package, you can find more information at [https://support.awork.com/en/articles/9826591-n8n-integration](https://support.awork.com/en/articles/9826591-n8n-integration) and replace the HTTP nodes with matching community nodes if applicable.\n\n### The following configuration settings are possible or required in the \u201cWorkflow config\u201d node (following the webhook call):\n\n* **finishedStateLabels** (Array, required): Label text of the task status entities that have the \u201cDone\u201d state. Must be stored as an array. Allows you to control whether the workflow is skipped for certain status changes, even if the task has been marked as completed.\n\n* **forceTimeTracking** (Boolean, optional): Boolean setting indicating whether users are forced to track time on tasks before closing them.\n\n* **limitForceTimeTrackingToTags** (Array, optional): Label text of the task tag entities. Must be stored as an array. Allows you to limit forced time tracking to specific tasks.\n\n* **addComments** (Boolean, optional): Boolean setting indicating whether a comment is added to a task if a status change is undone by the workflow.\n\n* **commentTimeNotTracked** (String, optional, required if addComments is true): Comment text added to a task when the status change is undone due to missing tracked time. Serves as a hint for the user.\n\n* **setMinTimeTracking** (Float (minutes), optional): Defines a minimum time to be tracked for each task. For example, use \"15\" to track at least 15 minutes for any client request. If set to \"0\", minimum time tracking is disabled. Provide minutes as the parameter, e.g., \"15\" for a 15-minute minimum tracked time.\n\n* **cleanupTimeTracking** (Boolean, optional): Boolean setting indicating whether to adjust time tracking to match a specific time interval (e.g., 15-minute intervals).\n\n* **cleanupTimeTrackingInterval** (Float (minutes), optional): Time interval all time tracking entries should match. For example, a 12-minute tracked time for a task gets 3 more minutes added to reach the defined interval of 15 minutes.\n\n* **cleanupTimeTrackingTolerance** (Float (minutes), optional): Tolerance for time tracking cleanup. For example, a tracked time of 16 minutes is not rounded to 30 if a tolerance of 2 minutes is set. If 0, even a second tracked beyond the set interval results in an additional interval being added.\n\n* **billingTag** (Array, optional): Label text of task tags marking tasks as billable. Added time entries will be set as \"billable\" for those tasks.\n\n* **forceStartTime** (Boolean, optional): Boolean setting indicating whether a start time is enforced for time tracking entries. If set to true, missing start times are added and a note is appended.\n\n* **forceStartTimeText** (String, REQUIRED if forceStartTime is set): Note added to modified time tracking entries. Required to prevent endless loops.\n\n* **systemWorkType** (String, REQUIRED): Add a work type in your Awork config and set the label text here so system-generated time entries may be added to tasks.\n\n* **systemWorkText** (String, optional): Text added to system-generated time entries, e.g., \"System generated time tracking\".\n\n* **timeZone** (String, REQUIRED): Define a time zone for system-generated time tracking, e.g., \"Europe/Berlin\". A full list can be found at [https://www.php.net/manual/en/timezones.php](https://www.php.net/manual/en/timezones.php) or other sources.\n\n* **systemTimeUserId** (String, REQUIRED): UUID of the user assigned to system-generated time tracking. Either create a separate user or select an existing one. To retrieve the UUID of a user, go to the \"User\" list, click on a user to open the details page, and copy the ID from the URL (e.g., \"ZZZZZZZZ-YYYY-XXXX-ZZZZ-YYYYYYYYYYYY/details\"). Paste the \"ZZZ...YYYY\" part into the config node.\n\n## How to use\n\n**Awork configuration**\n\n* Copy this workflow to your n8n installation  \n* Add authentication credentials\n\n* Add a new webhook call to Awork (see [https://support.awork.com/en/articles/5415462-webhooks](https://support.awork.com/en/articles/5415462-webhooks)) and configure as required (name, authentication, etc.)  \n* Configure the webhook to be triggered on task status changes AND new time entries  \n* Enable \"Only events from first level properties\" to reduce the number of webhook calls  \n* Test and save the webhook  \n\n* Generate a new API client (or use an existing one) (see [https://support.awork.com/en/articles/5415664-client-applications-and-api-keys](https://support.awork.com/en/articles/5415664-client-applications-and-api-keys))  \n\n* Add new credentials for Awork to your n8n installation (see [https://docs.n8n.io/credentials/add-edit-credentials/](https://docs.n8n.io/credentials/add-edit-credentials/))  \n++ Choose \"Header auth\" from the list and name it as you like, e.g., \"Awork API Access\"  \n++ Set \"name\" to \"Authorization\" and \"value\" to \"Bearer YOUR_TOKEN_HERE\", with XXX replaced by the API key created in Awork  \n++ Update all webhook calls in this workflow to use these credentials  \n\n## Enjoy\n"
      },
      "typeVersion": 1
    },
    {
      "id": "215d70e6-5ae9-4342-9b15-54459e96252f",
      "name": "Webhook call by Awork",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1080,
        700
      ],
      "parameters": {
        "path": "d6af5915-8ba8-46ec-a840-6fe9d0a66cc6",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2
    },
    {
      "id": "0674b425-48b5-44c1-8a4c-18446eed49ee",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -880,
        600
      ],
      "parameters": {
        "color": 4,
        "width": 360,
        "height": 280,
        "content": "### Workflow config\n* Configure basic settings"
      },
      "typeVersion": 1
    },
    {
      "id": "9b085c61-09af-4ee4-8e0b-17c97e46d17b",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -400,
        600
      ],
      "parameters": {
        "color": 4,
        "width": 660,
        "height": 280,
        "content": "### Extract status changes from webhook call payload\n"
      },
      "typeVersion": 1
    },
    {
      "id": "136ad4d1-aaab-4c5e-87aa-2ebbb90f015c",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        820,
        -40
      ],
      "parameters": {
        "color": 3,
        "width": 340,
        "height": 280,
        "content": "### Check if task status is currently \"done\"\n* If yes, proceed\n* If no, exit workflow"
      },
      "typeVersion": 1
    },
    {
      "id": "9d5c4669-a5ee-4824-94aa-df6b2cc56809",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1280,
        -40
      ],
      "parameters": {
        "color": 3,
        "width": 380,
        "height": 280,
        "content": "### Check if force time tracking is enabled and no time is tracked\n* If yes, roll back task status\n* If no, check if time tracking cleaning is enabled"
      },
      "typeVersion": 1
    },
    {
      "id": "9d0261e8-4aa2-4517-aa21-8a1a8d669e4b",
      "name": "Sticky Note22",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -980,
        40
      ],
      "parameters": {
        "color": 4,
        "width": 280,
        "content": "## Green sticky notes: Logical group of nodes"
      },
      "typeVersion": 1
    },
    {
      "id": "390668f3-be8e-435b-b587-b8051602cb24",
      "name": "Sticky Note23",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -620,
        40
      ],
      "parameters": {
        "color": 3,
        "width": 280,
        "content": "## Red sticky notes: Routing and possible workflow exit"
      },
      "typeVersion": 1
    },
    {
      "id": "06b9eb83-b591-4533-b25a-6c3137dedd27",
      "name": "Check if force time tracking enabled",
      "type": "n8n-nodes-base.if",
      "position": [
        1420,
        60
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "53d5f2be-2830-4977-a69f-a0d135ea76c4",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $('Workflow config').item.json.forceTimeTracking }}",
              "rightValue": "true"
            },
            {
              "id": "a26d4003-614b-416a-9e99-93401ca4df95",
              "operator": {
                "type": "number",
                "operation": "equals"
              },
              "leftValue": "={{ $('Webhook call by Awork').item.json.body.entity.totalTrackedDuration }}",
              "rightValue": 0
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "4ca7bf23-1aae-4f02-be65-c73b95d7267a",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1780,
        -40
      ],
      "parameters": {
        "color": 3,
        "width": 360,
        "height": 280,
        "content": "### Check if force time tracking is limited to specific tags\n* If yes, check task tags\n* If no, roll back task status"
      },
      "typeVersion": 1
    },
    {
      "id": "b5ef7954-3afa-476c-94da-a20e86a2307f",
      "name": "Process tags and check if found in configured tags",
      "type": "n8n-nodes-base.code",
      "position": [
        2560,
        -400
      ],
      "parameters": {
        "jsCode": "let tagFound = false;\n\nfor (const item of $('Webhook call by Awork').first().json.body.entity.tags) {\n  if($('Workflow config').first().json.limitForceTimeTrackingToTags.includes(item.name)){\n    tagFound = true;\n  }\n}\nreturn {\n  \"json\" : {\n    \"tagFound\": tagFound\n  }\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "9495c5fa-a1f0-4ee6-8aee-8d50b34e3f62",
      "name": "Sticky Note18",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2440,
        -520
      ],
      "parameters": {
        "color": 4,
        "width": 360,
        "height": 340,
        "content": "### Process task tags\n* If a task tag is listed in \"Limit forced time tracking to tags\", return true\n* If not found, return false"
      },
      "typeVersion": 1
    },
    {
      "id": "476d35a9-2d22-42c6-8da6-e6c19b551ce6",
      "name": "Sticky Note19",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2920,
        -520
      ],
      "parameters": {
        "color": 3,
        "width": 400,
        "height": 340,
        "content": "### Check if at least one task tag is listed in config node\n* If yes, roll back task status\n* If not, continue workflow"
      },
      "typeVersion": 1
    },
    {
      "id": "73b880a2-a517-409a-81b4-0b8864077ce6",
      "name": "Check if tags listed in config node",
      "type": "n8n-nodes-base.if",
      "position": [
        3060,
        -400
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "8ff048ba-25bd-4bd5-b0da-f4a53e056582",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.tagFound }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "f3abc505-6c3c-4651-9442-0888c90a6b94",
      "name": "Sticky Note20",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3440,
        -520
      ],
      "parameters": {
        "color": 4,
        "width": 360,
        "height": 340,
        "content": "### Roll back task status"
      },
      "typeVersion": 1
    },
    {
      "id": "65aaba6d-e2ce-4563-ad98-80f960588d10",
      "name": "Sticky Note21",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3900,
        -520
      ],
      "parameters": {
        "color": 3,
        "width": 400,
        "height": 340,
        "content": "### Check if comment should be added to task\n* Exit workflow if no comment should be added"
      },
      "typeVersion": 1
    },
    {
      "id": "90e2355d-f1ab-4b8a-badc-759f5ce92bec",
      "name": "Check if comments are enabled",
      "type": "n8n-nodes-base.if",
      "position": [
        4060,
        -420
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "6505de62-2d0a-4a3a-8f33-f0add4364b7e",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $('Workflow config').item.json.addComments }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "16c319d2-c0bb-4746-9716-e8979415144f",
      "name": "Sticky Note24",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4400,
        -520
      ],
      "parameters": {
        "color": 4,
        "width": 460,
        "height": 340,
        "content": "### Add comment to task regarding roll back of task state\n* Add comment and exit workflow"
      },
      "typeVersion": 1
    },
    {
      "id": "d585a9ae-453a-4ac3-ae01-974683ae8db6",
      "name": "Add comment to tasks",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        4580,
        -420
      ],
      "parameters": {
        "url": "=https://api.awork.com/api/v1/tasks/{{ $('Webhook call by Awork').item.json.body.entity.id }}/comments",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"message\": {{ JSON.stringify($('Workflow config').item.json.commentTimeNotTracked) }}\n} ",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpCustomAuth": {
          "name": "<your credential>"
        },
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2,
      "waitBetweenTries": 2000
    },
    {
      "id": "ca27d942-452c-4d74-95c1-062e8efa3878",
      "name": "Roll back task status from done to previous state",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3560,
        -420
      ],
      "parameters": {
        "url": "https://api.awork.com/api/v1/tasks/changestatuses",
        "method": "POST",
        "options": {},
        "jsonBody": "=[\n  {\n    \"taskId\": \"{{ $('Webhook call by Awork').item.json.body.entity.id }}\",\n    \"statusId\": \"{{ $('Filter task status change').item.json.old }}\" \n}\n] ",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2,
      "waitBetweenTries": 2000
    },
    {
      "id": "546c19a9-d666-43ca-b796-c4051aea1e79",
      "name": "Check tag restriction",
      "type": "n8n-nodes-base.if",
      "position": [
        1880,
        80
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "727bf023-2759-44e0-aa51-fcf4fdf3b2c2",
              "operator": {
                "type": "array",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $('Workflow config').item.json.limitForceTimeTrackingToTags }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "f40cd133-4cb2-4c3c-857e-52dfbe5f41ee",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3060,
        1240
      ],
      "parameters": {
        "color": 3,
        "width": 360,
        "height": 280,
        "content": "### Check if min time tracking OR time tracking cleanup is enabled\n* If yes, check time tracked\n* If no, exit workflow"
      },
      "typeVersion": 1
    },
    {
      "id": "abd49a4a-4837-4070-9fe9-1de7a47aa15f",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5080,
        1240
      ],
      "parameters": {
        "color": 3,
        "width": 380,
        "height": 280,
        "content": "### Check if tracked time is lesser than min time\n* If yes, add new time tracking record to match min time in sum\n* If no, continue workflow"
      },
      "typeVersion": 1
    },
    {
      "id": "75a23ae3-4970-48da-8a18-192f7f7d6708",
      "name": "Check tracked time",
      "type": "n8n-nodes-base.if",
      "position": [
        5220,
        1380
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "b68cd162-9937-44d6-8e37-73744f79ccb1",
              "operator": {
                "type": "number",
                "operation": "lt"
              },
              "leftValue": "={{ $('Webhook call by Awork').item.json.body.changes.find(entry => entry.property === \"Duration\")['new'].toNumber() }}",
              "rightValue": "={{ ($('Workflow config').item.json.setMinTimeTracking * 60) }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "a1c8d19e-34a4-4eed-8ab7-b1bc72758f66",
      "name": "Sticky Note15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2440,
        160
      ],
      "parameters": {
        "color": 4,
        "width": 360,
        "height": 320,
        "content": "### Roll back task status"
      },
      "typeVersion": 1
    },
    {
      "id": "c04685af-e198-4272-93d3-b0bbd7f3a94a",
      "name": "Sticky Note16",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2900,
        160
      ],
      "parameters": {
        "color": 3,
        "width": 400,
        "height": 320,
        "content": "### Check if comment should be added to task\n* Exit workflow if no comment should be added"
      },
      "typeVersion": 1
    },
    {
      "id": "e7c2f529-ee42-4417-a92e-b1c0b255fccf",
      "name": "Check if comments are enabled1",
      "type": "n8n-nodes-base.if",
      "position": [
        3060,
        260
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "6505de62-2d0a-4a3a-8f33-f0add4364b7e",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $('Workflow config').item.json.addComments }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "21de0e65-7bb2-48a4-90f5-836758322b03",
      "name": "Sticky Note17",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3400,
        160
      ],
      "parameters": {
        "color": 4,
        "width": 460,
        "height": 320,
        "content": "### Add comment to task regarding roll back of task state\n* Add comment and exit workflow"
      },
      "typeVersion": 1
    },
    {
      "id": "12e1a026-3b5a-4cd3-94ea-8892145ec9ec",
      "name": "Add comment to tasks1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3580,
        260
      ],
      "parameters": {
        "url": "=https://api.awork.com/api/v1/tasks/{{ $('Webhook call by Awork').item.json.body.entity.id }}/comments",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"message\": {{ JSON.stringify($('Workflow config').item.json.commentTimeNotTracked) }}\n} ",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpCustomAuth": {
          "name": "<your credential>"
        },
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2,
      "waitBetweenTries": 2000
    },
    {
      "id": "8d83c66e-1e1a-47d7-ada6-894816906875",
      "name": "Roll back task status from done to previous state1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2560,
        260
      ],
      "parameters": {
        "url": "https://api.awork.com/api/v1/tasks/changestatuses",
        "method": "POST",
        "options": {},
        "jsonBody": "=[\n  {\n    \"taskId\": \"{{ $('Webhook call by Awork').item.json.body.entity.id }}\",\n    \"statusId\": \"{{ $('Filter task status change').item.json.old }}\" \n}\n] ",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2,
      "waitBetweenTries": 2000
    },
    {
      "id": "07ded81a-712f-49a9-8e76-8eb716cc99d7",
      "name": "Calculate time for added time tracking",
      "type": "n8n-nodes-base.code",
      "position": [
        5720,
        1160
      ],
      "parameters": {
        "jsCode": "let trackedTime = $('Webhook call by Awork').first().json.body.changes.find(entry => entry.property === \"Duration\")[\"new\"];\n\n\nlet requiredTime = $('Workflow config').first().json.setMinTimeTracking * 60;\n\nlet missingTrackedTime = requiredTime - trackedTime;\n\n\nlet result = {};\n\nlet isBillable = false;\n\nfor (const item of $('Load task details for time tracking item').first().json.tags) {\n  if($('Workflow config').first().json.billingTag.includes(item.name)){\n    isBillable = true;\n  }\n}\n\nif(missingTrackedTime > 0){\n\n  result = {\n    \"json\" : {\n      \"addTimeTracking\" : true,\n      \"missingTrackedTime\": missingTrackedTime,\n      \"isBillable\" : isBillable\n    }\n  };\n  \n}else{\n  result = {\n    \"json\" : {\n      \"addTimeTracking\" : false,\n      \"missingTrackedTime\": 0,\n      \"isBillable\" : isBillable\n    }\n  };\n}\n\nreturn result;"
      },
      "typeVersion": 2
    },
    {
      "id": "a5332052-88fb-4eea-9e9f-4ac5ad1920b3",
      "name": "Calculate time for added time tracking1",
      "type": "n8n-nodes-base.code",
      "position": [
        5680,
        1620
      ],
      "parameters": {
        "jsCode": "let trackedTime = $('Webhook call by Awork').first().json.body.changes.find(entry => entry.property === \"Duration\")[\"new\"];\n\nlet requiredTimeInterval = $('Workflow config').first().json.cleanupTimeTrackingInterval * 60;\n\nlet moduloTrackedTime = trackedTime % requiredTimeInterval;\n\nlet trackedTimeTolerance = $('Workflow config').first().json.cleanupTimeTrackingTolerance * 60;\n\nlet missingTrackedTime = 0;\nif(moduloTrackedTime > 0 && moduloTrackedTime > trackedTimeTolerance){\n  missingTrackedTime = requiredTimeInterval - moduloTrackedTime;\n}\n\n\nlet result = {};\n\nlet isBillable = false;\n\nfor (const item of $('Load task details for time tracking item').first().json.tags) {\n  if($('Workflow config').first().json.billingTag.includes(item.name)){\n    isBillable = true;\n  }\n}\n\n\nif(missingTrackedTime > 0){\n\n  result = {\n    \"json\" : {\n      \"addTimeTracking\" : true,\n      \"missingTrackedTime\": missingTrackedTime,\n      \"isBillable\" : isBillable\n    }\n  };\n  \n}else{\n  result = {\n    \"json\" : {\n      \"addTimeTracking\" : false,\n      \"missingTrackedTime\": 0,\n      \"isBillable\" : isBillable    \n    }\n  };\n}\n\nreturn result;"
      },
      "typeVersion": 2
    },
    {
      "id": "d4a81a5f-f1a4-4232-a431-707716279840",
      "name": "Roll back task status from done to previous state4",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        6060,
        1620
      ],
      "parameters": {
        "url": "https://api.awork.com/api/v1/timeentries",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"isBillable\": {{ $('Calculate time for added time tracking1').item.json.isBillable }},\n  \"isBilled\": false,\n  \"taskId\": \"{{ $('Load task details for time tracking item').item.json.id }}\",  \n  \"note\": \"{{ $('Workflow config').item.json.systemWorkText }}\",  \n  \"timezone\": \"{{ $('Workflow config').item.json.timeZone }}\",\n  \"duration\": {{ $('Calculate time for added time tracking1').item.json.missingTrackedTime }},\n  \"breakDuration\": null,  \n  \"startDateUtc\": \"{{ $now.setZone('Europe/Berlin').minus($('Calculate time for added time tracking1').item.json.missingTrackedTime,'seconds').startOf('day').toISO() }}\",\n  \"startTimeUtc\": \"{{ $now.minus($('Calculate time for added time tracking1').item.json.missingTrackedTime,'seconds').format('HH:mm:ii') }}\",\n  \"typeOfWorkId\": \"{{ $('Load system type of work').item.json.id }}\",\n  \"userId\": \"{{ $('Workflow config').item.json.systemTimeUserId }}\"  \n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2,
      "waitBetweenTries": 2000
    },
    {
      "id": "21b57017-94b3-4fff-b30a-1ec90c1224dc",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5600,
        1060
      ],
      "parameters": {
        "color": 4,
        "width": 660,
        "height": 280,
        "content": "### Calculate missing tracked time and add system generated time tracking to task\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "252f676f-6d13-401d-b409-ec7dc07c1313",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5600,
        1540
      ],
      "parameters": {
        "color": 4,
        "width": 660,
        "height": 280,
        "content": "### Update tracked time to match time tracking intervals\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "622e08a4-6754-4578-9bca-daf2450c061b",
      "name": "Check if min time tracking OR time tracking cleanup is enabled",
      "type": "n8n-nodes-base.if",
      "position": [
        3140,
        1340
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "b68cd162-9937-44d6-8e37-73744f79ccb1",
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{ ($('Workflow config').item.json.setMinTimeTracking) }}",
              "rightValue": 0
            },
            {
              "id": "8acdd656-81bb-46eb-a776-dbadac4d99f9",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $('Workflow config').item.json.cleanupTimeTracking }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "953b4ce3-ca3d-4e43-b72a-75274215682d",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3580,
        1240
      ],
      "parameters": {
        "color": 3,
        "width": 360,
        "height": 280,
        "content": "### Check if min time tracking is limited to specific tags\n* If yes, check task tags\n* If no, continue workflow"
      },
      "typeVersion": 1
    },
    {
      "id": "7b334938-3a49-4b63-a215-5b65a576ceb7",
      "name": "Check tag restriction1",
      "type": "n8n-nodes-base.if",
      "position": [
        3680,
        1360
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "727bf023-2759-44e0-aa51-fcf4fdf3b2c2",
              "operator": {
                "type": "array",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $('Workflow config').item.json.minTimeTrackingTags }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "7b238335-f3b4-417a-8b94-a5f538719205",
      "name": "Process tags and check if found in configured tags1",
      "type": "n8n-nodes-base.code",
      "position": [
        4220,
        1080
      ],
      "parameters": {
        "jsCode": "let tagFound = false;\n\nfor (const item of $('Load task details for time tracking item').first().json.tags) {\n  if($('Workflow config').first().json.minTimeTrackingTags.includes(item.name)){\n    tagFound = true;\n  }\n}\nreturn {\n  \"json\" : {\n    \"tagFound\": tagFound\n  }\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "e9aa2e6b-9ceb-4f09-9bab-4d984b395b89",
      "name": "Sticky Note25",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4080,
        980
      ],
      "parameters": {
        "color": 4,
        "width": 380,
        "height": 280,
        "content": "### Process task tags\n* If a task tag is listed in \"Limit min time tracking to tags\", return true\n* If not found, return false"
      },
      "typeVersion": 1
    },
    {
      "id": "ef5df167-732f-4ae4-9e8e-84177b70ff9c",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        4720,
        1080
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d6e66e14-c903-45f3-9b16-2ee4916fffc3",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "b9043a45-2643-4160-8997-2a8ce936e0d0",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        300,
        700
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Task status changed workflow",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "8704542a-861d-4acd-bb37-36162f3d5cba",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Fetch task changes').item.json.eventType }}",
                    "rightValue": "task_status_changed"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Time tracking added workflow",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "1059e3a8-101c-48d6-bb2a-bc98811dbf85",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Fetch task changes').item.json.eventType }}",
                    "rightValue": "timetracking_added"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "186b00a1-e27d-466a-a838-5c9f5755546b",
      "name": "Load task details for time tracking item",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1580,
        1320
      ],
      "parameters": {
        "url": "=https://api.awork.com/api/v1/tasks/{{ $('Webhook call by Awork').item.json.body.entity.task.id }}",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2,
      "waitBetweenTries": 2000
    },
    {
      "id": "f7516774-cc65-468a-93e5-8ea7b8157d0e",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4580,
        980
      ],
      "parameters": {
        "color": 3,
        "width": 380,
        "height": 280,
        "content": "### Check if task should be time tracked by tag\n* If yes, continue\n* If no, exit workflow"
      },
      "typeVersion": 1
    },
    {
      "id": "2262bfbf-3413-4686-892f-9072d688bd66",
      "name": "If1",
      "type": "n8n-nodes-base.if",
      "position": [
        860,
        1340
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "581dcdf0-5c48-4645-a6f8-df15bfcb7fcd",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              },
              "leftValue": "={{ $('Webhook call by Awork').item.json.body.entity.typeOfWork.name }}",
              "rightValue": "={{ $('Workflow config').item.json.systemWorkType }}"
            },
            {
              "id": "dc0036ee-c92c-4840-a399-8b960ef17753",
              "operator": {
                "type": "string",
                "operation": "notContains"
              },
              "leftValue": "={{ $('Webhook call by Awork').item.json.body.entity.note }}",
              "rightValue": "={{ $('Workflow config').item.json.forceStartTimeText }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "891c6828-17a9-4c99-b616-9fbe9fc8b5e9",
      "name": "Load system type of work",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1320,
        1320
      ],
      "parameters": {
        "url": "=https://api.awork.com/api/v1/typeofwork?filterby=name eq '{{ $('Workflow config').item.json.systemWorkType }}' ",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2,
      "waitBetweenTries": 2000
    },
    {
      "id": "91b17bed-b86f-4345-9ec8-76b943e989ae",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        740,
        1240
      ],
      "parameters": {
        "color": 3,
        "width": 360,
        "height": 280,
        "content": "### Check if added time tracking is not system generated to prevent endless loops\n* If yes, check time tracked\n* If no, exit workflow"
      },
      "typeVersion": 1
    },
    {
      "id": "d866932b-0e94-4a8c-acc6-62c470ac316e",
      "name": "Sticky Note26",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1240,
        1240
      ],
      "parameters": {
        "color": 4,
        "width": 560,
        "height": 280,
        "content": "### Load system type of work and related task data"
      },
      "typeVersion": 1
    },
    {
      "id": "56edd5c1-f352-457a-9d81-1a5af8db3d9e",
      "name": "Add tracked time to match min time settings",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        6040,
        1160
      ],
      "parameters": {
        "url": "https://api.awork.com/api/v1/timeentries",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"isBillable\": {{ $('Calculate time for added time tracking').item.json.isBillable }},\n  \"isBilled\": false,\n  \"taskId\": \"{{ $('Load task details for time tracking item').item.json.id }}\",  \n  \"note\": \"{{ $('Workflow config').item.json.systemWorkText }}\",  \n  \"timezone\": \"{{ $('Workflow config').item.json.timeZone }}\",\n  \"duration\": {{ $('Calculate time for added time tracking').item.json.missingTrackedTime }},\n  \"breakDuration\": null,  \n  \"startDateUtc\": \"{{ $now.setZone('Europe/Berlin').minus($('Calculate time for added time tracking').item.json.missingTrackedTime,'seconds').startOf('day').toISO() }}\",\n  \"startTimeUtc\": \"{{ $now.minus($('Calculate time for added time tracking').item.json.missingTrackedTime,'seconds').format('HH:mm:ii') }}\",\n  \"typeOfWorkId\": \"{{ $('Load system type of work').item.json.id }}\",\n  \"userId\": \"{{ $('Workflow config').item.json.systemTimeUserId }}\"\n  \n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2,
      "waitBetweenTries": 2000
    },
    {
      "id": "7fc1be75-da5a-4dc0-8487-8dc415e0c9b5",
      "name": "If2",
      "type": "n8n-nodes-base.if",
      "position": [
        2020,
        1320
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "7561d64d-8d53-4fdf-aa2d-0e3c0b56cb2c",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $('Workflow config').item.json.forceStartTime }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "eca1a30d-cadd-478e-975c-6d6a7cd90e58",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1940,
        1240
      ],
      "parameters": {
        "color": 3,
        "width": 360,
        "height": 280,
        "content": "### Check if forced start time is enabled\n* If yes, update start time in tracked time\n* If no, continue"
      },
      "typeVersion": 1
    },
    {
      "id": "b8f00f6c-8b28-4779-8e0a-49e65f263852",
      "name": "Add start time to time tracking entry",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2620,
        1000
      ],
      "parameters": {
        "url": "=https://api.awork.com/api/v1/timeentries/{{ $('Webhook call by Awork').item.json.body.entity.id }}",
        "method": "PUT",
        "options": {},
        "jsonBody": "={  \n  \"note\": \"{{ $('Webhook call by Awork').item.json.body.entity.note }} ({{ $('Workflow config').item.json.forceStartTimeText }})\",\n  \"timezone\": \"{{ $('Workflow config').item.json.timeZone }}\",\n  \"startDateUtc\": \"{{ $now.setZone('Europe/Berlin').minus($('Webhook call by Awork').item.json.body.entity.duration,'seconds').startOf('day').toISO() }}\",\n  \"startTimeUtc\": \"{{ $now.minus($('Webhook call by Awork').item.json.body.entity.duration,'seconds').format('HH:mm:ii') }}\",\n  \"duration\":  {{ $('Webhook call by Awork').item.json.body.entity.duration }},\n  \"typeOfWorkId\": \"{{ $('Webhook call by Awork').item.json.body.entity.typeOfWork.id }}\",\n  \"userId\": \"{{ $('Webhook call by Awork').item.json.body.entity.user.id }}\"  \n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2,
      "waitBetweenTries": 2000
    },
    {
      "id": "67279685-ad5d-4481-931a-3174e2493a60",
      "name": "Sticky Note27",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2480,
        880
      ],
      "parameters": {
        "color": 4,
        "width": 380,
        "height": 280,
        "content": "### Add start time to time tracking \n* Calculates start time based on duration in the past until now.\n* Updates time tracking entry and appends note to time tracking text"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Check tracked time",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If1": {
      "main": [
        [
          {
            "node": "Load system type of work",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If2": {
      "main": [
        [
          {
            "node": "Add start time to time tracking entry",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Check if min time tracking OR time tracking cleanup is enabled",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Check if task done",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Workflow config": {
      "main": [
        [
          {
            "node": "Fetch task changes",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if task done": {
      "main": [
        [
          {
            "node": "Check if force time tracking enabled",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check tracked time": {
      "main": [
        [
          {
            "node": "Calculate time for added time tracking",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Calculate time for added time tracking1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch task changes": {
      "main": [
        [
          {
            "node": "Split out task changes",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check tag restriction": {
      "main": [
        [
          {
            "node": "Process tags and check if found in configured tags",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Roll back task status from done to previous state1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook call by Awork": {
      "main": [
        [
          {
            "node": "Workflow config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check tag restriction1": {
      "main": [
        [
          {
            "node": "Process tags and check if found in configured tags1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Check tracked time",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split out task changes": {
      "main": [
        [
          {
            "node": "Filter task status change",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Load system type of work": {
      "main": [
        [
          {
            "node": "Load task details for time tracking item",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter task status change": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if comments are enabled": {
      "main": [
        [
          {
            "node": "Add comment to tasks",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if comments are enabled1": {
      "main": [
        [
          {
            "node": "Add comment to tasks1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if tags listed in config node": {
      "main": [
        [
          {
            "node": "Roll back task status from done to previous state",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if force time tracking enabled": {
      "main": [
        [
          {
            "node": "Check tag restriction",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Add start time to time tracking entry": {
      "main": [
        [
          {
            "node": "Check if min time tracking OR time tracking cleanup is enabled",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate time for added time tracking": {
      "main": [
        [
          {
            "node": "Add tracked time to match min time settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate time for added time tracking1": {
      "main": [
        [
          {
            "node": "Roll back task status from done to previous state4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Load task details for time tracking item": {
      "main": [
        [
          {
            "node": "If2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Roll back task status from done to previous state": {
      "main": [
        [
          {
            "node": "Check if comments are enabled",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process tags and check if found in configured tags": {
      "main": [
        [
          {
            "node": "Check if tags listed in config node",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Roll back task status from done to previous state1": {
      "main": [
        [
          {
            "node": "Check if comments are enabled1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Roll back task status from done to previous state4": {
      "main": [
        []
      ]
    },
    "Process tags and check if found in configured tags1": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if min time tracking OR time tracking cleanup is enabled": {
      "main": [
        [
          {
            "node": "Check tag restriction1",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    }
  }
}