{
  "name": "Handle GDPR access and erasure emails with Gmail, GPT-4o, Supabase and Airtable",
  "nodes": [
    {
      "id": "d9dc102f-c0f6-429d-98f2-87569eea5b5a",
      "name": "Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        22288,
        6288
      ],
      "parameters": {
        "width": 680,
        "height": 340,
        "content": "## GDPR Data Subject Request Handler\nVersion 1.0.0 — Compliance\n\nProcesses inbound GDPR access/erasure requests from Gmail. Classifies the request with AI, queries Supabase (primary DB) and Airtable ("
      }
    },
    {
      "id": "4e918b7c-94b3-4435-a71f-073b5064184c",
      "name": "Prerequisites",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        22976,
        6256
      ],
      "parameters": {
        "width": 420,
        "height": 376,
        "content": "## Prerequisites\n- Gmail account for incoming DSR emails (Gmail OAuth2 credential)\n- OpenAI API key (GPT-4o)\n- Supabase project with users table (Supabase API credential)\n- Airtable base with a Contac"
      }
    },
    {
      "id": "80c01d34-2f1e-40b6-812d-ca37a3e351f0",
      "name": "Setup Required",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        23392,
        6256
      ],
      "parameters": {
        "width": 420,
        "height": 376,
        "content": "## Setup Required\n1. Gmail Trigger — connect Gmail OAuth2 credential\n2. Classify DSR Request — connect OpenAI credential\n3. Query Supabase — connect Supabase API credential, update table name 'users'\n"
      }
    },
    {
      "id": "09b6bd7a-f2c5-4ca3-936c-da80f2540858",
      "name": "How It Works",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        22288,
        6640
      ],
      "parameters": {
        "width": 500,
        "height": 504,
        "content": "## How It Works\n1. Gmail Trigger fires when a new email arrives\n2. AI Agent classifies: access or erasure, extracts requester and data subject email\n3. Supabase queried for all rows matching data subj"
      }
    },
    {
      "id": "fe4f8c23-c0aa-4e1e-86a6-7d7f20864c34",
      "name": "Gmail — DSR Inbox",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        22816,
        7008
      ]
    },
    {
      "id": "88128837-7fd8-4b42-b94e-87f407fbfa93",
      "name": "Classify note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        22976,
        6896
      ],
      "parameters": {
        "width": 270,
        "height": 60,
        "content": "AI classifies request type and extracts emails from raw email body"
      }
    },
    {
      "id": "985b7f4e-6be7-4557-a765-0edfe3cdbae8",
      "name": "Classify DSR Request",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        23024,
        7008
      ]
    },
    {
      "id": "42f1ca01-579a-4135-9e46-16f630a38d89",
      "name": "OpenAI — Classify",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        22928,
        7232
      ]
    },
    {
      "id": "16c5bb7d-13b5-4562-aa50-0285106065d7",
      "name": "DSR Classification Schema",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        23200,
        7264
      ]
    },
    {
      "id": "d70dac45-5751-4c96-9a68-487f475df720",
      "name": "Supabase note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        23280,
        6880
      ],
      "parameters": {
        "width": 207,
        "height": 80,
        "content": "Query users table for all rows matching data subject email"
      }
    },
    {
      "id": "8da85649-609d-45af-8752-f1fa2c34cd93",
      "name": "Query Supabase",
      "type": "n8n-nodes-base.supabase",
      "position": [
        23280,
        7008
      ]
    },
    {
      "id": "84f6fcc1-7429-4e2d-afc5-ec540a4c015f",
      "name": "Consolidate DB note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        23504,
        6880
      ],
      "parameters": {
        "width": 254,
        "height": 80,
        "content": "Merges all Supabase rows into a single item to prevent duplication downstream"
      }
    },
    {
      "id": "d66531e0-60c3-4b63-b642-72209e325bff",
      "name": "Consolidate DB Results",
      "type": "n8n-nodes-base.code",
      "position": [
        23536,
        6992
      ]
    },
    {
      "id": "a033148d-af5b-4f3e-803b-e93381db0293",
      "name": "Airtable note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        23792,
        6896
      ],
      "parameters": {
        "width": 207,
        "height": 80,
        "content": "Query CRM Contacts table for matching email via filterByFormula"
      }
    },
    {
      "id": "007bb8cc-847c-41ad-8fe7-e69be4ba79be",
      "name": "Query Airtable CRM",
      "type": "n8n-nodes-base.airtable",
      "position": [
        23792,
        6992
      ]
    },
    {
      "id": "1cc4fe23-20d4-4437-8d3b-4b1b440e9d80",
      "name": "Consolidate CRM note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        24032,
        6880
      ],
      "parameters": {
        "width": 223,
        "height": 80,
        "content": "Merges all Airtable rows into a single item for the AI agent"
      }
    },
    {
      "id": "9e9ff4e0-e746-4ed8-92c9-13934d6748e8",
      "name": "Consolidate CRM Results",
      "type": "n8n-nodes-base.code",
      "position": [
        24064,
        6976
      ]
    },
    {
      "id": "b9ebe3ed-956e-47de-8139-b8c444c581fe",
      "name": "Compile note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        24288,
        6880
      ],
      "parameters": {
        "width": 260,
        "height": 60,
        "content": "AI compiles all data sources into a legally-compliant GDPR report email"
      }
    },
    {
      "id": "de779723-f8ad-41e2-845a-fe133b4fdad9",
      "name": "Compile Data Report",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        24320,
        6976
      ]
    },
    {
      "id": "f249f49c-77ed-42ac-86cf-205043471096",
      "name": "OpenAI — Compile",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        24240,
        7200
      ]
    },
    {
      "id": "1863c521-22af-4d12-b3dd-d2dc718e932b",
      "name": "Report Schema",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        24512,
        7200
      ]
    },
    {
      "id": "4092c85e-ce28-4e1a-b62a-96b304bce56b",
      "name": "Route note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        24592,
        6880
      ],
      "parameters": {
        "width": 255,
        "height": 60,
        "content": "Routes to access response path or erasure execution path"
      }
    },
    {
      "id": "d97df75d-bd31-43b3-ac41-317c82b29f3e",
      "name": "Access or Erasure?",
      "type": "n8n-nodes-base.if",
      "position": [
        24576,
        7008
      ]
    },
    {
      "id": "1b0d1c25-da19-424e-8473-045ff6961d43",
      "name": "Send Access Report",
      "type": "n8n-nodes-base.gmail",
      "position": [
        24912,
        6880
      ]
    },
    {
      "id": "84422f4f-839c-47e0-9f5e-662da51fa7e0",
      "name": "Delete DB note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        24816,
        7072
      ],
      "parameters": {
        "width": 250,
        "height": 60,
        "content": "Deletes data subject records from Supabase (primary DB)"
      }
    },
    {
      "id": "1850bb05-78a2-4b9d-9358-65c556592e58",
      "name": "Delete from Supabase",
      "type": "n8n-nodes-base.supabase",
      "position": [
        24832,
        7184
      ]
    },
    {
      "id": "56166b3e-69aa-4944-8d77-bee31be3f5bc",
      "name": "Delete from Airtable",
      "type": "n8n-nodes-base.airtable",
      "position": [
        25104,
        7168
      ]
    },
    {
      "id": "b72a3a77-b10b-4cb8-9fa3-8a42deaf73f8",
      "name": "Send Erasure Confirmation",
      "type": "n8n-nodes-base.gmail",
      "position": [
        25360,
        7152
      ]
    },
    {
      "id": "862503ff-b689-47c2-bb91-2dc2013ed77a",
      "name": "Merge note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        25440,
        6816
      ],
      "parameters": {
        "width": 260,
        "height": 60,
        "content": "Merges both paths back to a single flow for audit logging"
      }
    },
    {
      "id": "61adce98-8cac-441b-a785-e3664479ac4f",
      "name": "Merge Paths",
      "type": "n8n-nodes-base.merge",
      "position": [
        25488,
        6928
      ]
    },
    {
      "id": "b5f11bb5-88fb-4bc5-8417-eb3bc2b9bfc4",
      "name": "Audit note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        25824,
        6816
      ],
      "parameters": {
        "width": 260,
        "height": 60,
        "content": "Logs every DSR to Google Sheets for GDPR-required audit trail"
      }
    },
    {
      "id": "5ca6fe3f-4239-4ee8-9598-079ebf6e95fe",
      "name": "Log Audit Trail",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        25872,
        6928
      ]
    }
  ],
  "connections": {
    "Merge Paths": {
      "main": [
        [
          {
            "node": "Log Audit Trail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Report Schema": {
      "ai_outputParser": [
        [
          {
            "node": "Compile Data Report",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Query Supabase": {
      "main": [
        [
          {
            "node": "Consolidate DB Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Access or Erasure?": {
      "main": [
        [
          {
            "node": "Send Access Report",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Delete from Supabase",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI — Compile": {
      "ai_languageModel": [
        [
          {
            "node": "Compile Data Report",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Query Airtable CRM": {
      "main": [
        [
          {
            "node": "Consolidate CRM Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Access Report": {
      "main": [
        [
          {
            "node": "Merge Paths",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Compile Data Report": {
      "main": [
        [
          {
            "node": "Access or Erasure?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail — DSR Inbox": {
      "main": [
        [
          {
            "node": "Classify DSR Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI — Classify": {
      "ai_languageModel": [
        [
          {
            "node": "Classify DSR Request",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Classify DSR Request": {
      "main": [
        [
          {
            "node": "Query Supabase",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Delete from Airtable": {
      "main": [
        [
          {
            "node": "Send Erasure Confirmation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Delete from Supabase": {
      "main": [
        [
          {
            "node": "Delete from Airtable",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Consolidate DB Results": {
      "main": [
        [
          {
            "node": "Query Airtable CRM",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Consolidate CRM Results": {
      "main": [
        [
          {
            "node": "Compile Data Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "DSR Classification Schema": {
      "ai_outputParser": [
        [
          {
            "node": "Classify DSR Request",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Send Erasure Confirmation": {
      "main": [
        [
          {
            "node": "Merge Paths",
            "type": "main",
            "index": 1
          }
        ]
      ]
    }
  }
}