Skip to content
Back to case studies
Sales & Marketing Sales & Marketing · June 15, 2024

Sales Automation: CRM Lead Scoring and Follow-Up

How a sales company used AI-driven lead scoring to prioritize high-value prospects and increase revenue.

Substantially higher
Conversion rate for high-score leads
Significant reduction
Less time on low-quality leads
Meaningful growth
Revenue increase
A sales team reviewing data on a laptop in a modern office

Problem

The sales company, a B2B sales development agency, was struggling with a classic sales problem: their reps were spending the majority of their time on leads that would never convert, while high-value prospects were not getting enough attention. The agency’s lead pipeline was fed by multiple sources — inbound form fills, outbound cold email responses, webinar registrations, and partner referrals — and every lead was being treated with roughly equal priority, which meant that reps were calling low-intent contacts just as often as they were calling ready-to-buy prospects.

The agency had a basic lead scoring model in HubSpot, but it was rules-based and static: it assigned points for job title, company size, and form source, but it could not account for the nuance of a lead’s actual behavior or engagement quality. A director-level contact who downloaded a pricing guide and visited the pricing page three times was scored the same as a manager who downloaded a generic ebook and never returned. The result was that the scoring was ignored by the sales team, who had learned through experience that it did not reliably predict conversion.

Leadership needed a scoring system that actually predicted which leads were worth a rep’s time, and a follow-up system that ensured high-score leads were contacted immediately while low-score leads were nurtured automatically — so that the team’s limited hours were spent on the highest-value conversations.

Solution

We built an AI-driven lead scoring engine that evaluates every new lead using a combination of firmographic data, behavioral signals, and engagement history. A Python service ingests lead data from HubSpot, enriches it with behavioral data (page visits, email opens, content downloads, webinar attendance), and uses OpenAI to analyze free-text signals — such as the content of a form submission message or an email reply — to assess intent and urgency.

The scoring model produces a 0–100 score and, critically, a human-readable rationale for each score. A lead might be scored 88 with the rationale: “Director-level contact at a 200-person SaaS company, visited pricing page three times in the last week, submitted a form asking about enterprise pricing, and replied to a follow-up email within two hours.” This transparency was essential — reps needed to trust the score, and being able to see why a lead was scored highly built that trust in a way that a black-box number never could.

The scoring engine writes the score and rationale back to HubSpot via its API, and a follow-up automation ensures that leads scoring above 80 are assigned to a rep and flagged for immediate contact, leads scoring 50–79 are routed to a nurture sequence, and leads below 50 are deprioritized. All lead data and scoring history are persisted in PostgreSQL for ongoing model evaluation and refinement.

Architecture

The system is a batch-and-stream hybrid. A nightly Python batch job scores all new and updated leads from the previous 24 hours, while a real-time webhook from HubSpot triggers immediate scoring for high-priority events — such as a lead submitting a pricing request or replying to a sales email — so that hot leads are scored and routed within minutes rather than waiting for the nightly run.

The scoring logic lives in a Python service that calls OpenAI for the natural-language intent analysis and applies a weighted scoring model for the structured signals. The model weights were tuned using historical conversion data stored in PostgreSQL, comparing the model’s scores against which leads actually closed over the prior 12 months. This retrospective validation gave the sales leadership confidence that the scores were predictive before the team started relying on them.

HubSpot is both the source of lead data and the destination for scores and routing. The Python service reads leads and activities through the HubSpot API, writes scores and rationales back as custom properties, and triggers workflow automations in HubSpot that handle the assignment and nurture routing. PostgreSQL stores the full scoring history, enabling the team to audit any score and continuously evaluate and improve the model.

Workflow Diagram

