Configure OAuth for HubSpot ingestion
The managed HubSpot connector in Lakeflow Connect uses OAuth 2.0 user-to-machine (U2M) authentication. Use the authentication details that you retrieve from the steps on this page to create a Unity Catalog connection in Databricks.
HubSpot retired the legacy public app creation UI. Create your app using HubSpot's project-based platform and the HubSpot CLI, as described on this page. See the HubSpot changelog for details.
Install and authenticate the HubSpot CLI
-
Install Node.js version 20 or above.
-
Install the HubSpot CLI:
Bashnpm install -g @hubspot/cli -
Authenticate the CLI with your HubSpot account:
Bashhs account authFollow the prompts to generate a personal access key and save it to your local CLI configuration.
Create an app and retrieve authentication details
-
Create an app on HubSpot's project-based platform:
Bashhs project create --project-base app --auth oauth --distribution private -
In the generated
app-hsmeta.jsonfile, setauth.redirectUrlsto your workspace's redirect URL (format:https://<your_workspace_domain>/login/oauth/lakehousefederation.html). For example:https://my-workspace.cloud.databricks.com/login/oauth/lakehousefederation.html -
In the same file, set
auth.requiredScopesto only the following scopes. Omitting any of these, or adding scopes not listed on this page, causes failures later in the setup process.oauthcommunication_preferences.readcontentcrm.objects.marketing_events.readcrm.objects.marketing_events.writeformsforms-uploaded-filesmarketing.campaigns.read
BetaHubSpot CRM Hub object ingestion is in Beta. Workspace admins can control access to this feature from the Previews page by opting into the
hubspot_connector_crm_objectspreview. See Manage Databricks previews.If you've enabled this preview, also add the following scopes to
auth.requiredScopes:crm.objects.companies.readcrm.objects.contacts.readcrm.objects.deals.readcrm.objects.leads.readcrm.objects.line_items.readcrm.objects.orders.readcrm.objects.owners.readcrm.objects.products.readcrm.objects.tickets.readcrm.schemas.companies.readcrm.schemas.contacts.readcrm.schemas.deals.readcrm.schemas.line_items.readcrm.schemas.orders.readsales-email-read
-
Deploy the app to your HubSpot account:
Bashhs project upload -
Retrieve the app's authentication details:
Bashhs project openUnder Project Components, select your app, then click the Auth tab. Note the Client ID and the Client secret. Use these to create a Unity Catalog connection in Databricks.
-
Install the app in your HubSpot account:
- Go to Development > Projects.
- Select your project, then select your app.
- On the Distribution tab, click Install now and authorize the app.
Migrate a legacy app
If you already have a legacy public app configured for HubSpot ingestion, migrate it to the project-based platform instead of creating a new app. Migration preserves your app's existing Client ID, Client secret, and installs, so you don't need to update your Unity Catalog connection.
-
Update the HubSpot CLI to version 7.6.0 or later:
Bashnpm install -g @hubspot/cli@latest -
Run the migration command and follow the prompts to select your app and confirm the components to migrate:
Bashhs app migrate
For details, see HubSpot's migration guide.
Extending an existing HubSpot pipeline with CRM objects
If you already have an existing HubSpot pipeline set up without the CRM objects and want to extend the same pipeline to include them, use the following instructions:
-
Opt your workspace into the Hubspot Connector CRM Hub Objects preview. See Manage Databricks previews.
-
On your HubSpot app, add the CRM object scopes to
auth.requiredScopesinapp-hsmeta.json. For the list of CRM object scopes, see Create an app and retrieve authentication details. -
Redeploy the app to your HubSpot account:
Bashhs project upload -
Re-authorize the existing Unity Catalog connection: On your Databricks UI, go to your HubSpot UC connection associated with the pipeline, click Edit, and follow the steps to sign in with HubSpot again so it picks up the added scopes. See Create a HubSpot connection.
You can now edit the pipeline to include the CRM objects. See Ingest data from HubSpot.
Next steps
Use Catalog Explorer to create a connection. Any user with USE CONNECTION or ALL PRIVILEGES can then create pipelines from it. See Create a HubSpot connection.