{
  "name": "07 · Data & Analytics / GDPR Subject Access Export",
  "active": false,
  "nodes": [
    {
      "id": "c30b3c3c-a16f-4e1d-860f-c6e71979da92",
      "name": "📘 Guide",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -640,
        -120
      ],
      "parameters": {
        "content": "## 07 · Data & Analytics · GDPR Subject Access Export\n\n### What this does\nOn DSR request, collects user data from systems, packages export, and notifies privacy officer.\n\n### Setup checklist\n1. User ID lookup APIs\n2. Secure file store\n3. Legal email\n\n### How to test locally\nPOST `data-gdpr-export` with `{ \"userId\":\"...\" }`\n\n### Tips\n- Keep credentials in n8n Credentials (never hardcode secrets).\n- Use **Test URL** on the Webhook while developing.\n- Activate only after credentials + destinations are configured.\n",
        "width": 560,
        "height": 560,
        "color": 7
      }
    },
    {
      "id": "ddab3f9b-d907-46b1-9b83-3fe5047159ea",
      "name": "⚙️ Config",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -640,
        480
      ],
      "parameters": {
        "content": "## Config map\n\n- **Webhook path:** `data-gdpr-export`\n- **Replace** all `https://httpbin.org/...` calls with real integrations.\n- **Credentials:** create in n8n → Credentials, then select on HTTP nodes.\n- **Activate** workflow only after a successful Test execution.\n\n### Local files\nShared host folder is mounted at `/files` inside n8n.",
        "width": 560,
        "height": 320,
        "color": 2
      }
    },
    {
      "id": "55c8ed54-124a-4891-abbc-57a779491bab",
      "name": "Intake Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        200
      ],
      "webhookId": "3e881246-8297-4451-a11e-cade4badedd1",
      "parameters": {
        "httpMethod": "POST",
        "path": "data-gdpr-export",
        "responseMode": "responseNode",
        "options": {}
      }
    },
    {
      "id": "59b347ca-a841-491a-9b44-033f512bd962",
      "name": "Validate & Risk Score",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        280,
        200
      ],
      "parameters": {
        "mode": "runOnceForAllItems",
        "language": "javaScript",
        "jsCode": "const body = $input.first().json.body || $input.first().json;\nconst risk = Number(body.riskScore ?? (String(body.caption||body.copy||'').match(/guarantee|free money|urgent/i) ? 80 : 20));\nconst approved = risk < 60 || body.token === 'APPROVE' || body.autoApprove === true;\nreturn [{ json: { ...body, risk, approved, decision: approved ? 'pass' : 'hold' } }];"
      }
    },
    {
      "id": "33c315bf-6fb1-41a7-937c-afb0e55ebe20",
      "name": "Approved?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        560,
        200
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "1822021d-8739-41e3-aafa-3cc5f4043cb9",
              "leftValue": "={{ $json.approved }}",
              "rightValue": true,
              "operator": {
                "type": "boolean",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "id": "3b73b57e-f732-46ec-8231-5f04596d1160",
      "name": "Execute Action",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        840,
        80
      ],
      "parameters": {
        "method": "POST",
        "url": "https://httpbin.org/post",
        "options": {},
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify($json) }}"
      }
    },
    {
      "id": "2bb2c60b-e863-4610-b1f9-8ce5a92396c1",
      "name": "Hold for Review",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        840,
        320
      ],
      "parameters": {
        "mode": "manual",
        "duplicateItem": false,
        "assignments": {
          "assignments": [
            {
              "id": "1",
              "name": "status",
              "value": "pending_approval",
              "type": "string"
            },
            {
              "id": "2",
              "name": "next",
              "value": "Send APPROVE token to resume / approve path",
              "type": "string"
            }
          ]
        },
        "options": {}
      }
    },
    {
      "id": "e550472b-b975-4f9c-9bbc-edf3a84f3d37",
      "name": "Webhook Response",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        1120,
        200
      ],
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ $json }}",
        "options": {}
      }
    }
  ],
  "connections": {
    "Intake Webhook": {
      "main": [
        [
          {
            "node": "Validate & Risk Score",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate & Risk Score": {
      "main": [
        [
          {
            "node": "Approved?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Approved?": {
      "main": [
        [
          {
            "node": "Execute Action",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Hold for Review",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Action": {
      "main": [
        [
          {
            "node": "Webhook Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Hold for Review": {
      "main": [
        [
          {
            "node": "Webhook Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "callerPolicy": "workflowsFromSameOwner"
  },
  "tags": [],
  "meta": {
    "templateCredsSetupCompleted": true,
    "description": "On DSR request, collects user data from systems, packages export, and notifies privacy officer."
  },
  "pinData": {}
}