AI sales

How to keep HubSpot leads list updated & without duplicates

Lucas Perret
LAST UPDATED
April 26, 2024
READING TIME
7 min.

One of the key factors to a successful campaign is reaching out to the right people.

But how do you ensure you don't import and contact the same prospects multiple times and ruin your chances of getting replies?

In this article, you'll find a hack to quickly check the status of your leads in HubSpot before import, so you don't lose time over prospecting.

Step #1 Ensure your leads' status is up to date

The first step to keeping your leads list clean is ensuring that the "lead status" property in HubSpot reflects your prospects' lifecycle.

E.g., when a deal is won, your lead status should be "Customer", or when your lead has been contacted, their status should be "Contacted".

Here's how you can automate lead status movements:

  1. Go to HubSpot's workflow automation
  2. Create a new workflow for each status
    → for "Customer", use this workflow:

If you want to save hours manually migrating leads data between your CRM and sales engagement tool, you can integrate your HubSpot CRM into lemlist.

This integration will allow lemlist to enrich your HubSpot database with accurate leads info, so you'll have their 100% synced overview.

Depending on your setup, you can add and update leads in HubSpot due to their activity in the lemlist campaign (such as Replied, Clicked, Marked as interested, etc.)

Following this guide, you can set up your lemlist x HubSpot integration to always know your leads' status and how to approach them for the best results!

Step #2 Check HubSpot status via Google Sheets

Once you have a Google sheets list of freshly scraped leads, here's what you should do before their import to HubSpot or lemlist:

  1. Go to Extensions → Apps Script

2. Remove the code and copy-paste the following instead
 → copy and paste this code:

HUBSPOT_API_KEY = "YOUR_API_KEY"

/**
* Check if the contact is in Hubspot.
*
* @param {string} email.
* @return HS_lead_Status
* @customfunction
*/

function findHubspotContact(email){  

result = hubspotLookUp(email)  

while (result.includes("RATE_LIMITS")){

    var randomNumber = Math.random();

  // convert 5 seconds to milliseconds
  var maxSleep = 1000;

  // multiply the random number by the max sleep time
 var sleepTime = randomNumber * maxSleep;

 // use the Utilities.sleep() method to make the script wait
  Utilities.sleep(sleepTime);

   result = hubspotLookUp(email)  }    return result    }function hubspotLookUp(email) {
 var apiKey = HUBSPOT_API_KEY;
 var url = "<https://api.hubapi.com/crm/v3/objects/contacts/search>";

 var options = {
   "muteHttpExceptions": true,
   "method": "post",
   "headers": {
     "Authorization": "Bearer " +apiKey,
     "Content-Type": "application/json",
     "Accept": "application/json"
   },
   "payload": JSON.stringify({
   "properties": [ "email", "hs_lead_status","notes_last_contacted" ],
   "filterGroups":[
     {
       "filters":[
         {
           "propertyName": "email",
           "operator": "EQ",
           "value": email
         }
       ]
     }
   ]
   })
 };

 var response = UrlFetchApp.fetch(url,options);
 var responseCode = response.getResponseCode();
 var responseBody = response.getContentText();

// Logger.log(responseBody)
if (responseCode === 200) {
if (JSON.parse(responseBody).results[0]){

  // display the results in 2 columns
var results = new Array(1);let info = new Array(3);
info[0]=JSON.parse(responseBody).results[0].properties.hs_lead_status
if (JSON.parse(responseBody).results[0].properties.notes_last_contacted){
let lastContactedDate= Date.parse(JSON.parse(responseBody).results[0].properties.notes_last_contacted)
info[1]= new Date(lastContactedDate)}
results[0]=info

return results} else {return "Not in Hubspot"}
 } else {
   Logger.log(Utilities.formatString("Request failed forgot %d: %s", responseCode, responseBody));
   return Utilities.formatString("Request failed forgot %d: %s", responseCode, responseBody);
 }
}

3. Get your HubSpot API Key:

  • Go to HubSpot's Settings → Integrations → Private Apps
  • Click on Create a Private App
Untitled
  • Give a name and go to Scopes
  • Authorize read access to "crm.objects.contacts "
  • Click on Create app
  • Choose Show token and copy it

4. Paste your HubSpot API key into the Google Apps Script project
 → your setup should look like this:

5. Save your project and go back to your sheet

6. Use formula =findHubspotContact({email}) to see your new leads' exact status in HubSpot CRM

Step #3 Remove low quality contacts

You could have contacts that do nothing but damage your sender reputation

Any contacts based on guessed email addresses or from bought email lists are affecting your open rates. Reaching out to these contacts may be a direct violation or privacy laws within your region. Also, chances these contacts will engage with your emails are pretty slim. This tells your email service provider that you're sending spam, which may lead to your account being blacklisted. 

You can ensure you're contacting the correct email addresses with lemlist's free email checker

Step #4 Remove contacts that never opened your emails

Guessed email addresses aren't the only ones damaging your sender reputation.
Even valid email addresses can decrease your open rates if they never engage with your emails. Here's how you can list all contacts that didn't open any of your sent emails:
1. Select CRM > Lists from left-hand menu.

check hubspot email lists

2. Click on Create list in the upper right corner.

create new list in hubspot


3. Name your list and add a description.
4. Select Add filter.
5. From Filters, click Contact properties, and select Last marketing email open date.

