# HubSpot

This Integration requires Fides Cloud or Fides Enterprise. For more information, [talk to our solutions team. (opens in a new tab)](/content/speak-with-us?utm_source=docs-site/index.html)

[HubSpot (opens in a new tab)](https://www.hubspot.com/) is a customer relationship management (CRM) platform that helps customers with inbound marketing, sales, and customer service.

## Prerequisites [Permalink for this section](/content/docs/integrations/saas-integrations/hubspot#prerequisites/index.html)

In order to [integrate](/content/docs/integrations/index.html) with HubSpot, you'll need to collect the following information:

| Name | Description |
| :-- | :-- |
| **Domain** | Your HubSpot API URL (default:`api.hubapi.com`) |
| **Private app token**\* | Your HubSpot App's access token. Follow HubSpot docs to [create a private app and retrieve the token (opens in a new tab)](https://developers.hubspot.com/docs/api/private-apps) |

Your HubSpot API Key will need access to the following scopes: `settings.users.read_write`, `crm.objects.contacts.read_write`, `crm.objects.owners.read`, and `communication_preferences.read_write`

## Integrating with HubSpot [Permalink for this section](/content/docs/integrations/saas-integrations/hubspot#integrating-with-hubspot/index.html)

To integrate an existing system with HubSpot:

1. Navigate to **Data map** → **View Systems** and choose the system that you want to connect.
2. Click on the **Integrations** tab.
3. Pick the vendor or system type that you want to integrate with from the **Connection type** drop-down menu.
4. Complete the required fields for the integration and click **Save**.

You may confirm your connection is working using the **Test connection** button, if desired.

To learn more, please see our guide for [Managing Integrations](/content/docs/integrations/guides/manage-integrations/index.html).

### Bidirectional consent [Permalink for this section](/content/docs/integrations/saas-integrations/hubspot#bidirectional-consent/index.html)

Before configuring bidirectional consent, confirm that the HubSpot system shares a `data_use` with each of the configured privacy notices. See [Ensure data use overlap](/content/docs/consent/guides/bidirectional-consent#ensure-data-use-overlap-between-systems-and-privacy-notices/index.html) for details.

HubSpot supports [bidirectional consent](/content/docs/consent/guides/bidirectional-consent/index.html), which means user preferences are synchronized both ways between Fides and HubSpot. To configure this, click on the **Bidirectional consent** accordion under the HubSpot configuration form. This section allows you to map Privacy Notices in Fides to **Email Subscription Preferences** in HubSpot. In the example below, setting **Marketing** for the **Marketing information** subscription will automatically subscribe and unsubscribe the user from that subscription if they opt-in or out of the **Marketing** privacy notice in Fides.

Fides automatically generates a HubSpot contact for the user's email to manage their preferences, which is essential for the workflow to function correctly.

However, due to HubSpot limitations, users who had subscription preferences created before their contact was generated will need to be [manually enrolled (opens in a new tab)](https://knowledge.hubspot.com/workflows/manually-enroll-objects-into-workflows) in the workflow.

### Consent webhooks [Permalink for this section](/content/docs/integrations/saas-integrations/hubspot#consent-webhooks/index.html)

To set up the Consent Webhook, you'll need an Operations Hub Professional or Enterprise account, as these plans are required to create workflows with webhooks.

HubSpot also supports [Workflow Webhooks (opens in a new tab)](https://knowledge.hubspot.com/workflows/how-do-i-use-webhooks-with-hubspot-workflowss) so we can use that functionality to post privacy preferences to Fides.

1. Within the HubSpot dashboard, navigate to **Automations > Workflows** and click on **Create Workflow > From Scratch**.

2. Create a blank workflow: Choose the Contact-based option.

3. Set up the enrollment trigger:
   - Select When an event occurs as the trigger type.

- Add `Updated email subscription status` as the criteria.

- Enable Re-enrollment, then save the trigger.

4. Add a webhook action:
   - Click Add an action, then select **Data Ops > Send a webhook**.

- **Method**: `POST`.
- **Webhook URL**:

```
https://your_fides_url/api/v1/plus/connection/{{integration_identifier}}/consent-webhook`.
```
_Make sure this URL is reachable via the public internet_
- **Authentication type**: `API Key`.
- **API Key**: Use the token retrieved from the [consent webhook token endpoint](/content/docs/consent/guides/bidirectional-consent#generating-an-access-token-for-consent-webhooks/index.html) formatted as `Bearer {token}`.
- **API Key name**: type 'Authorization'.
- **API Key location**: `Request header`
- **Request body** should be set to `Customize Request Body`. Add a property with key `email` and value `enrolled contact - Email`.

- Once everything is configured, Save the action.

5. Click **Review and publish > Skip to turn on > Turn on workflow**.

By configuring this workflow webhook. Any subscribe and unsubscribe preferences that happen inside of HubSpot will be automatically forwarded and stored within Fides.

## Technical detail [Permalink for this section](/content/docs/integrations/saas-integrations/hubspot#technical-detail/index.html)

Fides utilizes _API endpoints_ to access the _API service_ for a SaaS application. An _API service_ is the programmatic interface through which Fides can query and update data within an application to access, rectify, or delete personal information. Each SaaS tool will have a unique set of endpoints to enable privacy functions.

### HubSpot Endpoints [Permalink for this section](/content/docs/integrations/saas-integrations/hubspot#hubspot-endpoints/index.html)

In the table below, you can find which endpoints are used for each type of privacy function. Clicking on the endpoint will take you to the documentation for that endpoint.

| Privacy function | Endpoint | Description |
| --- | --- | --- |
| **Access Requests** | [Contacts (opens in a new tab)](https://developers.hubspot.com/docs/api/crm/search#make-a-search-request) | Returns information about a contact in your CRM |
| **Update or Delete Requests** | [Contacts (opens in a new tab)](https://developers.hubspot.com/docs/api/crm/contacts#update-contacts) | Used to mask information about a contact in your CRM |
| **Access Requests** | [Owners (opens in a new tab)](https://developers.hubspot.com/docs/api/crm/owners#retrieve-a-list-of-owners) | Returns information about an owner in your account |
| **Access Requests** | [Subscription preferences (opens in a new tab)](https://developers.hubspot.com/docs/api/marketing-api/subscriptions-preferences) | Returns information about a contact's subscriptions and their statuses |
| **Update or Delete Requests** | [Subscription preferences (opens in a new tab)](https://developers.hubspot.com/docs/api/marketing-api/subscriptions-preferences#:~:text=Unsubscribe%20contact) | Used to unsubscribe a contact from subscriptions |
| **Access Requests** | [Users (opens in a new tab)](https://developers.hubspot.com/docs/api/settings/user-provisioning#:~:text=Endpoints) | Returns information about a user in your account |
| **Update or Delete Requests** | [Users (opens in a new tab)](https://developers.hubspot.com/docs/api/settings/user-provisioning#:~:text=Endpoints) | Used to remove a user from your account |
| **Consent Access Requests** | [Subscription preferences (opens in a new tab)](https://developers.hubspot.com/docs/reference/api/marketing/subscriptions#get-%2Fcommunication-preferences%2Fv4%2Fstatuses%2F%7Bsubscriberidstring%7D) | Used to access a contact's subscription preferences |
| **Consent Access Requests** | [Subscription preferences (opens in a new tab)](https://developers.hubspot.com/docs/reference/api/marketing/subscriptions#get-%2Fcommunication-preferences%2Fv4%2Fdefinitions) | Used to retrieve all subscription types |
| **Consent Update Requests** | [Subscription preferences (opens in a new tab)](https://developers.hubspot.com/docs/reference/api/marketing/subscriptions#post-%2Fcommunication-preferences%2Fv4%2Fstatuses%2F%7Bsubscriberidstring%7D) | Used to update a contact's subscription preferences |
