# Integrate Cloud Voice with a CRM Using a Template

When the CRM (Customer Relationship Management system) you want to connect is not among the ready-made integrations, you can build your own connection from a CRM integration template. A working integration lets Cloud Voice and your CRM exchange data, so incoming calls can be matched to CRM contacts and call activity can be logged automatically. This page walks you through activating a template you have already created.

## Before you start

- Make sure you have [added a CRM integration template](/pbx/integrations/custom-crm-integration/add-a-crm-integration-template/).
- Gather the authorization details your CRM requires. Authorization is how your CRM confirms that Cloud Voice is allowed to connect and read data. What you need depends on the authentication method defined in the template:

  | Authentication method | What to gather |
  | --- | --- |
  | None | Any integration details the CRM asks for, such as an API (Application Programming Interface) key or a webhook URL (a URL the CRM calls to push data). Some CRMs need nothing at all. |
  | Basic | Credentials for sign-in, for example a username and password or an API key. |
  | OAuth2 (Open Authorization 2.0) | First read the Cloud Voice authentication details under **Integrations > CRM > Custom CRM**, use them to register an application in your CRM, then collect the resulting authorization values (such as a client ID and client secret). |
  | Bearer Token | The authentication credentials, such as a client ID and client secret. |

  :::note
  Complete the OAuth2 steps in that order. Cloud Voice supplies its own values first, you hand those to the CRM when you register the application, and only then does the CRM give you the client ID and client secret you enter back in Cloud Voice.
  :::

  
  ![Cloud Voice, the Custom CRM panel showing the authentication values used to register an OAuth2 application in the CRM](/images/pbx/custom-oauth-integrate.png)

## Activate the integration

1. Sign in to the Cloud Voice web portal and open **Integrations > CRM**.
2. In the CRM list, select the entry you created from the template.

   ![The CRM list with a custom, template-based CRM ready to open](/images/pbx/click-to-integrate-custom-crm.png)

3. Provide the authentication your CRM expects. Follow the steps for the method your template uses.

   **None**

   :::note
   When no extra details are needed, selecting the CRM completes the integration on its own.
   :::

   ![The Settings section for a CRM that uses no authentication](/images/pbx/custom-crm-none-auth.png)

   1. In the **Settings** section, fill in the details required for the integration.
   2. Click **Save**.

   **Basic**

   ![The Settings section for a CRM that uses basic authentication](/images/pbx/custom-crm-basic-auth.png)

   1. In the **Settings** section, enter the required credentials.
   2. Click **Save**.

   **OAuth2**

   
   ![Cloud Voice, the Authorization section for a CRM that uses OAuth2](/images/pbx/custom-crm-oauth-auth.png)

   1. In the **Authorization** section, enter the values from the application you registered in the CRM.
   2. Click **Save**. A new browser tab opens and asks for permission to access your CRM data.

      :::caution
      The permission request opens in a new browser tab. If a pop-up blocker stops that tab from opening, the authorization cannot finish. Allow pop-ups for the Cloud Voice portal, then click **Save** again.
      :::

   3. Approve the request so Cloud Voice can reach the data in your CRM account. Back on the configuration page, a pop-up reports the result of the authentication.

      ![A pop-up confirming that authorization succeeded](/images/pbx/authorization-confirm.png)

   4. Click **OK**. The **Status** field now reads **Connected**, confirming the integration is in place.

   **Bearer Token**

   ![The Settings section for a CRM that uses bearer token authentication](/images/pbx/custom-crm-bearer-auth.png)

   1. In the **Settings** section, enter the required credentials.
   2. Click **Save**.

4. Link CRM users to Cloud Voice extensions. Some CRMs require users to be mapped to extensions before the integration features (such as click-to-call and call logging) will work for them. If yours does, complete the following.

   1. On the CRM integration page, click the refresh icon ![Refresh](/images/pbx/refresh-firefox.png) to pull in the current list of CRM users.

      ![The synchronized list of CRM users on the integration page](/images/pbx/custom-crm-user-list.png)

   2. Match each CRM user to an extension. Choose the approach that fits how your users' email addresses are set up.

      **Match automatically**

      When users have the same email address on both their CRM account and their Cloud Voice extension, you can link the two automatically.

      :::tip
      Automatic matching is the fastest way to link users, but it only pairs users whose CRM email address exactly matches the email on their Cloud Voice extension. Anyone whose addresses differ is left unlinked, so match those users manually.
      :::

      ![The automatic association control for a custom CRM](/images/pbx/auto-association-custom-crm.png)

   1. Click **Associate Automatically**.
   2. In the pop-up, click **OK**.

      **Match manually**

      When a user's CRM account and extension use different email addresses, pair them by hand.

      
      ![Cloud Voice, the manual association view for linking CRM users to extensions](/images/pbx/custom-crm-manually-association.png)

   1. In the **Extension** field next to the CRM user, click the edit icon ![Edit](/images/pbx/edit.png).
   2. In the pop-up, choose the extension or extensions for that user.
   3. Click **Confirm**.

   3. Click **Save**.

      :::caution
      Click **Save** to apply the user associations. If you leave the page without saving, the links between CRM users and extensions are not kept.
      :::
