{
  "id": "3",
  "name": "Clockify to Syncro",
  "nodes": [
    {
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        280,
        350
      ],
      "webhookId": "82b654d7-aeb2-4cc1-97a8-0ebd1a729202",
      "parameters": {
        "path": "82b654d7-aeb2-4cc1-97a8-0ebd1a729202",
        "options": {},
        "httpMethod": "POST",
        "responseData": "allEntries",
        "responseMode": "lastNode"
      },
      "typeVersion": 1,
      "id": "node-30370070"
    },
    {
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1830,
        350
      ],
      "parameters": {
        "range": "A:B",
        "options": {
          "valueInputMode": "USER_ENTERED"
        },
        "sheetId": "xxx",
        "operation": "append"
      },
      "typeVersion": 1,
      "id": "node-e871bc41"
    },
    {
      "name": "ForGoogle",
      "type": "n8n-nodes-base.set",
      "position": [
        1650,
        350
      ],
      "parameters": {
        "values": {
          "string": [
            {
              "name": "Syncro",
              "value": "={{$json[\"id\"]}}"
            },
            {
              "name": "Clockify",
              "value": "={{$node[\"Webhook\"].json[\"body\"][\"id\"]}}"
            }
          ]
        },
        "options": {},
        "keepOnlySet": true
      },
      "typeVersion": 1,
      "id": "node-06babf7d"
    },
    {
      "name": "ForSyncro",
      "type": "n8n-nodes-base.set",
      "position": [
        730,
        350
      ],
      "parameters": {
        "values": {
          "string": [
            {
              "name": "id",
              "value": "={{ $json[\"body\"][\"project\"][\"name\"].match(/\\[(\\d+)]/)[1] }}"
            }
          ]
        },
        "options": {},
        "keepOnlySet": true
      },
      "typeVersion": 1,
      "id": "node-9ab0e287"
    },
    {
      "name": "FindMatch",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1130,
        350
      ],
      "parameters": {
        "range": "A:B",
        "options": {
          "valueRenderMode": "UNFORMATTED_VALUE",
          "returnAllMatches": true
        },
        "sheetId": "xxx",
        "operation": "lookup",
        "lookupValue": "={{$node[\"Webhook\"].json[\"body\"][\"id\"]}}",
        "lookupColumn": "=Clockify"
      },
      "typeVersion": 1,
      "alwaysOutputData": true,
      "id": "node-29569fe6"
    },
    {
      "name": "IF",
      "type": "n8n-nodes-base.if",
      "position": [
        1300,
        350
      ],
      "parameters": {
        "conditions": {
          "string": [],
          "boolean": [
            {
              "value1": "={{!!Object.keys($node[\"FindMatch\"].data).length}}",
              "value2": true
            }
          ]
        }
      },
      "typeVersion": 1,
      "alwaysOutputData": false,
      "id": "node-6891ae26"
    },
    {
      "name": "NewSyncroTimer",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1490,
        350
      ],
      "parameters": {
        "url": "{{ $env.BASE_URL }}",
        "options": {},
        "requestMethod": "POST",
        "authentication": "{{ $credentials.headerAuth }}",
        "bodyParametersUi": {
          "parameter": [
            {
              "name": "start_at",
              "value": "={{$node[\"Webhook\"].json[\"body\"][\"timeInterval\"][\"start\"]}}"
            },
            {
              "name": "end_at",
              "value": "={{$node[\"Webhook\"].json[\"body\"][\"timeInterval\"][\"end\"]}}"
            },
            {
              "name": "notes",
              "value": "={{$node[\"Webhook\"].json[\"body\"][\"description\"]}}"
            },
            {
              "name": "user_id",
              "value": "={{$node[\"MatchTechnician\"].json[\"id\"]}}"
            }
          ]
        }
      },
      "typeVersion": 1,
      "id": "node-7ab8e15b"
    },
    {
      "name": "UpdateSyncroTimer",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1490,
        580
      ],
      "parameters": {
        "url": "{{ $env.BASE_URL }}",
        "options": {
          "followRedirect": true
        },
        "requestMethod": "PUT",
        "authentication": "{{ $credentials.headerAuth }}",
        "bodyParametersUi": {
          "parameter": [
            {
              "name": "timer_entry_id",
              "value": "={{$node[\"IF\"].json[\"Syncro\"]}}"
            },
            {
              "name": "start_time",
              "value": "={{$node[\"Webhook\"].json[\"body\"][\"timeInterval\"][\"start\"]}}"
            },
            {
              "name": "end_time",
              "value": "={{$node[\"Webhook\"].json[\"body\"][\"timeInterval\"][\"end\"]}}"
            },
            {
              "name": "notes",
              "value": "={{$node[\"Webhook\"].json[\"body\"][\"description\"]}}"
            },
            {
              "name": "user_id",
              "value": "={{$node[\"MatchTechnician\"].json[\"id\"]}}"
            }
          ]
        }
      },
      "typeVersion": 1,
      "id": "node-3c5bad05"
    },
    {
      "name": "EnvVariables",
      "type": "n8n-nodes-base.set",
      "position": [
        580,
        350
      ],
      "parameters": {
        "values": {
          "string": [
            {
              "name": "syncro_baseurl",
              "value": "https://subdomain.syncromsp.com"
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 1,
      "id": "node-086894df"
    },
    {
      "name": "SetTechnicians",
      "type": "n8n-nodes-base.set",
      "position": [
        870,
        350
      ],
      "parameters": {
        "values": {
          "string": [
            {
              "name": "Tech 1",
              "value": "1234"
            },
            {
              "name": "Tech 2",
              "value": "5678"
            }
          ]
        },
        "options": {},
        "keepOnlySet": true
      },
      "typeVersion": 1,
      "id": "node-b4706ad8"
    },
    {
      "name": "MatchTechnician",
      "type": "n8n-nodes-base.function",
      "position": [
        1000,
        350
      ],
      "parameters": {
        "functionCode": "\nconst results = [];\n\nconst user = $node[\"Webhook\"].json[\"body\"][\"user\"];\n\nconst persons = items[0].json\n\nfor (key of Object.keys(persons)) {\n  if (key === user.name) {\n    results.push({ json: { id: persons[key], name: key } })\n  }\n}\n\nreturn results;"
      },
      "typeVersion": 1,
      "id": "node-8f4ab1d1"
    },
    {
      "name": "IF1",
      "type": "n8n-nodes-base.if",
      "position": [
        420,
        350
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{$json[\"body\"][\"project\"][\"name\"]}}",
              "value2": "Ticket",
              "operation": "contains"
            }
          ]
        }
      },
      "typeVersion": 1,
      "id": "node-a0e68cce"
    },
    {
      "name": "NoOp",
      "type": "n8n-nodes-base.noOp",
      "position": [
        480,
        520
      ],
      "parameters": {},
      "typeVersion": 1,
      "id": "node-d3487938"
    },
    {
      "id": "error-dc46e22b",
      "name": "Error Handler",
      "type": "n8n-nodes-base.stopAndError",
      "typeVersion": 1,
      "position": [
        1000,
        400
      ],
      "parameters": {
        "message": "Workflow execution error",
        "options": {}
      }
    }
  ],
  "active": true,
  "settings": {
    "executionOrder": "v1",
    "saveManualExecutions": true,
    "callerPolicy": "workflowsFromSameOwner",
    "errorWorkflow": null,
    "timezone": "UTC",
    "executionTimeout": 3600,
    "maxExecutions": 1000,
    "retryOnFail": true,
    "retryCount": 3
  },
  "connections": {},
  "meta": {
    "versionId": "1.0.0",
    "createdAt": "2025-09-29T07:07:46.188198",
    "updatedAt": "2025-09-29T07:07:46.188209",
    "owner": "n8n-user",
    "license": "MIT",
    "category": "automation",
    "status": "active",
    "priority": "high",
    "environment": "production"
  },
  "tags": [
    "automation",
    "n8n",
    "production-ready",
    "excellent",
    "optimized"
  ],
  "description": "Production-ready workflow: Clockify to Syncro. This workflow has been optimized for production use with comprehensive error handling, security, and documentation."
}