The problem
A solar installer's enquiries arrive from the website, ads, Instagram and referrals, at all hours. Some are ready to sign this month, some are just curious, some are the same person twice, and some are junk. If they all join one queue, the best ones wait while someone calls a fake number.
Routing does the first five minutes of every lead in a second: it throws out the junk, merges repeats, works out what each one could be worth, ranks them by how likely they are to close, hands each to the right person by the team's own rules, and books the follow-ups so nothing goes cold.
The data
Orbit Solar is made up: a rooftop-solar installer with branches in Chennai, Coimbatore, Madurai, Trichy and Bengaluru. Its history is 2,000 past enquiries with their outcomes (24.9% became installations), generated with a fixed seed from a pattern I chose: bigger bills and referrals convert best, people "just exploring" and apartment terraces rarely do, a detailed message helps, and businesses take longer to decide. Noise on top means no rule is certain.
Today's 25 enquiries are written by hand, from Sunday evening and Monday morning: a hotel with an ₹85,000 bill, a school, a rice mill, homes across Tamil Nadu and Bengaluru, a duplicate sent from Instagram after the website form, a returning lead already in the CRM, throwaway email addresses and two bits of keyboard mashing.
The split is fixed: 80% of the history trains the model and 20% is held back to test it. Every name, number and address is invented.
The model
Logistic regression on standardised columns. The columns are the bill (on a log scale), home or business, the source, the stated timeline, the roof, the region and how detailed the message is. Each is turned into a z-score against the history first, so the weights are comparable, and the model is fitted by Newton's method with a light ridge penalty. Its output is a probability of a deal, which is what a sales team can act on.
Every score comes with its reasons: each field's push against an average past enquiry, as a multiple of the odds. "Referred by a customer, ×2.6" is something a salesperson can check, and argue with.
Rules route, not the model. Who gets a lead is a business decision, so it lives in a short table the team can edit: field, test, value and owner, run top to bottom with the first match winning. The defaults: deals over ₹10 lakh from businesses go to the commercial team, Bengaluru goes to the Bengaluru desk, scores under 15% go to nurture emails, and everything else goes to inside sales.
Sizing is arithmetic with its assumptions on show: ₹7 a unit for homes and ₹9.5 for businesses, 120 units a month from each kW of panels, and ₹62,000 (homes) or ₹48,000 (businesses) per kW installed, before any subsidy.
The pipeline
- 01Intake
Phone numbers to +91 form, email in lower case, the city matched to a branch, the bill as a number.
- 02Validate
A way to reach them, throwaway email domains, keyboard mashing, missing fields, and repeats against the CRM's last 30 days and today's earlier enquiries. Repeats and spam are held; the rest pass, with notes.
- 03Enrich
Units a month, the system size in kW, the deal value, the monthly saving and the payback, plus the region.
- 04Score
Logistic regression gives the chance of a deal, with each field's push. Hot from 50%, Warm from 15%.
- 05Route
The rules run in order; the first match picks the owner, and the trace shows every rule it tried.
- 06Plan
A first contact due in working hours (within the hour for hot leads), then WhatsApp, email and calls on set days, Sundays skipped, and a drafted first message.
Results
Measured when this page was built, with the same code the demo runs. The history follows a pattern I wrote, so these numbers show the model finding it; a real CRM's history is the real test.
For a client
With a real CRM I would train on its own won and lost deals (a year of them is usually enough), check the AUC and the gain chart the same way, and retrain every quarter as sources and prices change.
The workflow would run on each new enquiry as it arrives, from the website form, the ads platform and WhatsApp, through a workflow tool such as n8n or a small serverless function, and write the owner, score, reasons and follow-up tasks back into the CRM.
The rules stay with the sales manager, in a screen like this one. A change shows its effect on today's leads before it goes live, so nobody wakes up to find Priya with forty home enquiries.
The sizing would use the customer's actual tariff slab and roof area from the survey, and the draft message would be sent from the owner's own WhatsApp Business number after they approve it.
Stack
Privacy
Everything runs in your browser. The enquiries, the rules you write and the plans it makes never leave your device: there is no server behind this page.
Limits
- The history is generated, so the model is rediscovering my pattern. On real data some fields will matter less than here, and others I have not got (the roof's direction, shade, the customer's tariff slab) will matter more.
- The duplicate check matches exact phone numbers and email addresses. A person who changes both would get through; a fuzzy match on name and city would catch more.
- The sizing is a first estimate for a phone call, not a quote: it ignores shade, roof area, tariff slabs and the subsidy.
- The rules are a flat list with "and" conditions. Real teams sometimes need round-robin between people or caps on how many leads one person gets; both are small additions.