hubspot

Export leads from a CSV file to HubSpot

rev-opsIntermediate

Overview

The purpose of this workflow is to capture leads from a CSV file and use these to **create and update contacts in **HubSpot This workflow is fired every time a CSV file is uploaded into a Tray Form: csv-hb-logic-basic

Prerequisites

To implement this workflow, you will need the following:

  • API credentials for HubSpot
  • A CSV file with the correct column setup. You can use this template to set up your CSV file.

Getting Live

Click 'Use Template' to deploy the template in your chosen Workspace. Then take the following steps to configure the workflow and start submitting leads for processing:

The workflow will then start the process of pulling the leads into HubSpot. csv-hb-result

Key workflow steps

The following diagram gives a simplified breakdown of the key steps in the workflow: csv-hb-logic


Data mapping


map-lead-source-step The workflow uses the Data Mapper to dynamically respond to the 'Lead Source' in the CSV file and maps it to a machine-readable format: Organic Search --> ORGANIC_SEARCH Paid Search --> PAID_SEARCH Email marketing --> EMAIL_MARKETING etc. This can then be passed to the HubSpot 'Latest Source' (hs_analytics_source in the Hubpsot API) when creating / updating contacts: csv-hb-leads


Standardization


standardize-step This Object Helpers step transforms the CSV column headers into a standard object with fields in the following format: First Name --> first_name Last Name --> last_name Lead Source --> lead_source etc. Note that the actual value for Lead Source ('Paid Search', 'Referrals' etc.) is mapped according to the data mapping section above. For each lead we will then have a simple object which can be easily accessed by later HubSpot steps using jsonpaths such as $.steps.object-helpers-1.result.first_name: standardize-step-output


Email validation


csv-email The lead’s email address is validated for the appropriate user@domain.com format.


Create / Update contacts


create-update-hubspot-contact A search is made for an existing contact in HubSpot using the lead’s email address as the unique identifier. If a HubSpot contact exists, update the contact record. If a HubSpot contact does not exist, create a new contact record using the standard object


Updating UTMs


update-hubspot-utms For simplicity this template adds the UTM information into the HubSpot 'message' field for each contact (rather than using HubSpot custom fields). utm_campaign, utm_medium and utm_source are all picked up from the standardized object: csv-leads-utf