Logo RestApp White
Feature PostgreSQL to hubspot
learning

How to Automate Lead Scoring from PostgreSQL to Hubspot?

By Othmane Lamrani · May 24, 2022

You are a big fan of the marketing tools in Hubspot but the fact that the data went into a separate system fazed you (not literally).

Don’t worry, here I show two ways to load PostgreSQL data into Hubspot so that you can remove the PostgreSQL ETL jobs and have actual real-time data in Hubspot.

Once accomplished, you’ll be able to:

  • Build customized audiences and create customized marketing campaigns for different audiences
  • Personalized Lifecycle Marketing: send the right message at the right time
  • Automate lead score: to close more deals

 

We are going to focus on automating lead scoring in this article.

PostgreSQL is an open-source relational database that is known for its stability, flexibility, and rich feature set. 

It has been around since the early 90s and has been used by many large companies, including Facebook, Netflix, and Twitter.

What is Hubspot?

HubSpot is a marketing platform that helps businesses grow their traffic, leads, and sales through inbound marketing strategies.

It allows users to create landing pages, design email marketing campaigns, and track analytics all in one place.

Why automate lead scoring?

Lead scoring is a way to automate the process of identifying the best leads, or the ones that are most likely to convert into sales. 

You can use it as an effective marketing tool to narrow down your list of prospects and determine which ones to focus on.

Lead scoring can help you save time on manual lead qualification and also ensure that your sales team only works with qualified leads. 

This reduces the chances of wasting their time on prospects who don’t have a good chance of becoming customers.

Method #1: PostgreSQL CSV download

PostgreSQL steps:

You can export PostgreSQL queries as CSV and import them into Hubspot. Yes, I said CSV. This isn’t the most scalable method, but it works if done correctly. The procedure is as follows:

				
					with score as (
select user_id,
    sum(case
 
        when event = 'email opened' then 1
        when event= 'content downloaded' then 2
        when event = 'webinar attended' then 3
     when event = 'appointment created' then 4 
        else 0
    end) as score_lead
    from contact
group by user_id)

				
			

Once your query is executed, download the results.

Hubspot steps:

Go to your Hubspot account and click Contacts. Select your destination from the drop-down list. If you want to import the contacts, click Contacts. If you want to import a company, click Company.

Import page - object select (1)

Import contact example from Hubspot

Click record out of your computer as your import and click on subsequent at the lowest proper of your screen. Select one record (except you’ve got multiple) and click on subsequent again.

Select one object (except you’ve got multiple) and click on next. Click contacts as your object import and click on next.

 

Select File to find the CSV file you exported from PostgreSQL. Click Next. Then map the import column to the correct Hubspot property. 

If there are mismatched columns, map them correctly or click on “Don’t import data in unmatched columns”.

Import page - map properties

Mapping field example from Hubspot

Pros & Cons of Manual process

The manual process of loading data from PostgreSQL to Hubspot is not an ideal solution for most businesses.

It’s time-consuming and prone to human error, which makes it an expensive option that requires a lot of manpower.

Pros:

  • Free
  • Easy to implement for the small data set

Cons:

  • Manual process is time-consuming
  • If you have a large dataset, it will take even more time to load all of that data into HubSpot.
  • Error-prone as the marketing & sales teams grow
  • Data is not reliable (not automated)

Method #2: Automate with a Data Activation Platform

RestApp is a No Code Data Activation Platform that empowers anyone with an all-in-one solution to connect, model, and sync any data with his favorite tools.

 

Access to ready-to-use connectors to save time and pain in building them from scratch: Database, data warehouse, business apps, SFTP, GDrive…

Connect PostgreSQL and Hubspot

The steps to load data from PostgreSQL to Hubspot using RestApp are as follows:

 

Connect the RestApp platform to your PostgreSQL account.

Postgre SQL

Connect the RestApp platform to your Hubspot account.

Connect Hubspot

You can then decide if you want to retrieve the data and/or decide to send it to Hubspot.

Set hubspot

Load data from PostgreSQL to Hubspot

Load data hubspot

Model in no-code

Model lead score

In this screenshot, I have only shown two conditions to have a readable image.

Here is a preview of the results:

Preview result hubspot

Automate your sync

You can activate your pipeline through a scheduler to operationalize your data automation. 

 

In this example, the pipeline will be automatically synchronized every hour.

Pros and Cons of automating this import

Pros

  • Quick set up to connect and import and let it run in the background.
  • No integration required – You can start using Hubspot immediately without having to modify existing integrations or workflows.
  • Add business logic within the pipeline (Lead scoring, customer health, ARPU…)
 

Cons:

  • Free plan up to 100k rows or 30min of syncing 🙂 

Which option to choose?

If you are performing a one-time task, we recommend that you use Method 1. If you want to load data from PostgreSQL to Hubspot on a regular basis, we recommend Method 2 with a Data Activation Platform.

RestApp automatically syncs PostgreSQL to Hubspot. No CSV or coding is required. Hubspot always has the latest data you and your team can trust. 

In addition, Hubspot is just one of the various destinations you can sync to PostgreSQL.

If you’re interested in starting with connecting all your favorite tools, check out the RestApp website or book a demo directly.

Share
Share on linkedin
Share on twitter
Share on facebook

Subscribe to our newsletter

Othmane Lamrani
Othmane Lamrani
Othmane is the Growth Manager of RestApp. He's passionate about Entrepreneurship, Data, and Growth. His previous experience in data-position made him have a data-driven vision of acquisition marketing.
Share this article
Share on linkedin
Share on twitter
Share on facebook
Subscribe to our newsletter
Ready to experience operational analytics
without code?

Stay up to date to the latest news
on Data Activation

Product

Activate and combine any data sources without code

Transform your data with our No Code SQL editor

Automate your operational analytics with your business apps

Discover how Data Transformation really means

Find out the new data architecture concept of Data Mesh

Learn how Operational Analytics actives your data

Learn how to deliver great customer experience with real-time data

Solutions

Empower your teammates

Prevent churn

Generate more revenue

Run better campaigns

Drive your metrics

Resources

Stay always up to date on data activation

Find out how we keep your data safe

Discover our always evolving and regularly updated documentation