# Create a CRM Application on HubSpot (Legacy)

Before Cloud Voice can exchange data with HubSpot, you need to register an application in a HubSpot developer account and grant it the right permissions. That application is what lets your phone system read and update records in HubSpot CRM (Customer Relationship Management, the software that stores your contacts, companies, and deals). This page walks through the legacy app-creation flow, from collecting the connection details in Cloud Voice to configuring authorization in HubSpot.

:::note
This is the legacy way of building a HubSpot CRM app. HubSpot now requires all new applications to be created through its CLI (Command Line Interface, a tool you run from a terminal). Use the legacy flow only for an existing legacy app. For any new app, see [Create a CRM application using HubSpot CLI](/pbx/integrations/hubspot/create-a-crm-application-using-the-hubspot-cli/).
:::

## Prerequisites

You need a HubSpot [developer account](/pbx/integrations/hubspot/hubspot-crm-integration-guide/#about-this-guide__developer-account) to create the application. A developer account is separate from a normal HubSpot login and is free to sign up for.

## Step 1. Copy the redirect URL from Cloud Voice

HubSpot uses a redirect URL to return the authorization response to your phone system after a user approves access, so grab it first. You will paste this exact value into HubSpot in Step 2.

1. Sign in to the PBX (Private Branch Exchange, your phone system) web portal and open **Integrations > CRM**.
2. Select **HubSpot**.

   
   ![Cloud Voice, HubSpot tile on the CRM integrations page](/images/pbx/enter-hubspot-crm.png)
3. In the **Network** section, find the **Redirect URL**, then select and copy it. Keep it handy for the next step.

   ![Redirect URL field shown in the Network section of the HubSpot integration settings](/images/pbx/pbx-redirect-url.png)

:::note
The redirect URL is generated by Cloud Voice and is specific to your phone system. Copy it exactly as shown rather than typing it out, so it matches when you paste it into HubSpot.
:::

## Step 2. Create and configure the app in HubSpot

1. Sign in to your [HubSpot developer account](https://app.hubspot.com/signup-hubspot/developers).
2. In the left navigation, go to **Development > Legacy Apps**.

   ![Legacy Apps option under the Development menu in the HubSpot developer sidebar](/images/pbx/hs-development.png)
3. In the top-right corner, click **Create legacy app**.

   ![Create legacy app button in the HubSpot developer account](/images/pbx/hs-create-app.png)
4. In the dialog that opens, choose **Public** as the application type.

   ![Application type selection with the Public option highlighted](/images/pbx/hs-public-app.png)

   :::note
   A public app uses the authorization flow that Cloud Voice expects, so pick **Public** even though only your own account will use it.
   :::
5. On the **App Info** tab, fill in the app's basic details.

   ![App Info tab with fields for the public app name, logo, and description](/images/pbx/app-info.png)

   1. In **Public app name**, enter a name. This is the name HubSpot users see wherever the app appears.
   2. Optionally, upload a logo and add a description.
6. On the **Auth** tab, set up the authorization for the app.

   1. In the **Redirect URLs** section, paste the redirect URL you copied from Cloud Voice in Step 1.

      ![Redirect URLs section of the Auth tab with the pasted redirect URL](/images/pbx/hubspot-redirect-url.png)

      :::caution
      The redirect URL in HubSpot must match the one shown in Cloud Voice exactly, including any trailing characters. If the two do not match, HubSpot rejects the authorization and the integration cannot connect.
      :::
   2. In the **Scopes** section, grant the app the permissions it needs to read and write HubSpot data. A scope is a single permission (for example, "read contacts").

   1. On the right of the page, click **Add new scope**.

         ![Add new scope button in the Scopes section of the Auth tab](/images/pbx/add-new-scope.png)
   2. Search for and select each scope in the table below, then click **Update**.

         | Category | Scope |
         |----------|-------|
         | CRM | `crm.objects.companies.read` |
         | CRM | `crm.objects.companies.write` |
         | CRM | `crm.objects.contacts.read` |
         | CRM | `crm.objects.contacts.write` |
         | CRM | `crm.objects.deals.read` |
         | CRM | `crm.objects.deals.write` |
         | CRM | `crm.objects.owners.read` |
         | CRM | `crm.schemas.companies.read` |
         | CRM | `crm.schemas.companies.write` |
         | CRM | `crm.schemas.contacts.read` |
         | CRM | `crm.schemas.contacts.write` |
         | CRM | `crm.schemas.deals.read` |
         | CRM | `crm.schemas.deals.write` |
         | Settings | `settings.users.read` |
         | Settings | `settings.users.teams.read` |
         | Settings | `settings.users.teams.write` |
         | Settings | `settings.users.write` |

         ![Selected CRM scopes listed in the app authorization settings](/images/pbx/crm-selected-scope.png)

         ![Selected Settings scopes listed in the app authorization settings](/images/pbx/standard-selected-scope.png)

      :::caution
      Add every scope in the table. HubSpot only allows the app to touch the data types you grant here, so a missing scope means the integration cannot sync that record type (for example, leaving out a contacts scope stops contacts from syncing).
      :::
7. Click **Create app**.

Your HubSpot CRM application is now created.

## What to do next

- On the **Auth** tab, open the **App credentials** section to retrieve the **Client ID** and **Client secret**. You'll need both to finish the integration.

  ![App credentials section showing the Client ID and Client secret values](/images/pbx/obtain-app-credential.png)

  :::caution
  Treat the **Client secret** like a password. Anyone who has your Client ID and Client secret can act as your app against your HubSpot data, so do not share the secret or store it where others can read it.
  :::
- Continue with [Integrate Cloud Voice with HubSpot CRM](/pbx/integrations/hubspot/integrate-cloud-voice-cloud-voice-with-hubspot-crm/).
