{
  "name": "Workflow A: Loan Product Crawler",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 2 * * *"
            }
          ]
        }
      },
      "name": "Schedule Daily at 2 AM",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "url": "https://www.bankbazaar.com/personal-loan.html",
        "responseFormat": "string",
        "options": {}
      },
      "name": "HTTP Request - Fetch Loan Page",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 3,
      "position": [
        450,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "// Create sample loan products (simulating extraction)\n// In production, you would parse the HTML response\n\nconst products = [\n  {\n    product_name: 'Personal Loan - Standard',\n    lender_name: 'BankBazaar Partner',\n    interest_rate: 10.5,\n    min_income: 300000,\n    min_credit_score: 650,\n    min_age: 21,\n    max_age: 65,\n    employment_required: true,\n    max_loan_amount: 2000000,\n    loan_term_months: 60,\n    source_url: 'https://www.bankbazaar.com/personal-loan.html'\n  },\n  {\n    product_name: 'Quick Personal Loan',\n    lender_name: 'BankBazaar Express',\n    interest_rate: 12.0,\n    min_income: 250000,\n    min_credit_score: 600,\n    min_age: 23,\n    max_age: 60,\n    employment_required: true,\n    max_loan_amount: 1000000,\n    loan_term_months: 36,\n    source_url: 'https://www.bankbazaar.com/personal-loan.html'\n  }\n];\n\nreturn products.map(p => ({ json: p }));"
      },
      "name": "Extract Loan Data",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        650,
        300
      ]
    },
    {
      "parameters": {
        "operation": "executeQuery",
        "query": "INSERT INTO loan_products (product_name, lender_name, interest_rate, min_income, min_credit_score, min_age, max_age, employment_required, max_loan_amount, loan_term_months, source_url) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11) ON CONFLICT (product_name) DO NOTHING RETURNING *",
        "additionalFields": {}
      },
      "name": "Save to PostgreSQL",
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 1,
      "position": [
        850,
        300
      ],
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Schedule Daily at 2 AM": {
      "main": [
        [
          {
            "node": "HTTP Request - Fetch Loan Page",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request - Fetch Loan Page": {
      "main": [
        [
          {
            "node": "Extract Loan Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Loan Data": {
      "main": [
        [
          {
            "node": "Save to PostgreSQL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {},
  "id": "workflow-a"
}