HubSpot (new lead / activity)

      ├──► Webhook (real-time, high-priority events) ──┐
      │                                                ▼
      └──► Nightly batch (all new/updated leads) ──► Python Scoring Service

              ┌──────────────────────────────────────────┤
              │                                          │
              ▼                                          ▼
    Structured signals (firmographics,      OpenAI (free-text intent
    behavior, engagement)                   analysis from form/email)
              │                                          │
              └──────────────┬───────────────────────────┘

                    Weighted score (0–100) + rationale

                             ├──► PostgreSQL (scoring history)

                             └──► HubSpot API (write score + rationale)


                              HubSpot workflows:
                              ≥80 → assign to rep, immediate contact
                              50–79 → nurture sequence
                              <50 → deprioritize

The diagram shows the dual-path ingestion (real-time and batch), the combined structured-and-AI scoring, and the HubSpot-native routing that ensures the right leads get the right level of attention without any manual triage.

Technologies

Python is the core of the scoring engine, providing the data processing, API integration, and model orchestration. The service is structured as a modular pipeline — data ingestion, enrichment, scoring, and write-back — so that each stage can be tested and modified independently. Pandas handles the data manipulation for the batch job, and the real-time webhook handler runs as a lightweight async service.

OpenAI provides the natural-language intent analysis that is the system’s key differentiator. While the structured signals (job title, company size, page visits) are valuable, the ability to analyze the actual content of a lead’s message — “we’re evaluating platforms for a Q3 rollout and your product looks like a strong fit” — and score that intent is what made the scores predictive rather than just descriptive.

HubSpot is both the data source and the action layer. Its API provides the lead and activity data that feeds the scoring engine, and its workflow automation handles the routing and nurture sequences based on the scores the engine writes back. PostgreSQL stores the complete scoring history, which enabled the retrospective validation and ongoing model improvement.

Results

Leads that the model scored above 80 converted at a substantially higher rate than the overall lead pool, validating that the scoring model was genuinely predictive rather than just a re-labeling of the old rules-based approach. The sales team, who had previously ignored HubSpot’s lead scores entirely, began treating the AI scores as a trusted input to their daily prioritization — a cultural shift that was only possible because the scores came with a transparent, readable rationale.

Reps significantly reduced the time spent on low-quality leads, as leads scoring below 50 were deprioritized and routed to automated nurture rather than manual outreach. This reallocation of time meant that each rep was spending their hours on the leads most likely to convert, which increased both rep productivity and rep morale — they were no longer grinding through unqualified call lists and could instead focus on meaningful sales conversations.

The overall revenue impact was meaningful growth, driven by the combination of higher conversion rates on prioritized leads, faster follow-up on hot leads, and the recovered rep hours that went into additional outreach to high-score prospects. The agency’s leadership attributed the revenue increase directly to the scoring and routing system, as no other material changes were made to the team, the product, or the lead sources during the measurement period.

Lessons Learned

The most important lesson was that score transparency drives adoption. The first version of the model produced only a numeric score, and the sales team ignored it — just as they had ignored the previous rules-based scores. Once we added the human-readable rationale — explaining why a lead was scored highly — the team began to trust and use the scores, because they could verify the reasoning against their own judgment. The lesson: a score without an explanation is just an opinion, and sales reps do not trust opinions they cannot inspect.

A second lesson was the value of retrospective validation. Before deploying the model, we scored the prior 12 months of leads and compared the scores to actual conversion outcomes. This exercise not only validated that the model was predictive, but it also identified specific scoring weights that were over- or under-weighted, which we corrected before launch. Launching a scoring model without this validation would have been reckless.

Finally, we learned that the real-time webhook path was more valuable than expected. The nightly batch was the original design, but we found that scoring hot leads within minutes of a high-priority event — such as a pricing page visit combined with a form submission — and routing them for immediate contact was where the biggest conversion gains came from. Speed-to-contact on high-score leads was the revenue driver, and the batch path alone would not have delivered the same results.

Technologies used

Python OpenAI HubSpot API PostgreSQL

Let's build something great together

Ready to automate your business processes and save hundreds of hours every month? Let's talk about your project.