1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254
| Form Title: Real Estate - Form Form Description: Please provide all your metrics to get the best real estate details Location(text): Status(Dropdown): forSale Minimum Price Maximum Price Minimum Number of Beds Minimum Number of Bathrooms sortselection(Dropdown):pricea Multi Family?(Dropdown):true,false "Location": "Miami", "Status": "forSale", "Minimum Price": "400000", "Maximum Price": "550000", "Minimum Number of Beds": 3, "Minimum Number of Bathrooms": 2, "sortselection": "pricea", "Multi Family?": "true",
URL: x-rapidapi-host's value Authentication:GenericnCredential Type Generic Auth Type: Header Auth Header AUth: Name: x-rapidapi-key Value: x-rapidapi-key's value Send Query Parameters:enable Name: location Value: {{ $json.Location }} Name: status Value: {{ $json.Status }} Name: price_min Value: {{ $json['Minimum Price'] }}
Name: price_max Value: {{ $json['Maximum Price'] }} Name:beds_min Value: {{ $json['Minimum Number of Beds'] }}
Name: baths_min Value: {{ $json['Minimum Number of Bathrooms'] }} Name: sortSelection Value: {{ $json.sortselection }} Name: isMultiFamily Value: {{ $json['Multi Family?'] }}
Fields To Split Out: results Include: No Other Fields
Mode: Manual Mapping Fields to Set: address:String={{ $json.streetAddress }} {{ $json.city }} {{ $json.state }} {{ $json.zipcode }} {{ $json.country }} homeStatus:String={{ $json.homeStatus }} homeType:String={{ $json.homeType }} totalSize:String={{ $json.lotAreaValue||"" }} {{ $json.lotAreaUnit||"" }} livingArea:String={{ $json.livingArea }} sqft price:Number={{ $json.price }} taxAssessedValue:String={{ $json.taxAssessedValue }} zestimate:String={{ $json.zestimate }} rentZestimate:String={{ $json.rentZestimate }} priceReduction:String={{ $json.priceReduction }} bathrooms:Number={{ $json.bathrooms }} bedrooms:Number={{ $json.bedrooms }} isNonOwnerOccupied:Boolean={{ $json.isNonOwnerOccupied }} isPreforeclosureAuction:Boolean={{ $json.isPreforeclosureAuction }} isPremierBuilder:Boolean={{ $json.isPremierBuilder }} isShowcaseListing:Boolean={{ $json.isShowcaseListing }}
// ── CONFIGURABLE ASSUMPTIONS ───────────────────────────────────────── const downPaymentPct = 0.20; // 20 % down const closingCostPct = 0.03; // 3 % closing costs const annualInterestRate = 0.05; // 5 % APR const loanTermYears = 30; // 30‑yr mortgage const propertyTaxRate = 0.012; // 1.2 % of assessed value per year const insuranceRate = 0.003; // 0.3 % of price per year const maintenanceRate = 0.01; // 1 % of price per year // ─────────────────────────────────────────────────────────────────────
// IMPORTANT for n8n: return array of { json: … } return items.map(item => {
// —— raw inputs (fall back to 0 if missing) ———————————————— const j = item.json; const price = parseFloat(j.price) || 0; const rent = parseFloat(j.rentZestimate) || 0; const livingArea = parseFloat(j.LivingArea) || 0; // sqft const zEstimate = parseFloat(j.zestimate) || 0; const taxAssessedVal = parseFloat(j.taxAssessedValue)|| price; // ————————————————————————————————————————————————————————
// —— Financing —————————————————————————— const downPayment = price * downPaymentPct; const closingCosts = price * closingCostPct; const loanAmount = price - downPayment; const monthlyRate = annualInterestRate / 12; const numPayments = loanTermYears * 12; const mortgagePayment= loanAmount * monthlyRate / (1 - Math.pow(1 + monthlyRate, -numPayments));
// —— Operating expenses ——————————————— const annualTax = taxAssessedVal * propertyTaxRate; const annualIns = price * insuranceRate; const annualMaint = price * maintenanceRate;
const monthlyTax = annualTax / 12; const monthlyIns = annualIns / 12; const monthlyMaint = annualMaint / 12;
// —— Cash‑flow & returns —————————————— const totalMonthlyExp = mortgagePayment + monthlyTax + monthlyIns + monthlyMaint; const monthlyCashFlow = rent - totalMonthlyExp; const annualCashFlow = monthlyCashFlow * 12;
const capRate = annualCashFlow / price; // NOI ÷ price const cashOnCashROI = annualCashFlow / (downPayment + closingCosts);
// —— Extra metrics ———————————————— const pricePerSqft = livingArea ? price / livingArea : 0; const rentPerSqft = livingArea ? rent / livingArea : 0; const rentToPricePct = price ? (rent * 12) / price : 0; // GRM inverse const priceVsZestPct = zEstimate ? (price - zEstimate) / zEstimate : 0; // ————————————————————————————————————————————————————————
// —— Attach everything to output JSON —— Object.assign(j, { downPayment: +downPayment.toFixed(2), closingCosts: +closingCosts.toFixed(2), loanAmount: +loanAmount.toFixed(2), mortgagePayment: +mortgagePayment.toFixed(2),
monthlyPropertyTax: +monthlyTax.toFixed(2), monthlyInsurance: +monthlyIns.toFixed(2), monthlyMaintenance: +monthlyMaint.toFixed(2), totalMonthlyExpenses: +totalMonthlyExp.toFixed(2),
monthlyCashFlow: +monthlyCashFlow.toFixed(2), annualCashFlow: +annualCashFlow.toFixed(2),
capRate: +capRate.toFixed(4), // 0.0523 ➜ 5.23 % cashOnCashROI: +cashOnCashROI.toFixed(4), // 0.1234 ➜ 12.34 %
pricePerSqft: +pricePerSqft.toFixed(2), rentPerSqft: +rentPerSqft.toFixed(2), rentToPricePct: +(rentToPricePct*100).toFixed(2), // % of price per yr priceVsZestimatePct: +(priceVsZestPct*100).toFixed(2) // over/under % });
// Return a proper n8n item return { json: j }; });
Document From list:Real Estate Deals Mapping Column Mode: Map Each Column Manually Column to match on: Address Values to Send Address (using to match): {{ $json.address }} homeStatus: {{ $json.homeStatus }} homeType: {{ $json.homeType }} totalSize: {{ $json.totalSize }} LivingArea: {{ $json.livingArea }} price: {{ $json.price }} taxAssessedValue: {{ $json.taxAssessedValue }} zestimate: {{ $json.zestimate }} rentZestimate: {{ $json.rentZestimate }} priceReduction: {{ $json.priceReduction }} bathrooms: {{ $json.bathrooms }} bedrooms: {{ $json.bedrooms }} isNonOwnerOccupied: {{ $json.isNonOwnerOccupied }} isPreforeclosureAuction: {{ $json.isPreforeclosureAuction }} isPremierBuilder: {{ $json.isPremierBuilder }} isShowcaseListing: {{ $json.isShowcaseListing }} downPayment: {{ $json.downPayment }} closingCosts {{ $json.closingCosts }} loanAmount: {{ $json.loanAmount }} mortgagePayment: {{ $json.mortgagePayment }} monthlyPropertyTax: {{ $json.monthlyPropertyTax }} monthlyInsurance: {{ $json.monthlyInsurance }} monthlyMaintenance: {{ $json.monthlyMaintenance }} totalMonthlyExpenses: {{ $json.totalMonthlyExpenses }} monthlyCashFlow: {{ $json.monthlyCashFlow }} annualCashFlow: {{ $json.annualCashFlow }} capRate: {{ $json.capRate }} cashOnCashROI: {{ $json.cashOnCashROI }} pricePerSqft: {{ $json.pricePerSqft }} rentPerSqft: {{ $json.rentPerSqft }} rentToPricePct: {{ $json.rentToPricePct }} priceVsZestimatePct: {{ $json.priceVsZestimatePct }}
Aggregate:All Item Data (Into a Single List) Put Output in Field: data Include: All Fields
Prompt: "You are a seasoned real estate investment analyst. You'll receive a JSON array of property records with fields such as: Address homeStatus, homeType, size price, taxAssessedValue, zestimate, rentZestimate downPayment, closingCosts, loanAmount, mortgagePayment monthlyPropertyTax, monthlyInsurance, monthlyMaintenance totalMonthlyExpenses, monthlyCashFlow, annualCashFlow capRate, cashOnCashROI The input is available as: {{ JSON.stringify($json.data) }} Your tasks: Write a short one-sentence summary of the overall real estate market sentiment. List the Top 3 properties ranked by cash-on-cash ROI, and for each show: Address ROI (%) Monthly cash flow List the Top 3 properties ranked by cap rate, and for each show: Address Cap rate (%) Annual cash flow Highlight any properties with negative monthly cash flow. Calculate and display portfolio-wide averages for: Cap rate (%) Cash-on-cash ROI (%) Monthly cash flow (USD) Suggest up to two next actions, for example: “Schedule showings for properties X, Y” “Consider raising your max price filter to find better cap rates” Format your output as a clean daily report with headings and bullet points. it include 2 field: title: Daily Real Estate KPI Report for {{ $now }} - {{ $('On form submission').item.json.Location }} (Ensure the date is in YYYY-MM-DD format.) body: it is HTML formatted and easy to read. output example as bwelow : { "title": "Daily Real Estate KPI Report for..", "body": "summary..." } Output Content as JSON: Enable"
output(Object) {{ $json.content.parts[0].text.parseJson() }}
To: kyp001@gmail.com Subject: {{ $json.output.title }} Email Type: HTML Message: {{ $json.output.body }}
|