Learn more about HubSpot Import Integration.

You can export data directly into your HubSpot Marketing Cloud from Treasure Data.


  • Basic knowledge of Treasure Data, including the toolbelt.

  • A HubSpot account that can grant permissions to Treasure Data.


A company record duplication occurs when sending a null company_id repeatedly. If you specify the creation of a record instead of allowing for data skipping, a NULL company_id or a non-existent company_id on HubSpot causes the company records to be created with a new company_id on HubSpot. If you rerun the same query on the same result set, duplicated records will appear.

To resolve this limitation, ingest the company_id values and de-duplicate the existing records in Treasure Data to reduce these duplications before the next run.

Required Hubspot Settings

You must turn on the setting Automatically create and associate companies with contacts in HubSpot portal to enable the contacts to automatically be associated with the company.

If you turn off the bulk insert/update feature, you must create contacts using the target Contacts first. Each company’s data is created automatically, whether the setting Automatically create and associate companies with contacts in the HubSpot portal is on or off.

For more details, go to the Create or update a group of the contacts page.

Create a New Connection

In Treasure Data, you must create and configure the data connection, to be used during export, prior to running your query. As part of the data connection, you provide authentication to access the integration.

1. Open TD Console.
2. Navigate to Integrations HubCatalog
3. Search for and select Hubspot.

The following dialog opens.

4. Select Click here to connect to a new account.

You are redirected to Hubspot to log in, if you haven't logged in yet, or to the consent page to grant access to Treasure Data.
After you grant access to Treasure Data you are redirected back to TD Console.

5. Navigate to Integrations Hub > Catalog.
6. Select Hubspot again.
7. The New Authentication dialog opens.
8. Select the OAuth connection with your account name in the dropdown list.
9. Select Continue.
10. Name the connection.
11. Select Done.

Define your Query


  1. Complete the instructions in Creating a Destination Integration.
  2. Navigate to Data Workbench > Queries.

  3. Select a query for which you would like to export data.

  4. Run the query to validate the result set.

  5. Select Export Results.

  6. Select an existing integration authentication.
  7. Define any additional Export Results details. In your export integration content review the integration parameters.
    For example, your Export Results screen might be different, or you might not have additional details to fill out:
  8. Select Done.

  9. Run your query.

  10. Validate that your data moved to the destination you specified.

Integration Parameters for Hubspot

Depending on what you select for your destination, the parameters vary. The table here lists all possible parameters. 

Edit the following parameters and select Done.



Required Column(s)

CLI target Parameter Value

or Default Value


Select one of the following bolded parameters

Contacts: Create a group of contacts or update an existing one.

Contact Properties: Update the group of contacts data.

Optionally, you can Enable batch insert.

Companies: Create new companies or update existing ones. Companies are created or updated base on company_id or website value. You can also specify to create or skip if any company_ids are not available on HubSpot.

Optionally, you can select Batch Mode.

Company Properties: Update the group of company's data.

DealsUse to track potential revenue. A deal is typically associated with an action that could lead to revenue, such as booking a meeting with you to discuss your product or service. 

Optionally, you can select Batch Mode.

  • email
  • email, name, value

    For a new property, this also requires a fieldType type.

  • company_id or website
  • email, name, value

    For a new property, this also requires type and fieldType.

  • contacts
  • contact_properties
  • companies
  • company_properties

Non-existing CompanyID Resolution

The action to take when the company_id does not exist in the destination. This parameter is only effective when there is a company_id column or alias in the result set.

You can choose to do one of the following for the missing record:

  • ignore
  • create

Non-existing Deal ID Resolution

The action when the Deal ID does not exist in the destination.

You can choose to do one of the following for the missing record:

  • ignore
  • create

Enable batch insert

Optionally, if Contact Properties is selected, you can select bulk insert.

When enabled, you don’t need to create contacts using a target contact. This option creates a group of contacts or updates an existing group of contacts.

Any errors with a single contact in your batch prevents the entire batch from processing.

Batch Mode

Optional for Deals and Companies. 

Use batch mode to upload large amounts of data. Certain validations are skipped when using batch mode.

Retry Limit (optional)The number of retries before the system gives up.
Initial retry time wait in milliseconds (optional)The time, in milliseconds, between the first and second attempt.
500, which is equivalent to 0.5 seconds.
Max retry wait in milliseconds (optional)The time, in milliseconds, between the second and all subsequent attempts.
300000, which is equivalent to 5 minutes.

Example Query

select 'test@edm.com' as EMAIL, 'tester' as firstname, 'll' as lastname, '650-000-1234' as phone, 'test' as address, 
'a' as city, 'CA' as state, '60599' as zip

Optionally Schedule the Query Export Jobs

You can use Scheduled Jobs with Result Export to periodically write the output result to a target destination that you specify.

Navigate to Data Workbench > Queries.
Create a new query or select an existing query.
Next to Schedule, select None.

In the drop-down, select one of the following schedule options:

Drop-down ValueDescription
Custom cron...

Review Custom cron... details.

@daily (midnight)Run once a day at midnight (00:00 am) in the specified time zone.
@hourly (:00)Run every hour at 00 minutes.
NoneNo schedule.

Custom cron... Details

Cron Value


0 * * * *

Run once an hour.

0 0 * * *

Run once a day at midnight.

0 0 1 * *

Run once a month at midnight on the morning of the first day of the month.


Create a job that has no scheduled run time.

 *    *    *    *    *
 -    -    -    -    -
 |    |    |    |    |
 |    |    |    |    +----- day of week (0 - 6) (Sunday=0)
 |    |    |    +---------- month (1 - 12)
 |    |    +--------------- day of month (1 - 31)
 |    +-------------------- hour (0 - 23)
 +------------------------- min (0 - 59)

The following named entries can be used:

  • Day of Week: sun, mon, tue, wed, thu, fri, sat.

  • Month: jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec.

A single space is required between each field. The values for each field can be composed of:

Field ValueExampleExample Description

A single value, within the limits displayed above for each field.

A wildcard ‘*’ to indicate no restriction based on the field. 

‘0 0 1 * *’ Configures the schedule to run at midnight (00:00) on the first day of each month.
A range ‘2-5’, indicating the range of accepted values for the field.‘0 0 1-10 * *’ Configures the schedule to run at midnight (00:00) on the first 10 days of each month.
A list of comma-separated values ‘2,3,4,5’, indicating the list of accepted values for the field.

0 0 1,11,21 * *’

Configures the schedule to run at midnight (00:00) every 1st, 11th, and 21st day of each month.
A periodicity indicator ‘*/5’ to express how often based on the field’s valid range of values a schedule is allowed to run.

‘30 */2 1 * *’

Configures the schedule to run on the 1st of every month, every 2 hours starting at 00:30. ‘0 0 */5 * *’ configures the schedule to run at midnight (00:00) every 5 days starting on the 5th of each month.
A comma-separated list of any of the above except the ‘*’ wildcard is also supported ‘2,*/5,8-10’‘0 0 5,*/10,25 * *’Configures the schedule to run at midnight (00:00) every 5th, 10th, 20th, and 25th day of each month.
 (Optional) You can delay the start time of a query by enabling the Delay execution.

Execute the Query

Save the query with a name and run, or just run the query. Upon successful completion of the query, the query result is automatically imported to the specified container destination.

Scheduled jobs that continuously fail due to configuration errors may be disabled on the system side after several notifications.

Optionally Configure Export Results in Workflow

Within Treasure Workflow, you can specify the use of this data connector to export data.

Learn more at Using Workflows to Export Data with the TD Toolbelt.

  • No labels