set a new filter for hubspot lists

6. To edit the filter, open the drop-down menu below Last marketing email open date and select is unknown.

customize email list filters on hubspot

7. Below the created filter, select Add filter.

add more filters to hubspot list

8. Set Filtering on to Activity (Associated Object).
9. Set the filter category to Number of email clicks.

filter hubspot lists by number of email clicks

10. To avoid removing contacts that you just added to your HubSpot lists, select is less than, and set a relevant limit.

filter hubspot lists by number of opened emails

11. Click Save in the top-right corner.

Conclusion

Keeping your leads list clean saves you hours creating campaigns for existing customers or those not ready to buy from you.

Use this Google Sheet hack and lemlist to keep in the loop with your prospects' lifecycle so you approach them at the right time and boost your sales chances!

If you want to grow your business with more advice like this, join the lemlist family, where 11k+ successful people share free outreach tips daily. 🚀

Lucas Perret
Growth Manager @ lempire | Just a guy obsessed with tech & way it solves business problems
Get weekly outreach tips
SHARE THIS ARTICLE
Thanks! You've successfully subscribed to lemlist newsletter
Oops! Something went wrong while submitting the form.

Multichannel Expert

$
99
/ MO
Per user / 5 SENDING EMAIL
Everything in Email Pro
Email finder + verifier (500 credits/mo)
500 free credits per month
Linkedin prospection
LinkedIn voice notes
with Aircall
Cold calling prospection with Aircall
with Aircall
Advanced campaign conditions
Custom landing page
Premium support chat

Outreach Scale

$
159
/ MO
Per user / 15 SENDING EMAIL
Everything in Multichannel Expert
Email finder + verifier (1,000 credits/mo)
1000 free credits per month
Dedicated account manager (4+ seats)

More than 10 users?

Multichannel Expert

$
89
/ MO
Per user / 5 SENDING EMAIL
Everything in Email Pro
Email finder + verifier (500 credits/mo)
500 free credits per month
Linkedin prospection
LinkedIn voice notes
with Aircall
Cold calling prospection with Aircall
with Aircall
Advanced campaign conditions
Custom landing page
Premium support chat

Outreach Scale

$
144
/ MO
Per user / 15 SENDING EMAIL
Everything in Multichannel Expert
Email finder + verifier (1,000 credits/mo)
1000 free credits per month
Dedicated account manager (4+ seats)

More than 10 users?

Multichannel Expert

$
79
/ MO
Per user / 5 SENDING EMAIL
Everything in Email Pro
Email finder + verifier (500 credits/mo)
500 free credits per month
Linkedin prospection
LinkedIn voice notes
with Aircall
Cold calling prospection with Aircall
with Aircall
Advanced campaign conditions
Custom landing page
Premium support chat

Outreach Scale

$
129
/ MO
Per user / 15 SENDING EMAIL
Everything in Multichannel Expert
Email finder + verifier (1,000 credits/mo)
1000 free credits per month
Dedicated account manager (4+ seats)

More than 10 users?

PRM Tool
G2 Rating
Price
Best for
Standout feature
Con
4.9
star
star
star
star
star
$30/mo
$75/mo
$2,999/mo
Large, distributed sales teams
AI evaluation precision, gamified KPIs
Lack of tracking system
4.6
star
star
star
star
star-half
Not publicly available
Sales operations and finance teams
Powerful configurability
Limited training resources and complex to navigate
4.4
star
star
star
star
star-half
Not publicly available
Mid-market and enterprise businesses
Comprehensive incentive management
Potentially high cost and steep learning curve
4.7
star
star
star
star
star-half
$15/user/mo
$40/user/mo
Enterprise: custom price
Complex sales structures and businesses of all sizes
Intelligent quota management and gamification
Steep learning curve
4.6
star
star
star
star
star-half
Not publicly available
Collaborative teams
Connected planning
Complexity and steep learning curve
4.6
star
star
star
star
star-half
Not publicly available
Companies with complex sales structures
Complex incentive compensation management (ICM) with high efficiency and accuracy
Complexity for smaller teams and potentially high costs
4.7
star
star
star
star
star-half
Not publicly available
Companies who want to automate commission calculations and payouts
Simplicity and ease of use
Lack of features like redirection
4.7
star
star
star
star
star-half
$30/user/mo
$35/user/mo
Custom: upon request
Businesses that need a comprehensive and user-friendly sales compensation management software
Ease of use and adoption
Lack of ability to configure the product based on user needs
4.8
star
star
star
star
star-half
Not publicly available
Companies with modern sales culture and businesses who want real-time insights
A built-in dispute management and real-time visibility
Users say it works slowly, customer support is slow
4.9
star
star
star
star
star
$30/user/mo
$50/user/mo
Smaller sales teams
Powerful automation
Lesser user base and average user interface
4.7
star
star
star
star
star-half
Not publicly available
Companies with scalable needs
Automated Commission Calculations
Lack of filtering by date, no mobile app

What you should look at next

Receive weekly outreach tips in your inbox, sent to 210 000+ salespeople, marketers, founders, and entrepreneurs worldwide!

Subscribe to the lemlist newsletter
You've successfully subscribed to the lemlist newsletter!
Oops! Something went wrong while submitting the form.