{
  "name": "Generate Seller Report",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "generate-seller-report",
        "options": {}
      },
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "operation": "get",
        "baseId": "appYOURBASEID",
        "table": "Listings",
        "id": "={{$json.body.listingId}}"
      },
      "name": "Get Listing Stats",
      "type": "n8n-nodes-base.airtable",
      "typeVersion": 1,
      "position": [
        450,
        300
      ],
      "credentials": {
        "airtableApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "modelId": {
          "__rl": true,
          "value": "gemini-1.5-flash",
          "mode": "list"
        },
        "prompt": "=Write a polite weekly real estate update email for the seller of {{$json.fields.Address}}. \nStats: \n- Views: {{$json.fields.Views}}\n- Showings: {{$json.fields.Showings}}\n- Feedback: {{$json.fields.Feedback_Summary}}\n\nTone: Professional, encouraging, data-driven.",
        "options": {}
      },
      "name": "Gemini Writer",
      "type": "n8n-nodes-base.googleGeminiChat",
      "typeVersion": 1,
      "position": [
        650,
        300
      ],
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "fromEmail": "updates@nexus-os.com",
        "toEmail": "={{$node[\"Webhook\"].json.body.email}}",
        "subject": "Your Weekly Home Performance Report",
        "text": "={{$json.output}}"
      },
      "name": "Send Email",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2,
      "position": [
        850,
        300
      ],
      "credentials": {
        "smtp": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Get Listing Stats",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Listing Stats": {
      "main": [
        [
          {
            "node": "Gemini Writer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gemini Writer": {
      "main": [
        [
          {
            "node": "Send Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}