# HubSpot

## Overview

The HubSpot integration allows you to bridge the gap between your sales pipeline and your accounting records. By connecting your CRM to DualEntry, you can automatically transform closed-won deals into financial contracts, ensuring that revenue recognition and invoicing are perfectly aligned with your sales activity.

### Data synced

The integration syncs the following data types:

- **Companies**  
  HubSpot → DualEntry  
  Creates Customer records (company type). Only companies tied to closed-won deals are synced. Name, email, phone, website, and structured address fields are mapped.

- **Products**  
  HubSpot → DualEntry  
  Creates or updates Item records. Maps name, SKU, description, price, and product type (inventory / non-inventory / service via integration settings). Service items get a deferred revenue account. Billing frequency drives rev-rec cadence.

- **Line Items**  
  HubSpot → DualEntry  
  Stored as intermediate IntegrationRecord rows during sync. Resolved into PerformanceObligation entries when the associated Deal is processed.

- **Deals**  
  HubSpot → DualEntry  
  Creates a draft Contract in DualEntry. Maps deal name, description (includes HubSpot deal URL), close date as contract/start date, and associated company as customer. Each nonzero line item becomes a PerformanceObligation linked to the mapped Item.

- **Invoices**  
  HubSpot → DualEntry  
  Requires hubspot_sync_invoices_enabled setting (default: off). Maps invoice date, due date, currency, exchange rate, memo, and line items. Items are created or matched via get_or_create_item logic.

### Key Features

- **Automated Contract Creation**  
  Transform HubSpot "Closed-Won" deals into DualEntry contracts automatically, including all line items and performance obligations.

- **Intelligent Customer Sync**  
  Only HubSpot Companies associated with closed-won deals are imported as Customers in DualEntry—no prospect clutter.

- **Unified Product Mapping**  
  HubSpot Products sync to DualEntry Items with SKU, description, pricing, and revenue recognition cadence derived from billing frequency.

- **GL account auto-assignment**  
  Income, expense, and deferred revenue accounts are mapped to items automatically via integration settings. Service-type items receive deferred revenue accounts.

- **Incremental syncing**  
  The integration uses a cutoff timestamp to sync only new or updated records, keeping sync runs fast and efficient.

## FAQ

**How often does the integration sync?**  
The integration runs on a daily scheduled sync automatically. You can also trigger a manual sync at any time from the DualEntry platform via the integration settings page.

**Which HubSpot deals are synced?**  
Only deals in the "Closed-Won" stage trigger company and contract creation in DualEntry. Open pipeline deals and other stages are not synced.

**What contract status do synced deals arrive with?**  
Deals are created as draft Contracts in DualEntry. Your team reviews and activates them as part of the normal contract workflow.
