Zoho, Gmail, Microsoft 365 — how we make sure a 3am lead never falls through the cracks
KontractHub Team ·
A lead is only useful if it lands somewhere a human will actually see it. That sounds obvious. It is not, in practice, easy — because the three most common inbox providers our customers use (Zoho, Gmail, and Microsoft 365) each have their own quirks, their own pagination rules, and their own subtle ways of dropping messages if you don't read their API carefully.
Over the last two weeks we shipped a set of fixes that closed the last three known ways a real lead could get lost between the moment it hit your mailbox and the moment it appeared in your KontractHub Lead Inbox. Here's what those fixes are, and why they matter for you.
The three ways leads used to slip
First: pagination. Zoho's mail search API returns messages in pages of 50. If more than 50 leads arrived between our sync runs — which happens the morning after a realtor.com blast — our cursor would sometimes advance past the second page without reading it. Real leads, silently skipped.
Second: cursor advancement on filter. Our sync loop reads messages, then advances its 'last-read' cursor so it doesn't re-read the same messages next run. If a message was filtered out (say, because we decided it wasn't property-related), some code paths were failing to advance the cursor at all. The next sync run would re-inspect the same message, filter it again, and get stuck in a loop — while newer leads waited behind it.
Third: the relevance gate itself. A too-aggressive filter drops real leads. A too-loose filter buries them under 200 pieces of newsletter mail. We had to make the filter aggressive enough to be useful, honest enough to log its own mistakes, and correctable when we got it wrong.
The fix, in three parts
The pagination fix was the smallest change but the most important. Every provider adapter now walks the entire page window each run, not just the first page. The cost is measurable — a few extra API calls per sync — and worth it, because 'we might have missed page 2' is not a state we're willing to leave your business in.
The cursor fix was a discipline change. The cursor now advances on every terminal state — dispatched, filtered, deduplicated, errored — not just on 'dispatched'. There is exactly one rule: if we finished thinking about a message, the cursor moves past it. No exceptions. That closed a class of bug we'd been fighting since March.
The relevance gate got a review surface. Anything the filter dropped is now visible in a 'Missed Leads' screen in the PM app, one tap from the Lead Inbox header. If you confirm one was a real lead, the filter learns the keyword and stops dropping the same pattern next week. You are always the arbiter.
Why 'ignore the provider's timestamp filter' is the right call
One counter-intuitive choice we made: we no longer trust Zoho's 'messages after this receivedTime' filter. In our tests, that filter would occasionally drop messages that arrived within a second of the cursor timestamp — a race condition on their end, not ours. We now fetch a slightly wider window and dedupe on message-ID inside our own code. It's a few extra bytes across the wire, and it eliminates a whole class of 'ghost leads' that showed up in the provider's UI but never in ours.
Every one of these decisions is a small tax on our infrastructure. Cumulatively they add maybe 8% to the sync workload. They also mean the answer to 'did we lose a lead last night?' is a confident no, every night. That trade — a little extra compute for a lot more trust — is one we'll take every single time.
The Missed Leads screen — because we know the filter isn't perfect
No spam filter is right 100% of the time. The honest way to handle that is to make its mistakes visible and correctable. The Missed Leads screen shows you every email the filter chose to skip in the last 30 days, with the reason, the preview, and two buttons: 'This was a real lead' and 'Correctly filtered'.
When you confirm a missed lead, three things happen. The email gets moved back into your Lead Inbox as if it had been ingested correctly. The keyword pattern that made us skip it gets added to your workspace's learned-keyword store, so the same sender or subject line won't be skipped next time. And a note lands in our internal quality dashboard so we can spot filter regressions across the whole customer base — without ever reading any customer's actual email.
What we still can't promise
If a lead never made it to your mailbox — because the realtor.com API failed, or because your provider's spam filter caught it first — there's nothing we can do inside our own pipeline. We can only be honest about the boundary. Everything on our side of that boundary is now, to the best of our knowledge, watertight. If you see a case where it isn't, please tell us. Every reported miss becomes a test case.