# HubSpot

Keep a contact list and your HubSpot contacts in sync, and see every SMS on the HubSpot contact timeline.

## Connect {#connect}

1. Portal › Integrations › HubSpot › **Connect HubSpot**, approve contacts read / write.
2. Choose the contact list, the direction (both ways, HubSpot → contacts, contacts → HubSpot), the schedule (hourly, every 6 hours, daily or manual) and the country for national numbers.
3. **Sync now** runs it immediately; results are in the log.

## Mapping {#mapping}

| HubSpot | Contact field |
| --- | --- |
| `mobilephone`, else `phone` | Phone (the key on both sides, E.164) |
| `firstname` / `lastname` / `email` | FIRST_NAME / LAST_NAME / EMAIL |

Pull reads contacts changed since the last pull (CRM search by `lastmodifieddate`); HubSpot contacts without a valid phone and blacklisted numbers are skipped. Push sends contacts of the list changed since their last sync (batch create / update). Contacts that came from HubSpot are not sent back unchanged.

## SMS on the timeline {#timeline}

SMS sent to and replies received from synced contacts are logged as HubSpot **Communications** (channel SMS) on the contact, every minute. Only messages after the connection was made are logged.

## Platform setup (admins) {#admin}

Public app in a HubSpot developer account, redirect URL `https://app.ogave.co/integrations/hubspot/callback`, scopes `crm.objects.contacts.read crm.objects.contacts.write`. Client ID and secret in Admin › Settings › Integrations. Tokens are refreshed automatically and stored encrypted.
