ByteFlow AI Labs
All projects

Internal system (our own venture)

Mustaraka Properties

A WhatsApp lead system for our own real estate venture in Dhaka: it qualifies enquiries, scores them, books viewings against real availability and hands over to a person.

The problem

Mustaraka Properties is our own real estate venture in Dhaka, so we are both the builder and the operator. It needed one system to capture enquiries from Facebook ads, the website and WhatsApp, ask the qualifying questions, alert the right agent and book viewings, without relying on paid SaaS tools.

What we built

A self-hosted system built on n8n, PostgreSQL and the WhatsApp Cloud API:

  • A WhatsApp lead agent that asks the qualifying questions and saves the answers to the lead record
  • Lead scoring with rules we can read and change, and an alert to the team for high-scoring leads
  • Viewing booking against real availability
  • Handover to an advisor with the full conversation, and a manual-send path for when a person takes over
  • A listings-aware website chatbot, WhatsApp and Telegram lead alerts, and an admin CRM

The booking flow was tested end to end over live WhatsApp. It is our own business, not a client deployment, and no performance figures are published.

Workflow

How the workflow is connected

Lead agent

  1. WhatsApp Inbound (POST)Webhook
  2. Parse InboundCode
  3. Load / Create LeadPostgres
  4. Log InboundPostgres
  5. Human Mode?IF — if a person has taken over, the agent does not reply
  6. Prep Agent InputCode
  7. AI Lead QualifierAI AgentConnected toAI model (via OpenRouter)Conversation Memory (Postgres)Tool: save_lead_fieldTool: score_and_qualifyTool: handoff_to_agentTool: check_availabilityTool: book_viewing
  8. Send WhatsApp ReplyHTTP Request
  9. Log OutboundPostgres

Handoff to agent (called by the lead agent)

  1. When called by another workflowExecute Workflow Trigger
  2. Set Handed OffPostgres
  3. Notify SalespersonHTTP Request

Manual send (human takeover)

  1. Manual send webhookWebhook
  2. Validate InputCode
  3. Send via Cloud APIHTTP Request
  4. Log MessagePostgres
  5. Update human_modePostgres
  6. Respond 200Respond to Webhook
Simplified view of the real workflow; node details removed.

Errors and human handoff

  • When a person takes over a conversation, a flag on the lead stops the AI agent from replying until the team hands it back.
  • The handoff tool marks the lead as handed off and notifies the salesperson.
  • High-scoring leads trigger an alert to the team after scoring.
  • Inbound and outbound messages are logged against the lead.

Stack

  • n8n (self-hosted)
  • WhatsApp Cloud API
  • PostgreSQL
  • AI agent via OpenRouter
  • Next.js
  • Telegram alerts
  • Docker + Traefik

Want something like this for your business?

A free 30-minute consultation. Tell us where enquiries or orders get stuck, and we will tell you honestly what is worth automating.

Book a free 30-minute consultation