{
  "name": "Automation for real estate agents (mahirmunaj.com)",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "property-enquiry",
        "options": {}
      },
      "id": "b72fd2bd-e9d0-5b9f-b0f4-392d475873e3",
      "name": "New enquiry (Webhook)",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        300
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.openai.com/v1/chat/completions",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "openAiApi",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ model: 'gpt-4o-mini', temperature: 0.3, messages: [ { role: 'system', content: \"You are a friendly real estate agent's assistant. Write a short (under 90 words), warm email reply to a property enquiry. Mention the property, answer the question if possible, and offer two viewing times this week. No subject line.\" }, { role: 'user', content: 'Buyer: ' + $json.body.name + '\\nProperty: ' + $json.body.property + '\\nMessage: ' + $json.body.message } ] }) }}",
        "options": {}
      },
      "id": "29d5f462-2760-5f9f-8d89-15c8443db8cd",
      "name": "AI writes reply",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        220,
        300
      ]
    },
    {
      "parameters": {
        "sendTo": "={{ $('New enquiry (Webhook)').item.json.body.email }}",
        "subject": "=Re: {{ $('New enquiry (Webhook)').item.json.body.property }}",
        "emailType": "text",
        "message": "={{ $json.choices[0].message.content }}",
        "options": {}
      },
      "id": "e259fc57-5dd4-5e30-b966-e7b8d8e984fb",
      "name": "Send reply",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        440,
        300
      ]
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_SHEET_ID"
        },
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Leads"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "name": "={{ $('New enquiry (Webhook)').item.json.body.name }}",
            "email": "={{ $('New enquiry (Webhook)').item.json.body.email }}",
            "property": "={{ $('New enquiry (Webhook)').item.json.body.property }}",
            "status": "New"
          }
        },
        "options": {}
      },
      "id": "5a8e98a5-6449-5135-a626-a384d3fe099f",
      "name": "Save to CRM sheet",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        660,
        300
      ]
    },
    {
      "parameters": {
        "amount": 2,
        "unit": "days"
      },
      "id": "860b469e-ec8d-5432-8580-a264887a7c44",
      "name": "Wait 2 days",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        880,
        300
      ]
    },
    {
      "parameters": {
        "sendTo": "={{ $('New enquiry (Webhook)').item.json.body.email }}",
        "subject": "=Still interested in {{ $('New enquiry (Webhook)').item.json.body.property }}?",
        "emailType": "text",
        "message": "=Hi {{ $('New enquiry (Webhook)').item.json.body.name }},\n\nJust checking in. Would you like to book a viewing or see similar homes? Reply with a time that suits you.\n\nBest regards",
        "options": {}
      },
      "id": "57aae89b-5f02-57fb-b1cf-08733fa53b51",
      "name": "Follow-up email",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        1100,
        300
      ]
    }
  ],
  "connections": {
    "New enquiry (Webhook)": {
      "main": [
        [
          {
            "node": "AI writes reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI writes reply": {
      "main": [
        [
          {
            "node": "Send reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send reply": {
      "main": [
        [
          {
            "node": "Save to CRM sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save to CRM sheet": {
      "main": [
        [
          {
            "node": "Wait 2 days",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 2 days": {
      "main": [
        [
          {
            "node": "Follow-up email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": false,
    "source": "https://mahirmunaj.com/templates/n8n-real-estate-lead-follow-up-workflow"
  }
}