{
  "name": "Automate legal lien documents with Gemini AI, Apify, and Google Workspace",
  "nodes": [
    {
      "id": "be984026-22bd-46a2-b1d4-37fdf72bad6f",
      "name": "Transform to base64",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        640,
        180
      ]
    },
    {
      "id": "27007f82-2c42-47d4-974d-fd444f33f897",
      "name": "Approve Through Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2120,
        180
      ]
    },
    {
      "id": "bb9dff19-aff9-4207-a7a2-a89d459d048a",
      "name": "Get file for property",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        440,
        300
      ]
    },
    {
      "id": "20b5382a-d97c-4088-a2b9-1772c577b9b3",
      "name": "Apify Playwright script to find property info",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        200,
        300
      ]
    },
    {
      "id": "d69290c6-c288-41e0-9809-909bfde6c223",
      "name": "Property metadata",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1300,
        180
      ]
    },
    {
      "id": "f2926ac2-a475-4ea3-b584-096111f50ab2",
      "name": "Call Gemini API for legal desc",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1080,
        180
      ]
    },
    {
      "id": "9d376366-3423-46d1-8317-e148b0cba684",
      "name": "Google Gemini Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        1620,
        400
      ]
    },
    {
      "id": "6671bb9e-bd6b-4614-a824-273660902c69",
      "name": "Playwright error inform",
      "type": "n8n-nodes-base.gmail",
      "position": [
        420,
        500
      ]
    },
    {
      "id": "bbbfd9b5-2ce3-435d-a4ba-a2c6f2992f4e",
      "name": "Property Information Extractor",
      "type": "@n8n/n8n-nodes-langchain.informationExtractor",
      "position": [
        1520,
        180
      ]
    },
    {
      "id": "ab195330-ea1c-4379-8924-d3a5f9bff045",
      "name": "Upload legal doc",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        860,
        180
      ]
    },
    {
      "id": "2ee92d0a-d85a-4d9c-a5ff-351d4522fcee",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -120,
        -300
      ],
      "parameters": {
        "width": 720,
        "height": 1000,
        "content": "## Trigger the workflow\nCall the Apify playwright actor to fetch the document from the site."
      }
    },
    {
      "id": "31b540e9-8a17-4e2c-94af-25b401dcdaad",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        620,
        -300
      ],
      "parameters": {
        "width": 620,
        "height": 1000,
        "content": "## Prepare document for upload \nPrepare to send document for interpretation by AI. Also keep document in storage in Google Drive for posterity."
      }
    },
    {
      "id": "a8159a38-29f4-4ec8-b62d-18d5371db7c8",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1260,
        -300
      ],
      "parameters": {
        "width": 1060,
        "height": 1000,
        "content": "## Process Information Received\nUpdate the intermediate storage sheet and inform user ready for review."
      }
    },
    {
      "id": "aa13bc59-0737-4aad-8892-817173d0cf4b",
      "name": "Make Copy of Template",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        660,
        1200
      ]
    },
    {
      "id": "e747c01e-02a4-4206-b64e-4a3be13e2c82",
      "name": "Change Custom Variables",
      "type": "n8n-nodes-base.googleDocs",
      "position": [
        880,
        1200
      ]
    },
    {
      "id": "ff2d35fa-c7e9-40ca-967c-7c5dfbaebaca",
      "name": "Generate PDF",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1100,
        1200
      ]
    },
    {
      "id": "39aa9470-3058-498e-9f7c-925939e96234",
      "name": "Add PDF To Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1320,
        1200
      ]
    },
    {
      "id": "2028eb46-fbb7-47b0-95ed-48c2992b9aa9",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        220,
        1200
      ]
    },
    {
      "id": "e76afcb8-3539-48d7-abc7-751c30a4ae1f",
      "name": "Update Creation",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1760,
        1200
      ]
    },
    {
      "id": "058efad7-2452-4a67-9a45-da95ce7266a1",
      "name": "Move file in Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1540,
        1200
      ]
    },
    {
      "id": "0a021c28-991b-4c9e-b2b8-efe10adfda2e",
      "name": "Notify complete",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2000,
        1200
      ]
    },
    {
      "id": "563a5ad4-8230-4e92-bfc1-a4530d4954c0",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -40,
        780
      ],
      "parameters": {
        "width": 1740,
        "height": 920,
        "content": "## Create new version of template document\n"
      }
    },
    {
      "id": "cd871266-4420-482e-bdea-899bda6945eb",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1720,
        780
      ],
      "parameters": {
        "width": 460,
        "height": 920,
        "content": "## Update Tracking of document generation + notify"
      }
    },
    {
      "id": "b9a72a1e-c1fa-40db-b7dd-bed8887cf310",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -380,
        -40
      ],
      "parameters": {
        "width": null,
        "height": 140,
        "content": "PART 1: Gather Info"
      }
    },
    {
      "id": "19e63b99-8f91-4b46-b81c-9d1e933c570b",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -380,
        880
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": "PART 2: Generate Docs"
      }
    },
    {
      "id": "06e971a1-2000-4d5a-9539-7010a56bf99d",
      "name": "Intermediate data received",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "position": [
        0,
        1100
      ]
    },
    {
      "id": "649b7ff0-284d-4bf3-b122-c42dced4d9b0",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1680,
        -400
      ],
      "parameters": {
        "width": 1240,
        "height": 2240,
        "content": "# General Description\n\n### Automate Legal Lien Document Generation for HOAs with n8n, Apify, and AI\n\nThis tutorial details an end-to-end automation solution for streamlining the lien filing process fo"
      }
    },
    {
      "id": "32d2c4b8-dcf4-4ecc-8208-910f3bc1e876",
      "name": "Add Intermediate Info to Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1900,
        180
      ]
    },
    {
      "id": "758aaab8-ef6e-41b9-b86b-0ae4d2ea1864",
      "name": "Create folder For Output Files",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        440,
        1200
      ]
    },
    {
      "id": "c6e8c61d-ed3e-4bc7-a981-0ddb24de8bed",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        0
      ],
      "parameters": {
        "width": null,
        "height": 100,
        "content": "Set up:\n1. Intermediate Google Sheet\n2. Email to send notifications to"
      }
    },
    {
      "id": "76632705-5c9a-4a8a-acb6-fdcac218df20",
      "name": "Form submitted trigger",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "position": [
        -20,
        260
      ]
    },
    {
      "id": "2bcc9e8a-b609-4e2f-99c4-43b3cafb8609",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        420,
        960
      ],
      "parameters": {
        "width": null,
        "height": 200,
        "content": "Set up:\n1. Intermediate Google Sheet\n2. Template Google Doc for the legal document\n3. Drive Folder for Output\n4. Email to send notifications to"
      }
    },
    {
      "id": "44138f44-bcb2-4b99-978b-567e5bda68a3",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -40,
        -40
      ],
      "parameters": {
        "width": 220,
        "height": 100,
        "content": "Set up:\nSpreadsheet with form responses"
      }
    }
  ],
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Create folder For Output Files",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate PDF": {
      "main": [
        [
          {
            "node": "Add PDF To Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Creation": {
      "main": [
        [
          {
            "node": "Notify complete",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add PDF To Drive": {
      "main": [
        [
          {
            "node": "Move file in Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload legal doc": {
      "main": [
        [
          {
            "node": "Call Gemini API for legal desc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Property metadata": {
      "main": [
        [
          {
            "node": "Property Information Extractor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Transform to base64": {
      "main": [
        [
          {
            "node": "Upload legal doc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get file for property": {
      "main": [
        [
          {
            "node": "Transform to base64",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Make Copy of Template": {
      "main": [
        [
          {
            "node": "Change Custom Variables",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Form submitted trigger": {
      "main": [
        [
          {
            "node": "Apify Playwright script to find property info",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Change Custom Variables": {
      "main": [
        [
          {
            "node": "Generate PDF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Property Information Extractor",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Move file in Google Drive": {
      "main": [
        [
          {
            "node": "Update Creation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Intermediate data received": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Call Gemini API for legal desc": {
      "main": [
        [
          {
            "node": "Property metadata",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create folder For Output Files": {
      "main": [
        [
          {
            "node": "Make Copy of Template",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Property Information Extractor": {
      "main": [
        [
          {
            "node": "Add Intermediate Info to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add Intermediate Info to Google Sheets": {
      "main": [
        [
          {
            "node": "Approve Through Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Apify Playwright script to find property info": {
      "main": [
        [
          {
            "node": "Get file for property",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Playwright error inform",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}