{
  "createdAt": "2025-09-25T17:56:35.562Z",
  "updatedAt": "2025-10-15T17:00:26.323Z",
  "id": "mfRDGjHd83mvMZwI",
  "name": "ITHome\u6bd4\u8cfd\u9032\u7a0b",
  "active": false,
  "isArchived": false,
  "nodes": [
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        160,
        768
      ],
      "id": "ec72e7e1-a78f-4cb9-a413-f4f4a82da456",
      "name": "When clicking \u2018Execute workflow\u2019"
    },
    {
      "parameters": {
        "url": "=https://ithelp.ithome.com.tw/2025ironman/signup/list?page={{ $json.n }}",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "User-Agent",
              "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0 Safari/537.36"
            }
          ]
        },
        "options": {
          "response": {
            "response": {
              "fullResponse": true
            }
          }
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        832,
        672
      ],
      "id": "20f3469c-9a44-4a09-84c8-4457945505b3",
      "name": "HTTP Request"
    },
    {
      "parameters": {
        "operation": "extractHtmlContent",
        "extractionValues": {
          "values": [
            {
              "key": "title",
              "cssSelector": "div.col-md-10 > a",
              "returnArray": true
            },
            {
              "key": "link",
              "cssSelector": "div.col-md-10 > a",
              "returnValue": "attribute",
              "attribute": "href",
              "returnArray": true
            },
            {
              "key": "progress",
              "cssSelector": "div.col-md-10 > div.team-dashboard__box.d-flex.align-items-center.justify-content-between",
              "returnValue": "attribute",
              "attribute": "class",
              "returnArray": true
            },
            {
              "key": "percentage",
              "cssSelector": "div.col-md-10 > div.team-dashboard__box.d-flex.align-items-center.justify-content-between > div > div > div > span",
              "returnValue": "attribute",
              "attribute": "title",
              "returnArray": true
            },
            {
              "key": "days",
              "cssSelector": "div.team-dashboard__box.d-flex.align-items-center.justify-content-between > label",
              "returnArray": true
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.html",
      "typeVersion": 1.2,
      "position": [
        1056,
        544
      ],
      "id": "6810961c-0042-4e9e-9eb7-5e76bd0e255f",
      "name": "HTML"
    },
    {
      "parameters": {
        "fieldToSplitOut": "link",
        "options": {}
      },
      "type": "n8n-nodes-base.splitOut",
      "typeVersion": 1,
      "position": [
        1504,
        432
      ],
      "id": "ce53be50-eec3-46ba-9288-f864d791a175",
      "name": "Link-Split Out"
    },
    {
      "parameters": {
        "fieldToSplitOut": "title",
        "options": {}
      },
      "type": "n8n-nodes-base.splitOut",
      "typeVersion": 1,
      "position": [
        1504,
        240
      ],
      "id": "f83716fc-863f-4a31-8b0b-ca2ce53e3cd2",
      "name": "title-Split Out"
    },
    {
      "parameters": {
        "fieldToSplitOut": "progress",
        "options": {}
      },
      "type": "n8n-nodes-base.splitOut",
      "typeVersion": 1,
      "position": [
        1328,
        624
      ],
      "id": "e9516e87-7ced-4ad1-9b78-70ccfdc126a2",
      "name": "progress-Split Out"
    },
    {
      "parameters": {
        "fieldToSplitOut": "percentage",
        "options": {}
      },
      "type": "n8n-nodes-base.splitOut",
      "typeVersion": 1,
      "position": [
        1312,
        848
      ],
      "id": "faf50ff9-0447-4ce4-9013-26ffbd46b0ba",
      "name": "percentage-Split Out"
    },
    {
      "parameters": {
        "jsCode": "// n8n Code Node (JavaScript)\nreturn items.map(item => {\n  const match = item.json.progress.match(/team-progress--(success|fail|challenge)/);\n  return {\n    json: {\n      status: match ? match[1] : null\n    }\n  };\n});\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1504,
        624
      ],
      "id": "5117d06d-745d-4712-8faa-1621d935d0af",
      "name": "Code in JavaScript"
    },
    {
      "parameters": {
        "mode": "combine",
        "combineBy": "combineByPosition",
        "numberInputs": 5,
        "options": {}
      },
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3.2,
      "position": [
        1728,
        496
      ],
      "id": "29bbd2e9-541f-4b23-aa22-98413fb329f1",
      "name": "Merge"
    },
    {
      "parameters": {
        "jsCode": "// n8n Code Node (JavaScript)\nconst items = [];\nfor (let i = 1; i <= 91; i++) {\n  items.push({\n    json: {\n      n: i\n    }\n  });\n}\nreturn items;\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        384,
        592
      ],
      "id": "5102906f-50be-45ee-ab73-320335894ab7",
      "name": "Code in JavaScript1"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        608,
        688
      ],
      "id": "e765f249-734a-4fd7-b345-5dccf56e5b32",
      "name": "Loop Over Items"
    },
    {
      "parameters": {
        "operation": "appendOrUpdate",
        "documentId": {
          "__rl": true,
          "value": "1uILIQME6bBW_ZLQZ6MaakiLlGS-uf1ZvRIXH56OkrKw",
          "mode": "list",
          "cachedResultName": "ithome",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1uILIQME6bBW_ZLQZ6MaakiLlGS-uf1ZvRIXH56OkrKw/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Sheet1",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1uILIQME6bBW_ZLQZ6MaakiLlGS-uf1ZvRIXH56OkrKw/edit#gid=0"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "url": "={{ $json.link }}",
            "title": "={{ $json.title }}",
            "percentage": "={{ $json.percentage }}",
            "status": "={{ $json.status }}",
            "days": "={{ $json.days }}"
          },
          "matchingColumns": [
            "url"
          ],
          "schema": [
            {
              "id": "title",
              "displayName": "title",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "url",
              "displayName": "url",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "percentage",
              "displayName": "percentage",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "status",
              "displayName": "status",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "days",
              "displayName": "days",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        1952,
        528
      ],
      "id": "5fb3c2f7-5ff9-4363-ae95-cb835caee0aa",
      "name": "Append or update row in sheet",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "onError": "continueErrorOutput"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        2176,
        624
      ],
      "id": "c7280667-a738-4035-8e14-55770efb6faf",
      "name": "Wait"
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "1uILIQME6bBW_ZLQZ6MaakiLlGS-uf1ZvRIXH56OkrKw",
          "mode": "list",
          "cachedResultName": "ithome",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1uILIQME6bBW_ZLQZ6MaakiLlGS-uf1ZvRIXH56OkrKw/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Sheet1",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1uILIQME6bBW_ZLQZ6MaakiLlGS-uf1ZvRIXH56OkrKw/edit#gid=0"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        160,
        -32
      ],
      "id": "5e0698f9-aeb9-4426-8b08-cc4fe9feed66",
      "name": "Get row(s) in sheet",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "onError": "continueErrorOutput"
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "1uILIQME6bBW_ZLQZ6MaakiLlGS-uf1ZvRIXH56OkrKw",
          "mode": "list",
          "cachedResultName": "ithome",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1uILIQME6bBW_ZLQZ6MaakiLlGS-uf1ZvRIXH56OkrKw/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 1883270806,
          "mode": "list",
          "cachedResultName": "Sheet2",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1uILIQME6bBW_ZLQZ6MaakiLlGS-uf1ZvRIXH56OkrKw/edit#gid=1883270806"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "fail": "={{ $json.fail }}",
            "challenge": "={{ $json.challenge }}",
            "success": "={{ $json.success }}",
            "date": "={{ $now.format('DD HH:mm:ss') }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "date",
              "displayName": "date",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "success",
              "displayName": "success",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "challenge",
              "displayName": "challenge",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "fail",
              "displayName": "fail",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "report",
              "displayName": "report",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        608,
        -176
      ],
      "id": "9690dca9-a5ac-40e4-b10c-33ffe2b68f52",
      "name": "Append row in sheet",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "// n8n Code Node (JavaScript)\nlet counts = {\n  success: 0,\n  fail: 0,\n  challenge: 0\n};\n\nfor (const item of items) {\n  const status = item.json.status;\n  if (counts[status] !== undefined) {\n    counts[status]++;\n  }\n}\n\nreturn [\n  {\n    json: counts\n  }\n];\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        384,
        -176
      ],
      "id": "20aff2f3-5fb1-4a9f-973d-8aac5f8acf64",
      "name": "Code success"
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 1
            }
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        -64,
        528
      ],
      "id": "6966048f-6ba6-4aef-85b8-89327d215bdc",
      "name": "Schedule Trigger"
    },
    {
      "parameters": {
        "workflowInputs": {
          "values": [
            {
              "name": "done"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "typeVersion": 1.1,
      "position": [
        -64,
        -32
      ],
      "id": "8139c046-7fe4-4adc-8769-45926db7cfb9",
      "name": "When Executed by Another Workflow"
    },
    {
      "parameters": {
        "workflowId": {
          "__rl": true,
          "value": "mfRDGjHd83mvMZwI",
          "mode": "list",
          "cachedResultName": "ITHome\u6bd4\u8cfd\u9032\u7a0b"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "done": "Yes"
          },
          "matchingColumns": [
            "done"
          ],
          "schema": [
            {
              "id": "done",
              "displayName": "done",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        },
        "options": {}
      },
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.2,
      "position": [
        1056,
        352
      ],
      "id": "0146c364-52c5-413a-8a8c-eca6648bc117",
      "name": "Call 'ITHome\u6bd4\u8cfd\u9032\u7a0b'"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "cb9da118-6068-4cef-bf3c-15388840f784",
              "leftValue": "={{ $now.toISODate() }}",
              "rightValue": "2025-10-16T00:00:00",
              "operator": {
                "type": "dateTime",
                "operation": "before"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        160,
        528
      ],
      "id": "2bb0ed17-f502-4295-b191-8e194b0ba680",
      "name": "If"
    },
    {
      "parameters": {
        "operation": "deactivate",
        "workflowId": {
          "__rl": true,
          "value": "mfRDGjHd83mvMZwI",
          "mode": "list",
          "cachedResultName": "ITHome\u6bd4\u8cfd\u9032\u7a0b (#mfRDGjHd83mvMZwI)"
        },
        "requestOptions": {}
      },
      "type": "n8n-nodes-base.n8n",
      "typeVersion": 1,
      "position": [
        384,
        784
      ],
      "id": "974983e1-a65c-4d84-930f-1871f833ef50",
      "name": "Deactivate a workflow",
      "credentials": {
        "n8nApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "amount": 1,
        "unit": "minutes"
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        384,
        16
      ],
      "id": "d64a2128-6e1d-43f8-b15a-2e4f047eefce",
      "name": "Wait1"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        2176,
        1104
      ],
      "id": "14aa51b1-7698-47e0-92d6-a7741fb88de1",
      "name": "Wait2"
    },
    {
      "parameters": {
        "fieldToSplitOut": "days",
        "options": {}
      },
      "type": "n8n-nodes-base.splitOut",
      "typeVersion": 1,
      "position": [
        1312,
        1008
      ],
      "id": "cacfa6a6-8405-474f-8be0-a1482a861a47",
      "name": "days Split Out"
    },
    {
      "parameters": {
        "jsCode": "// n8n Code node (JavaScript)\n\nreturn items.map(item => {\n  const text = item.json.days;\n\n  let num = 0;\n  if (/DAY\\s*(\\d+)/i.test(text)) {\n    num = parseInt(text.replace(\"DAY\", \"\").trim(), 10);\n  }\n\n  return {\n    json: {\n      days: num\n    }\n  };\n});\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1520,
        992
      ],
      "id": "a27ed2a9-de94-416c-8d50-eac1b9ec28cf",
      "name": "Code in JavaScript day"
    }
  ],
  "connections": {
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Code in JavaScript1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTML": {
      "main": [
        [
          {
            "node": "title-Split Out",
            "type": "main",
            "index": 0
          },
          {
            "node": "Link-Split Out",
            "type": "main",
            "index": 0
          },
          {
            "node": "progress-Split Out",
            "type": "main",
            "index": 0
          },
          {
            "node": "percentage-Split Out",
            "type": "main",
            "index": 0
          },
          {
            "node": "days Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "progress-Split Out": {
      "main": [
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "percentage-Split Out": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 3
          }
        ]
      ]
    },
    "title-Split Out": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Link-Split Out": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "Code in JavaScript1": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Call 'ITHome\u6bd4\u8cfd\u9032\u7a0b'",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Append or update row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append or update row in sheet": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet": {
      "main": [
        [
          {
            "node": "Code success",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code success": {
      "main": [
        [
          {
            "node": "Append row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "Code in JavaScript1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Deactivate a workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait1": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait2": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "days Split Out": {
      "main": [
        [
          {
            "node": "Code in JavaScript day",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript day": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 4
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": {
    "node:Schedule Trigger": {
      "recurrenceRules": []
    }
  },
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "versionId": "d6ac5a94-987f-4bd5-a4c2-5d4b35fa4824",
  "triggerCount": 1,
  "shared": [
    {
      "createdAt": "2025-09-25T17:56:35.562Z",
      "updatedAt": "2025-09-25T17:56:35.562Z",
      "role": "workflow:owner",
      "workflowId": "mfRDGjHd83mvMZwI",
      "projectId": "6NV7foKyOeJG8Mz6"
    }
  ],
  "tags": [
    {
      "createdAt": "2025-09-14T06:27:04.834Z",
      "updatedAt": "2025-09-14T06:27:04.834Z",
      "id": "S14KyMmdLj6QsyYh",
      "name": "ithome"
    }
  ]
}