HubSpot Contact Cleaning – How to get clean contacts into HubSpot automatically via Sendgrid
We recently had a client sign up to use HubSpot as their marketing automation platform. Which was fantastic… until they sent us their contact list which was over 70,000 people strong! If we simply imported this list as is it would blow out their contact allowance on HubSpot and cost them $3000 more per month to market to these contacts.
We also had concerns about how lively these 70k worth of contacts were. The last thing we want to do is get a lot of bounces, unsubscribes and spam complaints in HubSpot which could mean future targeted email campaigns being marked as spam.
The Solution: Email them via another platform first
We decided to test out these contacts via another platform first with a juicy offer to see if they were actually valid email address. We chose Sendgrid for this as they also have an excellent API and we use them for a lot of transaction style emails for our other developments.
One of the biggest perks of using Sendgrid is whenever someone clicks, opens or unsubscribes it will send a notification to anywhere we like. This meant we could automatically subscribe the contact instantly into HubSpot when they either opened or clicked on an email. We also unsubscribed them from HubSpot if they hit the unsubscribe link.
Nerd time: How we did it
If you’re not into the techy stuff you can stop reading now and email this link to your IT guy. Or contact us and we can do it for you… 🙂
Setting Sendgrid up for Maximum email deliverability
First you want to start setting up the domain name properly so you emails get signed while being sent. Sendgird is great here as it allows you to whitelabel your domain and even your tracking links in the email itself.
“Whitelabels allow you to send through your own custom domain instead of SendGrid’s default settings. This will mask the header information of your emails with your data–not ours–and will improve your email deliverability.”
To configure this log into your Sendgrid account. Then navigate to: Settings >> Whitelabels and follow the instructions under Domains & Email Links. You will need access to your domain name servers to configure these settings.
Now you will be able to send emails that are signed and should have no problems being delivered.
Getting the clean contacts into HubSpot Automatically
Now we know these contacts are alive and kicking we want to get them into HubSpot ASAP. Sendgrid has a great event notification webhook. When someone interacts with your email (clicks, opens etc) it will fire a notification back to any URL you want.
With a little programming we can process these notifications and insert the contact instantly into HubSpot via their API. The benefit of this is we can then enrol the contact into any HubSpot marketing campaign / workflow automations we like and keep the conversation going.
To configure this: Settings >> Mail Settings >> Event Notifications
Processing the Event Notifications
Now the tricky part begins. We need to create a program that will accept the notifications. Process them. And insert the data back into Hubpsot.
The basic flow is:
- Receive the notification
- Extract the event and email info from it
- If you want additional data you will need to pull this from your own database (Sendgrid only sends their email address). Simply import your data to MySQL and then select what you need.
- On click or open perform a fake form submit via the HubSpot API and push the contact into HubSpot
- On unsubscribe also make sure you unsubscribe them from HubSpot
Because I’m super nice you can download a copy of the script I wrote here. You will still need to modify it for your needs:
- Change the HubSpot port id $Hubspot_Portal_ID in 2 locations (sorry was lazy – lines 5 & 181)
- Create a form in HubSpot and grab the form ID and replace it with this on line 168
- Replace any database calls for your own
- Replace the HubSpot API key ($hapikey) on line 186
- Tip: Speed up testing by using Google Chrome Postman extension (you will be able to debug much quicker and see any errors)
Postman in action:
Check out the documentation here for API info:Tags: Spam, Clean Data, Data Cleaning, Live Contacts
It’s a story most people are familiar with, yet I’ve always kind of felt sorry for Goliath. For those who need a refresher, Goliath was a mighty warrior, a giant of man, who day after day (40 to be exact) defeated his enemies in single combat. Then along comes the unlikely, short, skinny hero, David. […]More >
We recently completed a custom integration for the Rental Car Manager platform (RCM) with Hubspot. This integration allows the client to easily create a email workflow from Hubspot for any quotes that were not converted into sales. Data fields such as: Name Email Source Vehicle Type Pickup / Drop off location Quote ID Total price were […]More >
If you are a Marketer you are probably facing some really ‘big picture’ decisions at the moment regarding your data and technology solutions. This can make it tricky to think about some of the smaller stuff, but if you read this article, I’m confident at the end of it you’ll find a little time to […]More >
Fox AU Home Entertainment have put the call out to Australia’s most creative Alien fan, and holy moly, there are some fans with some serious skills out there! They’re currently running a competition for users to design their own Alien: Covenant movie poster featuring their favourite Alien from the film. The winning poster will be […]More >
As we near the completion of our brand refresh, some of our newer members of staff liked the story of our evolution so much, they put together a little video. For those of you who have a few minutes where you have literally nothing else to do, we hope you enjoy!More >