A unified inbox for estate agents: how WhatsApp, calls and email share one data model

Tanvir Akhter Shakib8 min read

The short answer

A unified inbox for estate agents works when every channel is normalised into the same records: one contact per person, one conversation per thread and one message row per event. In Propily, WhatsApp messages and phone calls are stored in that shape, portal enquiry emails arrive through a separate verified intake, and the CRM shows channels as tabs over the same data. SMS exists as a channel in the data model, but conversations cannot yet be received or answered over it.

What a unified inbox for estate agents needs underneath

The screen is the easy part. What makes an inbox unified is the data beneath it: the same contact record, the same conversation record and the same message shape, whatever carried the message. In our schema a conversation belongs to an agency and a contact and has a channel. A message has a direction, a sender type (contact, AI or human agent), a message type, the provider's own message id and a delivery status.

We should be plain about the interface. The Communications screen does not merge everything into one scrolling list. It has tabs for AI calls, WhatsApp, a connected mailbox, portal messages and team chat. The contact's activity timeline is where the channels meet, and it records how we know a communication happened: the app saw a tap, an agent logged it, or the CRM did it itself.

How we verify a WhatsApp webhook

Two providers feed us WhatsApp: Meta's Cloud API directly, and Twilio. Meta first sends a GET with a challenge and a verify token, and we echo the challenge only if the token matches. Every POST after that carries an X-Hub-Signature-256 header, an HMAC-SHA256 of the raw body. We compute it over the raw bytes and compare in constant time, as bytes, because comparing non-ASCII text raises an exception and an exception there would be an unauthenticated 500 instead of a 403.

Two decisions matter more than the HMAC. First, fail closed: a missing secret means the webhook is refused. Second, Twilio signs with the auth token of whichever account sent the callback, which for an agency on its own Twilio account is that agency's token, so we choose the token by the account on the callback. Payloads that pass are checked for shape before they are queued, and unrelated object types from the same app are dropped at the edge.

How we make webhook processing idempotent

Providers deliver at least once. Meta retries when it does not see a 200, Celery retries a task that raised, and a worker restart can redeliver. So processing has to be safe to repeat. The first defence is cheap: every message row stores the provider's id, a Meta wamid or a Twilio SID, and a message already stored for that agency is a duplicate and is dropped before the AI runs.

That check has a race, because two deliveries at the same moment can both pass it. So the worker also claims the provider id in a small table with three states: processing, done and released. Only done makes a later delivery a duplicate. A failed run releases its claim so a redelivery can process the message, and a claim stuck in processing for ten minutes can be taken over. A delivery that finds another still working raises, so Celery retries it later.

A returned row means we own the claim. No row means the message is done or another delivery holds it. Staff replies from the CRM get the same treatment: an Idempotency-Key header, with the conversation row locked, returns the earlier message instead of sending twice.

INSERT INTO inbound_event_claims (provider, event_id, state, claimant)
VALUES (:provider, :event_id, 'processing', :task_id)
ON CONFLICT (provider, event_id) DO UPDATE
   SET state = 'processing', claimed_at = now(), claimant = EXCLUDED.claimant
 WHERE inbound_event_claims.state = 'released'
    OR (inbound_event_claims.state = 'processing'
        AND (inbound_event_claims.claimant = EXCLUDED.claimant
             OR inbound_event_claims.claimed_at < now() - interval '10 minutes'))
RETURNING 1;

How delivery receipts update a message

Receipts arrive as separate webhooks, in any order, sometimes late. We match a receipt to an outbound message by the provider's id and ignore inbound rows that happen to share one. Statuses have a rank: queued, sent, delivered, read. A receipt may only move a message forward, so a late sent cannot demote a read.

A failed receipt is accepted unless the message was already read, because a read message did not fail. A read receipt also sets delivered, since WhatsApp can skip or reorder that event. Where the provider sends an event time we store it, because a retry can process an event minutes after it happened.

Failures trigger work. If the message that opened a portal enquiry never arrived, the lead goes back in front of the office. If a viewing reminder fails, it is sent by email instead.

How messages are threaded by contact

Threading starts with identity. A WhatsApp sender is a phone number, and different systems write the same number in different formats. We canonicalise to E.164, look the number up with and without the plus and then in other formats, always scoped to the agency. A caller on the phone resolves to the same lead, so a person who calls and messages is one contact.

Old data fought us. The database had no uniqueness on a phone number per agency, so duplicate lead rows existed. We merge duplicates when we meet them, in code.

Finding the conversation is a select followed by an insert, with no unique index to fall back on, so two workers handling a person's first two messages could both create one and split the thread. We take a Postgres advisory lock keyed on agency, contact and channel for the transaction. It needs no migration, blocks only that one contact, and Postgres releases it if the process dies.

How attachments are handled

Inbound WhatsApp media is not downloaded on arrival. The message row keeps the provider's media reference and a placeholder such as media: image, no text, so the AI and staff know a file exists. The photo is fetched when staff first open the chat, redrawn into a fresh JPEG and thumbnail, which drops anything hidden in the file and its location data, and stored under the agency's own path. The trade-off is that a photo nobody opens can expire at the provider before we fetch it.

Outbound files go in two steps. The upload is checked by its first bytes, not its declared type, and limited to 5 MB for images, 20 MB for documents and 10 MB for voice notes. Browser voice recordings are converted to OGG Opus with ffmpeg, which doubles as the check that they are audio. The reply then names the stored file by key and never accepts a link from the browser, so a user cannot make WhatsApp fetch an address of their choosing or send another conversation's file.

Email and SMS: what is and is not unified

Email arrives by two routes. Portal enquiry emails from Rightmove and OnTheMarket come through AWS SES and SNS: we pin the SNS topic, verify its signature, store the original bytes before deciding anything and match the receiving address to a stored connection. An address we do not recognise is kept with no agency and held for the platform, never guessed, and answered 200 so the provider does not retry. Agents can also connect their own mailbox over IMAP and SMTP with an app password. A reply on an email conversation is queued for SMTP, so it shows as queued, not sent.

SMS is the gap. A conversation can have the sms channel, but we have no inbound SMS webhook, and a human reply on an SMS conversation is stored with delivery status failed and the reason no outbound transport, so nobody believes the contact was reached. SMS is limited to outbound notices. If you need two-way SMS in a shared inbox, ask any vendor to show you the inbound webhook and the delivery receipt for it.

Where to go next

The Rightmove and Zoopla leads page shows how portal enquiries become leads and conversations in the same CRM, and the guide on property portal leads covers what to do in the first minutes after one arrives.

Questions people ask

What is a unified inbox for estate agents?

It is one place where messages from different channels, such as WhatsApp, calls and email, are stored against the same contact. The useful part is the shared data underneath, so staff see one history per person whatever the channel.

How do you stop a WhatsApp message being processed twice?

Every message stores the provider's id, and the worker claims that id before processing. A delivery that finds the message already done is dropped, and a failed run releases its claim so a redelivery can finish the job.

How do WhatsApp delivery receipts work in a CRM?

Receipts arrive as separate webhooks and are matched to the outbound message by the provider's id. Statuses only move forward from sent to delivered to read, so a late or repeated receipt cannot make a message look less delivered than it is.

Can an estate agent CRM reply by SMS from the inbox?

Ours cannot yet. An SMS conversation can be stored, but a reply is marked as not delivered because no outbound SMS transport is wired to the inbox, so staff are never told a text was sent when it was not.

Who answers your phones tonight?Book a demo
Unified inbox for estate agents: one data model | Propily