Setup Guide
This guide walks you through creating a HubSpot Private App and obtaining the access token required to authenticate the HubSpot CRM Line Items connector.
Prerequisites
- A HubSpot account with CRM access. If you do not have one, sign up for a free HubSpot account.
Step 1: Navigate to private apps
- Log in to your HubSpot account.
- Click the Settings icon (gear icon) in the top navigation bar.
- In the left sidebar, navigate to Integrations > Private Apps.
Step 2: Create a new private app
- Click Create a private app in the top-right corner.
- On the Basic Info tab, enter a name for your app (e.g.,
Ballerina Line Items Connector) and optionally a description and logo. - Click the Scopes tab.
Step 3: Configure required scopes
Under the Scopes tab, search for and enable the following CRM object scopes:
crm.objects.line_items.read: Required to read and list line item records.crm.objects.line_items.write: Required to create, update, and archive line items.
Add any additional scopes your integration requires (e.g., deal or product scopes for associations).
Grant only the scopes your integration actually needs. Overly broad permissions increase security risk.
Step 4: Create the app and copy the access token
- Click Create app in the top-right corner.
- Review the access token warning dialog and click Continue creating.
- On the app detail page, click Show token under Access token.
- Copy the token; this is your Private App access token (Bearer token) for the connector.
The access token is shown only once. Store it securely (e.g., in a secrets manager or Ballerina Config.toml). Do not commit it to source control. If lost, you can regenerate the token from the Private App settings page.
Step 5: Set up OAuth 2.0 (optional: for production apps)
For production integrations or apps distributed to multiple HubSpot portals, use OAuth 2.0 instead of a Private App token:
- Go to Settings > Integrations > Connected Apps and create a public app.
- Under Auth, note the Client ID and Client Secret.
- Set an Redirect URL (e.g.,
https://your-app.com/oauth/callback). - Use the HubSpot OAuth 2.0 authorization flow to obtain a
refresh_token:- Direct the user to the HubSpot authorization URL with your
client_id,redirect_uri, and required scopes. - Exchange the returned authorization
codefor tokens via a POST to:https://api.hubapi.com/oauth/v1/token
- Direct the user to the HubSpot authorization URL with your
- Copy the
refresh_tokenfrom the token exchange response.
The OAuth 2.0 refresh URL for HubSpot is https://api.hubapi.com/oauth/v1/token.