{
  "name": "UCC Lien PDF Extractor",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "ucc-zoho-callback",
        "options": {}
      },
      "name": "Zoho Callback Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "const body = $input.first().json;\n\n// n8n v2 webhook: the POST body IS $input.first().json\n// Build a flat output from whatever structure Zoho sends\nconst data = body.body || body;\n\nreturn {\n  lien_number: data.lienNumber || data.lien_number || '',\n  pdf_url: data.pdfUrl || data.pdf_url || '',\n  filing_date: data.filingDate || data.filing_date || '',\n  filing_type: data.filingType || data.filing_type || '',\n  _payload_keys: Object.keys(body).join(','),\n  _raw: JSON.stringify(body).substring(0, 500)\n};"
      },
      "name": "Normalize Zoho Payload",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        450,
        300
      ]
    },
    {
      "parameters": {
        "method": "GET",
        "url": "={{ $json.pdf_url }}",
        "authentication": "none",
        "sendBody": false,
        "sendQuery": false,
        "sendHeaders": false,
        "options": {
          "response": {
            "responseFormat": "file"
          }
        }
      },
      "name": "Download PDF",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [
        650,
        300
      ]
    },
    {
      "parameters": {},
      "name": "Extraction Complete",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        850,
        300
      ]
    }
  ],
  "connections": {
    "Zoho Callback Webhook": {
      "main": [
        [
          {
            "node": "Normalize Zoho Payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Zoho Payload": {
      "main": [
        [
          {
            "node": "Download PDF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download PDF": {
      "main": [
        [
          {
            "node": "Extraction Complete",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}