DEV Community

Ujjwal Dubey
Ujjwal Dubey

Posted on

Quiet Hours for Property Leads: A zoneinfo Scheduler for WhatsApp Viewing Reminders in Python

Viewing reminders are the simplest part of real estate WhatsApp follow-up automation, and they still go wrong. The classic mistake: a reminder lands at 2 a.m. because the buyer lives in another time zone.

Here is a small scheduler that respects the recipient's local quiet hours. Sending is out of scope; this only works out when to send.

from datetime import datetime, timedelta, time
from zoneinfo import ZoneInfo

QUIET_START = time(21, 0)   # 9 pm local
QUIET_END = time(8, 30)     # 8:30 am local

def in_quiet(local_dt):
    t = local_dt.time()
    return t >= QUIET_START or t < QUIET_END

def next_allowed(local_dt):
    if not in_quiet(local_dt):
        return local_dt
    day = local_dt.date()
    if local_dt.time() >= QUIET_START:
        day = day + timedelta(days=1)
    return datetime.combine(day, QUIET_END, tzinfo=local_dt.tzinfo)

def reminder_times(viewing_utc, recipient_tz, offsets_hours=(24, 2)):
    tz = ZoneInfo(recipient_tz)
    out = []
    for h in offsets_hours:
        ideal = (viewing_utc - timedelta(hours=h)).astimezone(tz)
        send = next_allowed(ideal)
        if send < viewing_utc.astimezone(tz):
            out.append((h, send))
    return out

viewing = datetime(2026, 11, 7, 5, 30, tzinfo=ZoneInfo("UTC"))
for tz in ("Asia/Kolkata", "Asia/Dubai", "Europe/London"):
    for h, when in reminder_times(viewing, tz):
        print(tz, f"{h}h reminder ->", when.isoformat())
Enter fullscreen mode Exit fullscreen mode

Notes

  • Store the recipient's time zone when the lead arrives, or ask once. Phone country codes are a hint, not proof.
  • Shift, do not skip. If the ideal time is in quiet hours, move it forward to the morning, but drop it if that would be after the viewing.
  • Respect opt-outs before scheduling anything, and stay within WhatsApp Business messaging rules for your provider.
  • Log every scheduled and sent reminder so an agent can see what the buyer received.

We integrate with all major CRMs (for example HubSpot, Zoho, Salesforce, Pipedrive and Freshsales, plus custom CRMs or Google Sheets setups) and work with all major WhatsApp Business providers and the official WhatsApp Business API (for example Meta Cloud API, Twilio, Gupshup, Interakt and WATI).

That sentence is how we describe our integration scope at NxFlowAI. We start client work with a 72-hour audit; the audit guide on our blog explains the method.

Top comments (0)