{"slug": "follow-up-timers-for-property-leads-a-small-scheduler-with-stop-rules", "title": "Follow-Up Timers for Property Leads: A Small Scheduler With Stop Rules", "summary": "A co-founder of NxFlowAI (Mumbai) outlined a small scheduler pattern for real-estate lead follow-up automation built around explicit stop rules, using a per-lead FollowUp data model, a three-step sequence, a should_stop function, and a periodic tick worker loop. The design halts automation and alerts a human agent whenever a lead replies, and recommends making advance and stop atomic with the send or using an outbox table to prevent duplicate nudges after a crash.", "body_md": "Follow-up is where property leads are won, and where bots turn into spam. The difference is almost always the stop rules. This post shows a small scheduler pattern for [AI automation for real estate agencies with follow-up timers that stop](https://www.nxflowai.com/services): a data model, a sequence, the stop logic, and a worker loop.\n\nOne row per lead in an active sequence.\n\n``` python\nfrom dataclasses import dataclass\nfrom datetime import datetime\nfrom typing import Optional\n\n@dataclass\nclass FollowUp:\n    lead_id: str\n    agent_id: str\n    step: int                  # 0 = first reply already sent\n    next_at: datetime\n    status: str                # \"active\" | \"paused\" | \"stopped\"\n    stop_reason: Optional[str] = None\n```\n\nKeep it short and explicit. Each step says what kind of message it is, because that decides who sends it.\n\n```\nSEQUENCE = [\n    {\"after_hours\": 2,   \"kind\": \"agent_draft\"},      # AI drafts, agent sends\n    {\"after_hours\": 48,  \"kind\": \"template_nudge\"},   # pre-approved template\n    {\"after_hours\": 120, \"kind\": \"related_listing\"},  # pre-approved template\n]\nphp\ndef should_stop(lead, last_msg) -> Optional[str]:\n    if last_msg and last_msg.from_lead:\n        return \"replied\"            # a human takes over, timers end\n    if lead.status in (\"not_interested\", \"bought_elsewhere\", \"under_offer\"):\n        return \"closed\"\n    if lead.opted_out:\n        return \"opt_out\"\n    if lead.step >= len(SEQUENCE):\n        return \"sequence_done\"\n    return None\n```\n\nA reply from the lead always stops automation and alerts the agent. That single rule prevents most of the embarrassing cases, like a nudge arriving an hour after the buyer booked a viewing.\n\n``` python\ndef tick(now):\n    for f in due_followups(now):\n        lead = get_lead(f.lead_id)\n        reason = should_stop(lead, last_message(f.lead_id))\n        if reason:\n            stop(f, reason)\n            continue\n        step = SEQUENCE[f.step]\n        if step[\"kind\"] == \"agent_draft\":\n            queue_for_agent(f, draft_from_history(f.lead_id))\n        else:\n            send_template(f, step[\"kind\"])\n        advance(f)   # step += 1, compute next_at from the next step\n```\n\nRun `tick` from a scheduler every few minutes. Make `advance` and `stop` atomic with the send, or use an outbox table, so a crash cannot send the same nudge twice.\n\n`next_at` to sensible local hours for the lead, not the server.\n*Disclosure: I co-founded NxFlowAI (Mumbai). When we scope a follow-up workflow like this, the first audit takes 72 hours.*", "url": "https://wpnews.pro/news/follow-up-timers-for-property-leads-a-small-scheduler-with-stop-rules", "canonical_source": "https://dev.to/ujjwal_dubey_9/follow-up-timers-for-property-leads-a-small-scheduler-with-stop-rules-34d8", "published_at": "2026-10-19 05:03:02+00:00", "updated_at": "2026-10-19 05:18:24.614535+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools"], "entities": ["NxFlowAI", "Mumbai"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/follow-up-timers-for-property-leads-a-small-scheduler-with-stop-rules", "markdown": "https://wpnews.pro/news/follow-up-timers-for-property-leads-a-small-scheduler-with-stop-rules.md", "text": "https://wpnews.pro/news/follow-up-timers-for-property-leads-a-small-scheduler-with-stop-rules.txt", "jsonld": "https://wpnews.pro/news/follow-up-timers-for-property-leads-a-small-scheduler-with-stop-rules.jsonld"}}