{
  "name": "Get Malaysia tax ID number (TIN) for multiple business reg num (SSM) or NRIC",
  "nodes": [
    {
      "id": "bc1c95f4-8e6d-4bb2-89f0-b4bbb355ac34",
      "name": "Search Taxpayer TIN",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1640,
        500
      ]
    },
    {
      "id": "07d998a4-54e9-4e21-87e4-5194898e8eac",
      "name": "When clicking ‘Test workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        1180,
        360
      ]
    },
    {
      "id": "a46c6684-f32f-4da5-9531-bc8d627b5350",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        1100,
        620
      ]
    },
    {
      "id": "f282ad6c-c1ec-4b1b-bc91-150a22f4a4f5",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1440,
        -160
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "ffd6cf7d-ca7e-4238-a617-8204d5bef2a7",
      "name": "Loop Over Items1",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        2340,
        680
      ]
    },
    {
      "id": "463a2904-db33-4aa3-8c5b-fed417dde249",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        1820,
        540
      ]
    },
    {
      "id": "718139b2-b844-46a5-8f03-cb15eb6784f8",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        1460,
        580
      ]
    },
    {
      "id": "98ebc32e-a15e-4811-bd70-12037f3bc4ab",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1040,
        -160
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "22e82f27-98c0-4182-923b-02d79556370d",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2020,
        -160
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "169e200f-9700-4150-8b83-c23112e3d312",
      "name": "Setup GSheet Connection",
      "type": "n8n-nodes-base.set",
      "position": [
        1640,
        140
      ]
    },
    {
      "id": "0e5db648-be9f-4291-b900-32759c774d77",
      "name": "Setup LHDN Connection",
      "type": "n8n-nodes-base.set",
      "position": [
        1140,
        140
      ]
    },
    {
      "id": "8602b739-b553-434c-811d-b241448a3082",
      "name": "Remember token expiry",
      "type": "n8n-nodes-base.set",
      "position": [
        1800,
        360
      ]
    },
    {
      "id": "4d5ba7d4-a5d9-46fb-89dc-2ba4d83a9eb9",
      "name": "Compare token expiry vs now",
      "type": "n8n-nodes-base.code",
      "position": [
        1280,
        620
      ]
    },
    {
      "id": "6db6c745-6864-43e9-b39d-c8fc59516c70",
      "name": "Wait until token fully expired",
      "type": "n8n-nodes-base.wait",
      "position": [
        1640,
        660
      ]
    },
    {
      "id": "7bd8564e-14fd-408f-9ab2-37fee034e923",
      "name": "Update Google Sheet with TIN not found",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2080,
        320
      ]
    },
    {
      "id": "9bb6a023-e984-4259-abbe-3c0716e00f8a",
      "name": "Update Google Sheet with failure",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2080,
        500
      ]
    },
    {
      "id": "efc172ea-b6ac-4890-af3d-ed3ab0090c84",
      "name": "Update Google Sheet with found TIN",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2080,
        680
      ]
    },
    {
      "id": "8bb6cf93-4885-4618-a1da-150433452016",
      "name": "Get all Google Sheet records to process",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2080,
        140
      ]
    },
    {
      "id": "5b3e185f-cb6e-4b4f-854a-df84d9b85620",
      "name": "Get new LHDN API Token",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1480,
        360
      ]
    },
    {
      "id": "74fcfc2e-7d86-4d2f-8d66-295d4bed7668",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        600,
        -160
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    }
  ],
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Search Taxpayer TIN",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait until token fully expired",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Compare token expiry vs now",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Update Google Sheet with TIN not found",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update Google Sheet with failure",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update Google Sheet with found TIN",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items1": {
      "main": [
        [],
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search Taxpayer TIN": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remember token expiry": {
      "main": [
        [
          {
            "node": "Get all Google Sheet records to process",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Setup LHDN Connection": {
      "main": [
        [
          {
            "node": "Setup GSheet Connection",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get new LHDN API Token": {
      "main": [
        [
          {
            "node": "Remember token expiry",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Setup GSheet Connection": {
      "main": [
        [
          {
            "node": "Get new LHDN API Token",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Compare token expiry vs now": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait until token fully expired": {
      "main": [
        [
          {
            "node": "Get new LHDN API Token",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Google Sheet with failure": {
      "main": [
        [
          {
            "node": "Loop Over Items1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Setup LHDN Connection",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Google Sheet with found TIN": {
      "main": [
        [
          {
            "node": "Loop Over Items1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Google Sheet with TIN not found": {
      "main": [
        [
          {
            "node": "Loop Over Items1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get all Google Sheet records to process": {
      "main": [
        [
          {
            "node": "Loop Over Items1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}