Integration between Zoho CRM v2 and Grandstream UCM Series

Alright, guys. I’m back here again with another API guide.

A great feature from the Grandstream IP PBX series is that it does support several CRMs applications, for example, Zoho CRM, Salesforce CRM, and Sugar CRM. Today, I am going to guide you step by step on how to integrate Zoho CRM v2 with the Grandstream UCM series.

If you are not aware yet, Zoho has actually deprecated their v1 APIs on 31 December 2018, and that they reach End-of-Life(EOL) on 31 December 2019. If you are using v1, you can opt to migrate your existing auth tokens to refresh tokens to v2 by following their migration guide.

And to minimize the consumption of v1 APIs, they are disabling the creation of new auth tokens from the below-mentioned URLs from June 1, 2019.

https://accounts.zoho.com/apiauthtoken/create?SCOPE=ZohoCRM/crmapi

https://accounts.zoho.com/apiauthtoken/nb/create?SCOPE=ZohoCRM/crmapi&EMAIL_ID=mail&PASSWORD=password

Most people, including me in the past, integrated our UCM with Zoho CRM v1. Luckily for us, Grandstream IP PBX (UCM series) supports integration with Zoho CRM v2. And upon some googling, it appears that there are not many detailed articles or guides on this.

To integrate Zoho CRM v2 with Grandstream UCM, there are 3 main steps.

  • Admin Configuration in UCM
  • Zoho CRM v2 Configuration
  • User Configuration in UCM

Admin Configuration in UCM

This step is pretty much straightforward. You login to UCM using the administrator account, navigate to Value-added Feature, select Zoho CRM (v2 API), select the correct CRM Server Address and Contact Lookups. Don’t forget to click on Save and Apply Changes.

Zoho CRM v2 Configuration

This part is where most things get complicated. First, you will have to create an account here https://accounts.zoho.com/

Next, go to Zoho API Console, and log in.

There are two applications that you have to create in Zoho API Console –

  1. Client Application
  2. Self Client

Create Client Application

Click on Server-based Application > Create Now to create a server-based application.

Insert Client Name, Homepage URL, and Authorized Redirect URLs and click on Create. Authorized Redirect URLs are the URI endpoint that Zoho Accounts will redirect the web browser to with the authorization code after authorizing the client. If you have no Homepage URL or Authorized Redirect URLs, you can key in dummy URL as long as its format is http://xxxxxx.com or https://xxxxxx.com. In my example below, I simply key in my UCM local IP address.

Upon clicking Create, you will get a randomized Client ID and Client Secret.

Now let us move on to creating Self Client application.

Create Self Client Application

To create a Self Client application, click on Self Client > Create Now, just like how you have done for a Server-based application earlier (but choose Self Client application now).

Once you have clicked on Create on Self Client, you will be given a Client ID and Client Secret. These two are not important and you can ignore them for now.

Under Generate Code, key in the following value –

Scope: ZohoCRM.modules.leads.ALL,ZohoCRM.modules.deals.ALL,ZohoCRM.settings.ALL

Time Duration: 10 minutes

Scope Description: ZohoCRM.modules.leads.ALL,ZohoCRM.modules.deals.ALL,ZohoCRM.settings.ALL

Click on Create and you will see the following screen. Select ZohoCRM and select Grandstream, and click on Create again.

Upon clicking, you will be given a generated code (Grant token) which will help you find your access token. Copy this generated code/ Grant Token down.

Now that we have our Grant Token, our next step is to generate Access Code and Refresh Code by using a POST request via an API platform. In my example here, I will be using POSTMAN API.

If you are on Google Chrome, download the POSTMAN extension and launch the app. Note that the POSTMAN extension in Chrome has been deprecated and might have no new features if you are using POSTMAN for Chrome. In that case, you can download POSTMAN API based on your OS version here: Download POSTMAN

Execute a POST request for this URL –

https://accounts.zoho.com/oauth/v2/token

Ensure that you have the following parameters/values inserted in BODY before executing the request.

grant_type: authorization_code

client_id: This is the randomized Client ID from the Client Application which we created earlier. Key in the Client ID.

client_secret: This is the randomized Client Secret from the Client Application which we created earlier. Key in the Client Secret.

redirect_uri: This is the Authorized Redirect URLs from the Client Application which we created earlier. Key in that URL.

code: This is the Grant Token which we generated under Self Client earlier.

Note: This code will expire quickly, depending on the duration you have configured when you are generating the code earlier under Self Client. I would suggest you create the code when you have key in all the parameters under the BODY of your POST request, so you may copy and paste the code into the value field quickly.

Once you are done, click on Send to get the Access and Refresh Token.

We can see that the POST request is successful with 200 OK and response as shown below –

{"access_token":"1000.d7f6aa7cbf70d42e9df61e2a1bd1db9f.2efa7e1385ad5e653a8bd37787f27759","refresh_token":"1000.9ed6597e87e6a8cf04ef9b938196f963.6bcd8f87af4494f23b28225d46a695d2","api_domain":"https://www.zohoapis.com","token_type":"Bearer","expires_in":3600}

**Alternative way to generate Grant Token**

If the above method to generate Grant Token failed with {“error”:”invalid_code”}, another way to generate a Grant Token is to use this URL –

https://accounts.zoho.com/oauth/v2/auth?scope=ZohoCRM.users.ALL&client_id={client_id}&response_type=code&access_type={“offline”or”online”}&redirect_uri={redirect_uri}

e.g. https://accounts.zoho.com/oauth/v2/auth?scope=ZohoCRM.users.ALL&client_id=1000.ET8U30XP6WSA9SEZKJVAE685DXPG5G&response_type=code&access_type=offline&redirect_uri=https://192.168.0.46:8089/

and then use that code in place of xxxxx in the POST request made for Access token generation below.

https://accounts.zoho.com/oauth/v2/token?code=XXXXXXXXXXXXX&redirect_uri={redirect_uri}&client_id={client_id}&client_secret={client_secret}&grant_type=authorization_code

e.g https://accounts.zoho.com/oauth/v2/token?code=1000.c307e7be3702a7899c76d5dad2f95bc0.8435592a20ebd0d7b85e2e8374c3e913&redirect_uri=https://192.168.0.46:8089/&client_id=1000.ET8U30XP6WSA9SEZKJVAE685DXPG5G&client_secret=a87f923ac6fb3fed85d1d4f1394cf4c44cfe833688&grant_type=authorization_code

And that is all you have to configure from Zoho CRM v2.

Let us move on to user configuration in Grandstream UCM.

User Configuration in UCM

This configuration is per user, it will allow users to authenticate and sync up with the ZOHO CRM platform.

Note: Admin Configuration needs to be set before enabling CRM for users.

1. Access the UCM web GUI as a user and go to “User Portal > Value-added Features > CRM User Settings”.

2. Click on “Enable CRM”.

3. Enter the generated Client ID, Client Secret and Refresh Token (Code that is generated in POST Request with your ZOHO CRM account)

4. Click on Save and Apply Changes.

5. The status will change from “Logged Out” to “Logged In” and users can start using ZOHO CRM.

That is all from me today. Have a great day ahead!

Leave a Reply

Your email address will not be published. Required fields are marked *