Skip to content

Create a CRM application using HubSpot CLI

Before Cloud Voice can talk to HubSpot, HubSpot needs an app that grants the two systems permission to exchange data. This page walks you through building that app with the HubSpot command-line interface (CLI). Instead of clicking through a web form, you describe the app in a small set of local files, group them into a project, and push the project up to your HubSpot developer account.

You need a HubSpot developer account.

Creating the app takes three stages:

  1. Gather the authentication details you’ll be prompted for.
  2. Prepare your local machine with the tools HubSpot needs.
  3. Define the app locally and upload it.

Collect the two credentials you’ll be asked for while building the app: a personal access key from HubSpot and a redirect URL from Cloud Voice.

  1. Sign in to your HubSpot developer account.

  2. In the left navigation, open Development > Keys > Personal Access Key, then select Generate personal access key.

    The Personal Access Key page in the HubSpot developer account with the generate button

  3. Copy the key that HubSpot displays and keep it somewhere safe, you’ll paste it in later.

    The generated personal access key ready to copy

  1. Sign in to Cloud Voice and go to Integrations > CRM.

  2. Select HubSpot.

    Cloud Voice, the CRM integration list with HubSpot selected

  3. Under Network, choose and record the Redirect URL. You’ll add it to the app configuration later.

    The Network section showing the Redirect URL field to copy

Install the tools the CLI depends on and connect the CLI to your HubSpot account.

The CLI runs on Node.js version 20 or later.

  1. Download the latest LTS release from nodejs.org and install it.

  2. Open a terminal and confirm the install:

    Terminal window
    node --version
    # Example output: v24.15.0
  1. In the terminal, install the CLI globally:

    Terminal window
    npm install -g @hubspot/cli

    Output similar to changed 704 packages in 2m means the install worked.

    Cloud Voice, the terminal reporting a successful CLI installation

  2. Optionally, check the installed version:

    Terminal window
    hs --version
    # Example output: 8.9.0
  1. Run the authentication command:

    Terminal window
    hs account auth

    The terminal asks for a personal access key.

  2. Press any key to continue, then paste the personal access key you generated earlier.

  3. Give the account a unique name so you can refer to it in the CLI. Success messages confirm the account is connected and set as the default.

    Cloud Voice, the terminal confirming the HubSpot account is authenticated

Describe the app in local files, its permissions and redirect URL, then push the project to HubSpot.

  1. Create a folder for the project and move into it in the terminal:

    Terminal window
    # Example
    # Create a folder named "HubSpot CLI" on the D drive
    mkdir D:\HubSpot CLI
    # Navigate into the folder
    cd D:\HubSpot CLI
  2. Create the project:

    a. Run:

    Terminal window
    hs project create

    b. Answer the prompts:

    • name: A name for the project.

    • dest: Where to create the project.

    • project-base: Select App.

    • distribution: Select Privately.

    • auth: Select OAuth.

    • features: Press Enter to skip and continue.

    Wait for the SUCCESS message. The project now includes an app-hsmeta.json file.

    The terminal prompts for setting up a new HubSpot project

    The terminal showing the project created successfully

  3. Edit the app configuration:

    a. Locate the app-hsmeta.json file inside the project:

    <your_project_folder>/src/app/app-hsmeta.json

    b. Open it in a code editor.

    c. Update these settings:

    • redirectUrls: Paste the Redirect URL you copied from Cloud Voice.

    • requiredScopes: Set the scopes to the following:

      "requiredScopes": [
      "oauth",
      "crm.objects.contacts.read",
      "settings.users.write",
      "crm.objects.contacts.write",
      "crm.objects.companies.write",
      "settings.users.read",
      "crm.schemas.contacts.read",
      "crm.objects.companies.read",
      "crm.objects.deals.read",
      "crm.objects.deals.write",
      "crm.schemas.companies.read",
      "crm.schemas.companies.write",
      "crm.schemas.contacts.write",
      "crm.schemas.deals.read",
      "crm.schemas.deals.write",
      "crm.objects.owners.read",
      "settings.users.teams.write",
      "settings.users.teams.read"
      ]

    The app-hsmeta.json file with the redirect URL and scope settings

    d. Save the file.

  4. Upload the project to HubSpot:

    a. In the terminal, move to the project’s root folder:

    Terminal window
    # Example
    cd D:\HubSpot CLI\pbx-hs-integration

    b. Run:

    Terminal window
    hs project upload

    The terminal notes that the project doesn’t exist yet and asks whether to create it.

    c. Enter Y to confirm. HubSpot creates the app and starts a new build.

    The terminal reporting a completed deployment to HubSpot

The app is created and uploaded to your HubSpot account. To view its details, sign in to HubSpot and go to Development > Projects.

The new app listed under Projects in the HubSpot developer account