{
  "name": "Review and approve Google Sheets orders by email and notify via LINE",
  "nodes": [
    {
      "id": "6eab5afa-3308-47c6-8914-d24128b8d30c",
      "name": "Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        25664,
        8608
      ],
      "parameters": {
        "width": 540,
        "height": 776,
        "content": "## How it works\n1. **Google Sheets Trigger** fires when a new row is added to your Orders sheet\n2. **New order?** skips rows that already have a status — preventing duplicate processing\n3. **Config** "
      }
    },
    {
      "id": "4dd06ec8-aa34-49c6-94bb-907d2b139063",
      "name": "Section A",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        26272,
        8832
      ],
      "parameters": {
        "width": 1160,
        "height": 168,
        "content": "## ⚡ Section A – Order Intake\n\nPolls Google Sheets every minute. Fires for new rows only. Skips rows that already have a `status` value to prevent duplicate processing. Generates a unique approval tok"
      }
    },
    {
      "id": "85d8890d-d80b-48d3-9340-8111af285b71",
      "name": "Email Path",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        27568,
        8640
      ],
      "parameters": {
        "width": 700,
        "height": 380,
        "content": "## 📧 Email Review Path\n\nAmount meets the threshold. Generates independent Approve / Reject links (orderId + token), marks the row as Pending, and emails the reviewer. Each email is stateless — multipl"
      }
    },
    {
      "id": "ff49d8f6-4977-4974-970d-cc2c86b787bb",
      "name": "Auto Path",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        27584,
        9088
      ],
      "parameters": {
        "width": 620,
        "height": 312,
        "content": "## ✅ Auto-Approve Path\n\nAmount is below threshold. Marks the order as Auto-Approved immediately and sends a LINE push notification. No email required."
      }
    },
    {
      "id": "73737ef4-9a99-41bd-8fef-31c14f783db4",
      "name": "Section B",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        26272,
        9408
      ],
      "parameters": {
        "width": 780,
        "height": 168,
        "content": "## 🔗 Section B – Approval Handler\n\nTriggered when a reviewer clicks Approve or Reject in the email. Validates the one-time token, checks the order has not already been processed, then routes to approv"
      }
    },
    {
      "id": "f99fc61f-88e4-49ab-8915-43e1513b6e3d",
      "name": "Approval Actions",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        27600,
        9424
      ],
      "parameters": {
        "width": 876,
        "height": 568,
        "content": "## 🏁 Approval Actions\n\nUpdates Google Sheets with the final status (Approved / Rejected), records a `reviewedAt` timestamp, then sends a LINE push notification. Returns an HTML confirmation page to th"
      }
    },
    {
      "id": "ac6e3843-0468-45d1-8061-e5ae5b7d25f8",
      "name": "Sticky Note – More Templates",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        28512,
        9600
      ],
      "parameters": {
        "width": 412,
        "height": 240,
        "content": "## Want more automation templates?\n\nCheck out the **Content Automation Bundle** — 6 n8n workflows for AI content creation, social media publishing, and Threads analytics.\n\n👉 https://jasonchuang0818.gu"
      }
    },
    {
      "id": "b4cead6b-f732-4dc6-97f3-5c90abd6c152",
      "name": "Google Sheets Trigger",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "position": [
        26288,
        9040
      ]
    },
    {
      "id": "39f1f5af-62b1-4efb-b607-e3a5a69e4cc3",
      "name": "New order?",
      "type": "n8n-nodes-base.if",
      "position": [
        26512,
        9040
      ]
    },
    {
      "id": "46fd5076-d227-4411-a505-b8a9c2f80c1d",
      "name": "Config",
      "type": "n8n-nodes-base.set",
      "position": [
        26736,
        9040
      ]
    },
    {
      "id": "53714208-292c-4f6f-80fc-207f317ee83f",
      "name": "Prepare Order Data",
      "type": "n8n-nodes-base.set",
      "position": [
        26944,
        9040
      ]
    },
    {
      "id": "c85d872c-7c8d-4756-b619-956ab72fd700",
      "name": "Write Approval Token",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        27168,
        9040
      ]
    },
    {
      "id": "df92024d-4e3b-4dde-94f3-883599efa579",
      "name": "Needs Approval?",
      "type": "n8n-nodes-base.if",
      "position": [
        27392,
        9040
      ]
    },
    {
      "id": "9525d87e-1d7c-48d8-a6c3-f278635b5286",
      "name": "Build Approval Links",
      "type": "n8n-nodes-base.set",
      "position": [
        27616,
        8832
      ]
    },
    {
      "id": "a3b43dda-bc7f-43ae-9b20-ff6914f975cc",
      "name": "Mark as Pending Approval",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        27824,
        8832
      ]
    },
    {
      "id": "3a4c6ca1-1ef5-413a-b409-e63f29dac9e3",
      "name": "Send Approval Request",
      "type": "n8n-nodes-base.gmail",
      "position": [
        28048,
        8832
      ]
    },
    {
      "id": "fbdf392e-2014-45d7-b032-2dcd80e41822",
      "name": "Mark as Auto-Approved",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        27616,
        9232
      ]
    },
    {
      "id": "684ce42a-21a1-4279-b963-77826f2bb11b",
      "name": "Prepare LINE Notification (Auto)",
      "type": "n8n-nodes-base.set",
      "position": [
        27824,
        9232
      ]
    },
    {
      "id": "c96e6c80-c9aa-4982-93f3-a391a0980bb3",
      "name": "LINE Push – Auto Approved",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        28048,
        9232
      ]
    },
    {
      "id": "00faff5c-fc18-4d61-92f2-0a81d969e569",
      "name": "Webhook – Approval Handler",
      "type": "n8n-nodes-base.webhook",
      "position": [
        26288,
        9616
      ]
    },
    {
      "id": "25532be8-3a02-4255-a0d6-51a9eb80a188",
      "name": "Extract Approval Params",
      "type": "n8n-nodes-base.set",
      "position": [
        26512,
        9616
      ]
    },
    {
      "id": "f3ffa329-3af4-4ee6-a892-46505e36e32f",
      "name": "Read Order from Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        26736,
        9616
      ]
    },
    {
      "id": "b578a9c1-0b51-4aef-b7cf-c70a73492837",
      "name": "Token Valid?",
      "type": "n8n-nodes-base.if",
      "position": [
        26944,
        9616
      ]
    },
    {
      "id": "855ef536-e483-4db3-b969-1c2160aed595",
      "name": "Respond – Invalid Token",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        27168,
        9808
      ]
    },
    {
      "id": "4c7ab7e6-1686-4f72-b711-3a497a9caf2f",
      "name": "Already Processed?",
      "type": "n8n-nodes-base.if",
      "position": [
        27168,
        9616
      ]
    },
    {
      "id": "5be37fa2-70c9-4c8a-b00e-8343689996e6",
      "name": "Respond – Already Processed",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        27408,
        9440
      ]
    },
    {
      "id": "d1b28499-b7eb-485a-8ca8-ec11208cbe8a",
      "name": "Approve or Reject?",
      "type": "n8n-nodes-base.if",
      "position": [
        27392,
        9616
      ]
    },
    {
      "id": "7b4adf5f-f036-4c9d-8b4a-ad341d96e16c",
      "name": "Mark as Approved",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        27632,
        9600
      ]
    },
    {
      "id": "779352ed-2b2e-427d-abe4-48bf86fb5a8d",
      "name": "Prepare LINE Notification (Approved)",
      "type": "n8n-nodes-base.set",
      "position": [
        27840,
        9600
      ]
    },
    {
      "id": "3f6148b2-e810-4704-ae6e-9c0a17684420",
      "name": "LINE Push – Approved",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        28064,
        9600
      ]
    },
    {
      "id": "6e08156e-62f0-4dd6-b9eb-3bf72e198209",
      "name": "Respond – Order Approved",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        28288,
        9600
      ]
    },
    {
      "id": "90f76d61-27bc-456b-bc3f-067ad2f534ba",
      "name": "Mark as Rejected",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        27632,
        9808
      ]
    },
    {
      "id": "9cfedf3f-f33e-4051-892c-20572209b68d",
      "name": "Prepare LINE Notification (Rejected)",
      "type": "n8n-nodes-base.set",
      "position": [
        27840,
        9808
      ]
    },
    {
      "id": "f4313550-714b-4eb8-9a53-3c0b6ad02529",
      "name": "LINE Push – Rejected",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        28064,
        9808
      ]
    },
    {
      "id": "fc99ddab-933c-47bb-a923-7cf50ce07c5e",
      "name": "Respond – Order Rejected",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        28288,
        9808
      ]
    }
  ],
  "connections": {
    "Config": {
      "main": [
        [
          {
            "node": "Prepare Order Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "New order?": {
      "main": [
        [
          {
            "node": "Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Token Valid?": {
      "main": [
        [
          {
            "node": "Already Processed?",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Respond – Invalid Token",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Needs Approval?": {
      "main": [
        [
          {
            "node": "Build Approval Links",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Mark as Auto-Approved",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mark as Approved": {
      "main": [
        [
          {
            "node": "Prepare LINE Notification (Approved)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mark as Rejected": {
      "main": [
        [
          {
            "node": "Prepare LINE Notification (Rejected)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Already Processed?": {
      "main": [
        [
          {
            "node": "Respond – Already Processed",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Approve or Reject?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Approve or Reject?": {
      "main": [
        [
          {
            "node": "Mark as Approved",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Mark as Rejected",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Order Data": {
      "main": [
        [
          {
            "node": "Write Approval Token",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Approval Links": {
      "main": [
        [
          {
            "node": "Mark as Pending Approval",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Write Approval Token": {
      "main": [
        [
          {
            "node": "Needs Approval?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets Trigger": {
      "main": [
        [
          {
            "node": "New order?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mark as Auto-Approved": {
      "main": [
        [
          {
            "node": "Prepare LINE Notification (Auto)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "LINE Push – Approved": {
      "main": [
        [
          {
            "node": "Respond – Order Approved",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "LINE Push – Rejected": {
      "main": [
        [
          {
            "node": "Respond – Order Rejected",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Order from Sheets": {
      "main": [
        [
          {
            "node": "Token Valid?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Approval Params": {
      "main": [
        [
          {
            "node": "Read Order from Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mark as Pending Approval": {
      "main": [
        [
          {
            "node": "Send Approval Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook – Approval Handler": {
      "main": [
        [
          {
            "node": "Extract Approval Params",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare LINE Notification (Auto)": {
      "main": [
        [
          {
            "node": "LINE Push – Auto Approved",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare LINE Notification (Approved)": {
      "main": [
        [
          {
            "node": "LINE Push – Approved",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare LINE Notification (Rejected)": {
      "main": [
        [
          {
            "node": "LINE Push – Rejected",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}