Linking Hubspot as a source
Contents
The HubSpot connector syncs your CRM data – contacts, companies, deals, tickets, quotes, emails, and meetings – into PostHog, so you can analyze your sales and marketing data alongside your product data.
Prerequisites
You need a HubSpot account that you can authorize PostHog to access. The connection uses OAuth, so you don't need to manually create an API key – you'll sign in to HubSpot and grant access during setup.
Adding a data source
- In PostHog, go to the Sources tab of the data pipeline section.
- Click + New source and click Link next to this source.
- Enter your credentials (see Configuration below) and click Next.
- Select the tables you want to sync, choose a sync method and frequency, then click Import.
Once the syncs are complete, you can start querying this data in PostHog.
When linking HubSpot, select an existing HubSpot account to link to PostHog or create a new connection:
- Hubspot account – Select the HubSpot account you want to link, then follow the prompts to authorize PostHog. This handles authentication via OAuth.
You can optionally enable Customize synced properties to control which properties are synced for each schema. See Configuration below for details.
Sync modes
Each table can be synced in one of several modes, depending on what the source supports:
- Webhook (when available) – the source pushes changes to PostHog in real time. Fastest freshness, lowest ongoing cost, and the only mode that reliably captures updates and deletes.
- Incremental – only new or updated rows are synced on each run, using a cursor field (such as an
updated_attimestamp). Cheaper than a full refresh, but deletes aren't captured. - Append only – new rows are appended using a cursor field; existing rows are never updated. Ideal for immutable, append-only tables like event logs.
- Full refresh – the whole table is reloaded on every sync. Use it when a table has no reliable cursor or when you need deletions reflected.
See sync methods for a full explanation of how each mode works and how to choose between them.
HubSpot tables support both full refresh and incremental syncing. With incremental sync, the first sync performs a full import to establish a baseline, then subsequent syncs only fetch records modified since the last sync (using the hs_lastmodifieddate property, or lastmodifieddate for contacts). Incremental syncing is more efficient for large HubSpot portals, and interrupted syncs resume from where they left off.
Configuration
| Option | Description |
|---|---|
Hubspot accountType: oauth Required: True | |
Customize synced propertiesType: switch-group Required: False | Specify which properties to sync for each schema. Leave empty to use defaults. Changing properties requires a full resync. |
Customize synced properties
By default, PostHog syncs a standard set of properties for each HubSpot schema. To control which properties are synced, enable the Customize synced properties toggle during setup.
When enabled, a text field appears for each schema (contacts, companies, deals, tickets, quotes, emails, meetings). Enter a comma-separated list of HubSpot property names to sync. Leave a field empty to use the defaults.
The default properties for each schema are:
- contacts -
createdate,email,firstname,hs_object_id,hs_lead_status,lastmodifieddate,lastname,hs_buying_role - companies -
createdate,domain,hs_lastmodifieddate,hs_object_id,hs_csm_sentiment,hs_lead_status,name - deals -
amount,closedate,createdate,dealname,dealstage,hs_lastmodifieddate,hs_object_id,pipeline,hs_mrr - tickets -
createdate,content,hs_lastmodifieddate,hs_object_id,hs_pipeline,hs_pipeline_stage,hs_ticket_category,hs_ticket_priority,subject - quotes -
hs_createdate,hs_expiration_date,hs_lastmodifieddate,hs_object_id,hs_public_url_key,hs_status,hs_title - emails -
hs_timestamp,hs_lastmodifieddate,hs_object_id,hs_email_direction,hs_email_html,hs_email_status,hs_email_subject,hs_email_text,hs_attachment_ids,hs_email_headers - meetings -
hs_timestamp,hs_lastmodifieddate,hs_object_id,hs_meeting_title,hs_meeting_body,hs_internal_meeting_notes,hs_meeting_external_URL,hs_meeting_location,hs_meeting_start_time,hs_meeting_end_time,hs_meeting_outcome,hs_activity_type,hs_attachment_ids
Changing the synced properties after the initial import requires a full resync of your HubSpot data. Invalid properties are automatically filtered out. If all specified properties are invalid, the defaults are used instead.
Supported tables
| Table | Description | Sync method | Incremental field | Primary key |
|---|---|---|---|---|
contacts | A person tracked in HubSpot CRM — a lead, prospect, or customer. | Incremental, Full refresh | lastmodifieddate | — |
deals | A sales opportunity or transaction tracked through a pipeline in HubSpot CRM. | Incremental, Full refresh | hs_lastmodifieddate | — |
companies | An organization or business tracked in HubSpot CRM. | Incremental, Full refresh | hs_lastmodifieddate | — |
tickets | A customer support request tracked in HubSpot Service Hub. | Incremental, Full refresh | hs_lastmodifieddate | — |
quotes | A sales quote (proposal of products and prices) sent to a customer in HubSpot. | Incremental, Full refresh | hs_lastmodifieddate | — |
emails | A logged email engagement (sent or received) associated with CRM records in HubSpot. | Incremental, Full refresh | hs_lastmodifieddate | — |
meetings | A logged meeting engagement associated with CRM records in HubSpot. | Incremental, Full refresh | hs_lastmodifieddate | — |
Troubleshooting
If your sync is failing or data looks wrong, see the Data warehouse troubleshooting guide. If that doesn't help, contact support – we're happy to help.