# HubSpot

- The HubSpot integration enables bidirectional sync between Leadtosale and HubSpot.
- Call recordings are automatically logged as engagements on matching HubSpot contacts.
- Deal stage changes in HubSpot can automatically update lead status in Leadtosale.

## Connecting HubSpot

- Contact support to enable your account ID in the HubSpot integration app.
- Navigate to your account settings and select “Integrations” > “HubSpot”.
- Click “Connect HubSpot” to begin OAuth authorization.
- Authorize Leadtosale to access your HubSpot account.

## How it works

**Outbound (Leadtosale → HubSpot):**

- When a call lead is captured with a recording URL, Leadtosale searches HubSpot for contacts matching the caller’s phone number.
- If a match is found, a “CALL” engagement is created with the recording attached.
- Call duration and other metadata are included in the engagement.

**Inbound (HubSpot → Leadtosale):**

- When a deal’s stage changes in HubSpot, Leadtosale receives a webhook notification.
- Deals marked as “Closed Won” automatically mark the corresponding lead as won.
- Deals marked as “Closed Lost” automatically mark the corresponding lead as lost.

## Requirements

- The phone number on the HubSpot contact must match the lead’s phone number for automatic matching.
- HubSpot credentials must be assigned to a container for tracking to work.

## Troubleshooting

- Verify OAuth connection is still active in your HubSpot account settings.
- Check that the correct HubSpot credentials are assigned to your container.
- Ensure phone numbers are formatted consistently between systems.
