AI for Real Estate PakistanModule 3

3.1AI CRM for Real Estate — Track Leads, Deals & Commissions

25 min 4 code blocks Practice Lab Quiz (4Q)

AI CRM for Real Estate

A CRM (Customer Relationship Management) system tracks every lead, interaction, and deal stage. AI-powered CRM predicts which leads are most likely to buy and automates follow-ups.

Pakistan Real Estate CRM Needs

Pakistani real estate agencies need CRM that:

  • Tracks leads across WhatsApp, calls, email, meetings
  • Stores property history (viewed, interested, rejected)
  • Automates follow-ups (smart timing, personalized messages)
  • Predicts buying probability (AI scoring)
  • Tracks commissions and team performance

Building AI-Powered CRM

Database structure:

sql
CREATE TABLE leads (
    id INT PRIMARY KEY,
    name VARCHAR(100),
    phone VARCHAR(20),
    email VARCHAR(100),
    location_preference VARCHAR(100),  -- DHA, Bahria, etc.
    budget PKR INT,
    property_type VARCHAR(50),  -- Apartment, House, Plot
    urgency VARCHAR(20),  -- ASAP, 3 months, 6 months
    ai_score INT,  -- 1-100, predicted buying probability
    last_contacted DATETIME,
    next_followup DATETIME,
    status VARCHAR(20)  -- Contacted, Interested, Viewing, Negotiating, Closed
);

CREATE TABLE interactions (
    id INT PRIMARY KEY,
    lead_id INT,
    type VARCHAR(20),  -- WhatsApp, Call, Email, Meeting
    message TEXT,
    date DATETIME,
    notes VARCHAR(500)
);

AI Lead Scoring

Score leads 1-100 based on: budget match, urgency, engagement, property history.

python
def calculate_ai_score(lead: dict) -> int:
    score = 0

    # Budget match (30 points)
    if lead['budget'] > 5000000:  # Over PKR 50 lakh
        score += 30
    elif lead['budget'] > 3000000:
        score += 20
    else:
        score += 10

    # Urgency (25 points)
    if lead['urgency'] == 'ASAP':
        score += 25
    elif lead['urgency'] == '3 months':
        score += 15
    else:
        score += 5

    # Engagement (25 points)
    interactions = len(lead['interaction_history'])
    if interactions >= 5:  # Multiple touchpoints
        score += 25
    elif interactions >= 3:
        score += 15
    else:
        score += 5

    # Property match (20 points)
    if lead['viewed_property'] and lead['interested']:
        score += 20
    elif lead['viewed_property']:
        score += 10

    return min(score, 100)  # Cap at 100

Leads scoring 70-100: Hot leads, prioritize follow-up. Leads scoring 40-70: Warm leads, nurture. Leads scoring <40: Cold leads, automate follow-up.

Automated Follow-up

Smart follow-up timing based on lead behavior:

python
def schedule_followup(lead_id: int):
    lead = get_lead(lead_id)

    # If viewed property but didn't respond
    if lead['last_action'] == 'viewed_property' and days_since(lead['last_contact']) >= 2:
        send_message(lead, "Still interested in [PROPERTY]? Reply ASAP, 2 other buyers viewing today!")
        schedule_next_followup(lead_id, days=1)  # Follow up tomorrow

    # If in negotiation for 3+ days
    elif lead['status'] == 'negotiating' and days_since(lead['last_contact']) >= 3:
        send_message(lead, "Your offer of PKR [AMOUNT] is close. Seller willing at PKR [COUNTER]. Ready to close?")
        schedule_next_followup(lead_id, days=1)

    # If cold (no contact for 7+ days)
    elif days_since(lead['last_contact']) >= 7 and lead['ai_score'] < 40:
        # Don't bother, focus on hot leads
        pass

Python Implementation: Simple CRM

python
from anthropic import Anthropic
from datetime import datetime, timedelta

client = Anthropic()

class RealEstateCRM:
    def __init__(self):
        self.leads = {}
        self.interactions = {}

    def add_lead(self, name, phone, budget, location, urgency):
        lead = {
            'name': name,
            'phone': phone,
            'budget': budget,
            'location': location,
            'urgency': urgency,
            'ai_score': 0,
            'status': 'Contacted',
            'created': datetime.now()
        }
        self.leads[phone] = lead
        return lead

    def log_interaction(self, phone, message_type, message):
        if phone not in self.interactions:
            self.interactions[phone] = []
        self.interactions[phone].append({
            'type': message_type,
            'message': message,
            'date': datetime.now()
        })

    def ai_recommend_action(self, phone):
        lead = self.leads[phone]
        interactions = self.interactions.get(phone, [])

        prompt = f"""
        Lead: {lead['name']}
        Location: {lead['location']}
        Budget: PKR {lead['budget']}
        Urgency: {lead['urgency']}
        Interactions: {len(interactions)}

        Based on this lead profile, recommend:
        1. Next action (follow-up message, property recommendation, discount offer)
        2. Timing (immediate, 24hrs, 3 days)
        3. Probability of closing (%)
        """

        response = client.messages.create(
            model="claude-haiku-4-5",
            max_tokens=200,
            messages=[{"role": "user", "content": prompt}]
        )

        return response.content[0].text

# Usage
crm = RealEstateCRM()
crm.add_lead("Ahmed Khan", "03001234567", 5000000, "DHA Phase 5", "ASAP")
crm.log_interaction("03001234567", "WhatsApp", "Hi, interested in 3BHK in DHA")
recommendation = crm.ai_recommend_action("03001234567")
print(recommendation)

Pakistan Example: Real Estate Agency CRM

Fatima's agency (Karachi, 30 agents) implements AI CRM:

Before CRM:

  • 100 leads/month
  • 30% response rate
  • 15 viewings
  • 2-3 sales/month

After AI CRM:

  • 100 leads/month (same source)
  • 60% response rate (AI follow-ups)
  • 35 viewings (prioritized hot leads)
  • 7-8 sales/month (better conversions)

Improvement: 3-4x sales using AI-powered CRM

Cost: Custom CRM development = PKR 100k one-time + PKR 5k/month maintenance ROI: 5 extra sales/month × PKR 3M × 1% commission = PKR 150k extra profit/month Payback period: < 1 month

Practice Lab

Practice Lab

Task 1: CRM Design — Design database schema for real estate CRM (leads, interactions, properties, deals). Identify 5 key reports you'd generate.

Task 2: AI Scoring Model — Create AI lead scoring system for your niche (property type, location, budget). Test on 10 real leads.

Conclusion

AI CRM transforms real estate from chaos (100 leads, random follow-ups) to system (prioritized leads, automated follow-ups, 3-4x sales).

Next: Build investor reports.

Lesson Summary

Includes hands-on practice lab4 runnable code examples4-question knowledge check below

AI CRM for Real Estate Quiz

4 questions to test your understanding. Score 60% or higher to pass.