A brokerage site usually has four or five forms that matter: “Contact agent,” “Schedule a showing,” “Save this search,” “What’s my home worth?”, and maybe a mortgage pre-qual widget someone bolted on in 2019.

    Each reaches the CRM a different way: one posts JSON to a webhook, one sends an email that a parser scrapes, and one writes to a spreadsheet that an assistant copies over on Mondays.

    Then the CRM has a two-hour outage on a Saturday, which is the busiest showing day of the week, and nobody can say how many leads were lost.

    This article walks through the plumbing that prevents that: a consistent payload, a reliable delivery path, signature checks, retries, dedupe, and routing that gets a human on the phone while the lead still cares.

    Webhooks, Dedupe, Routing: Wiring a Real Estate Website to Its CRM

    Design the Form Payload Before You Write the Handler

    Most lead-sync bugs start in the form, not the integration. If the showing form sends phone_number, the valuation form sends tel, and the contact form sends phone, every downstream step has to know all three. Pick one schema and make every form emit it, including marketing’s landing pages.

    A payload that holds up in practice carries a few groups of fields:

    • Identity: name, email, phone, and the raw values exactly as typed, kept beside any normalized versions.
    • Context: form type, page URL, MLS listing ID if the lead came from a property page, and the agent ID if the page belongs to a specific agent.
    • Attribution: UTM parameters and the referrer, captured on first page load and stored in a cookie or session so they survive a multi-page browse.
    • Consent: a boolean for each channel (email, call, text), the exact consent wording shown, a version string for that wording, and a timestamp.
    • Delivery metadata: a client-generated submission ID (a UUID created when the form renders) and a schema version.

    That submission ID matters later. It’s your idempotency key, and generating it in the browser means a double-click or a flaky mobile connection that resubmits the form still produces one lead instead of two.

    On the front end, labelled inputs, the right type and autocomplete attributes, and visible error text keep completion rates up and data cleaner.

    If you’re scaffolding these by hand, a generator for accessible form fields and HTML elements saves the repetitive markup and leaves you time for validation logic.

    On consent: if agents will call or text the lead, store what the person actually agreed to, word for word, with the version and time. Your compliance team decides what that wording says. Your job is to make sure the record can prove what was shown.

    Webhook, API, or Parsed Email: Pick the Delivery Path

    There are three common ways a lead gets from the site to the CRM, and they aren’t equal.

    • Email parsing is the legacy default. The form sends an email, and the CRM (or a middleman service) reads it and extracts fields. It breaks when someone edits the template or the message lands in spam, and consent flags and UTM data become text a regex has to find. If you inherited this setup, treat it as a fallback channel, not the primary one.
    • Direct API calls from your backend to the CRM give you structured data and a real response code. The catch is coupling. If your form handler waits on the CRM’s API and the CRM is slow, your visitor watches a spinner. If the CRM returns a 500, you need somewhere to put the lead.
    • Webhooks into your own endpoint, then onward to the CRM is the pattern that scales best. The form posts to a small service you control. That service validates, stores, and acknowledges the visitor immediately, then forwards to the CRM asynchronously. It separates “we received the lead” from “the CRM has the lead,” which are two very different promises.

    Sometimes the delivery path isn’t the hard part. Brokerages with split commission plans, team-lead overrides, or referral agreements that change who owns a lead often find that their CRM can’t model those rules at all, no matter how clean the incoming data is.

    That’s usually the point where teams stop adding plugins and look at custom real estate software development for the routing and ownership logic, with the website integration feeding into it.

    Verify, Queue, Retry: Surviving a CRM Outage

    Once you accept leads at your own endpoint, three things have to be true: you only accept requests you trust, you never drop a lead because something downstream failed, and you never create duplicates when you retry.

    Verify signatures. Portal feeds and third-party lead sources that post to you should sign their payloads with a shared secret, typically an HMAC-SHA256 of the raw body sent in a header like X-Signature. Two details trip people up.

    First, verify against the raw bytes, not the parsed JSON, because body-parsing middleware reorders or reformats content. Second, compare with a constant-time function.

    const crypto = require('crypto');
    
    app.post('/hooks/lead', express.raw({ type: 'application/json' }), (req, res) => {
    
    const expected = crypto
    
    .createHmac('sha256', process.env.LEAD_WEBHOOK_SECRET)
    
    .update(req.body)
    
    .digest('hex');
    
    const received = req.get('X-Signature') || '';
    
    const a = Buffer.from(expected, 'hex');
    
    const b = Buffer.from(received, 'hex');
    
    if (a.length !== b.length || !crypto.timingSafeEqual(a, b)) {
    
    return res.status(401).end();
    
    }
    
    enqueueLead(JSON.parse(req.body));
     res.status(202).end();
     });

    The length check runs before timingSafeEqual because that function throws when the buffers differ in length.

    Acknowledge fast, process later. Notice the handler returns 202 after enqueueing, not after the CRM call. Stripe’s own guidance for webhook receivers says the same thing: return a 2xx quickly, process events through a queue, and expect the same event more than once. Stripe also retries undelivered events for up to three days, which is a useful benchmark for how long your own retry window should be.

    Retry with backoff and an idempotency key. A worker pulls leads off the queue and pushes them to the CRM. On a 5xx or timeout, it retries with exponential backoff and jitter (say 30 seconds, 2 minutes, 10 minutes, then hourly). Every attempt sends the same submission ID, either as the CRM’s idempotency header if it supports one, or as an external ID field you check before creating a record. After the final attempt fails, the lead moves to a dead-letter queue, not the void.

    Dedupe Before the CRM Does It Badly

    Real estate leads duplicate constantly. The same buyer saves three searches, requests two showings, and fills out a valuation form for their current home, all in one week.

    Many CRMs either create a contact per submission or merge on email alone, which fails when a buyer uses a work email on one form and Gmail on another.

    Build your own match key before the data leaves your service:

    function dedupeKeys(lead) {
    const email = (lead.email || '').trim().toLowerCase();
    const phone = toE164(lead.phone, lead.country || 'US');
    return [email && e:email,phone&&p:{phone}].filter(Boolean);
    }

    Normalizing phones to E.164 is what makes the phone key usable. The ITU-T E.164 standard caps a full international number at 15 digits, with a plus sign and country code up front, so “(512) 555-0142” and “512.555.0142” both collapse to the same +15125550142. Use a maintained library such as libphonenumber for the conversion rather than a regex you’ll regret.

    Then decide your merge rules explicitly and write them down:

    1. Match on either key within a time window (90 days is a reasonable starting point for active buyers).
    2. On a match, append the new activity to the existing contact instead of creating a new one.
    3. Never overwrite a non-empty field with an empty one.
    4. Keep the original lead owner unless the new submission came from a specific agent’s page and your brokerage’s rules say that agent takes over.

    Get that fourth rule in writing from the broker before you code it.

    Route Fast, Then Watch the Pipeline

    Speed still matters more than almost anything else in lead handling. In their Harvard Business Review study “The Short Life of Online Sales Leads,” Oldroyd, McElheran, and Elkington reported that firms contacting a lead within an hour were nearly seven times as likely to qualify it as firms that waited even an hour longer, and more than 60 times as likely as firms that waited 24 hours or more. A queue that holds leads for an afternoon because a routing rule misfired erases that advantage.

    Typical routing rules, roughly in priority order:

    • Listing agent first: if the lead came from a listing page, route to that listing’s agent.
    • Agent page owner: leads from an agent’s bio page go to that agent.
    • Territory: map ZIP codes or neighborhoods to teams.
    • Round robin with a timeout: if the assigned agent doesn’t accept within 10 or 15 minutes, reassign.

    Send the visitor an instant confirmation too; it cuts the “I submitted twice just in case” duplicates.

    For spam, start with a honeypot field and server-side rate limiting by IP and submission ID before reaching for a visible CAPTCHA. A puzzle on the showing request form costs you real buyers.

    Finally, monitor the pipeline as a pipeline. Alert when the dead-letter queue is non-empty, when the CRM success rate drops below its normal baseline, and when a form that usually produces leads every hour goes silent. That last one catches bugs nobody reports.

    Before You Ship

    Run one test lead through every form and trace it end to end: payload, signature check, queue, CRM record, assigned agent, confirmation email. Then kill the CRM connection in staging and confirm leads queue up and drain afterwards.

    Two steps worth doing this week: put every form on a single payload schema with a client-side submission ID, and set up the dead-letter alert. Those two changes alone turn “we might have lost some leads Saturday” into a number you can actually check.

    Paul Mills is a web developer and writer at wordpress-652384-6802102.cloudwaysapps.com. He covers the site's generators and online utilities, with a focus on making everyday HTML, CSS, and JavaScript tasks quicker for people who would rather build something than look up syntax for the tenth time.