Developing Third-party Integrations - Connectors

Developing Third-party Integrations - Connectors

The guide will help you with the following:
  1. Oauth 2.0
  2. Create a connector 
  3. Add APIs 
  4. Publish the connector 
  5. Associate to an extension 
  6. Invoke connectors 
  7. Sample Connector  
Zoho offers integration support for a wide range of third-party applications, including  core Google services (Contacts, Calendar and AdWords) and Microsoft software (MS Office, MS Outlook, etc.). However, there are some services that cannot be integrated directly with your CRM, such as Dropbox, PandaDoc, and Google Drive. In these cases, you can use a connector to expand Zoho's third-party support. Connector uses OAuth 2.0 protocol to facilitate this integration.
 

OAuth 2.0

OAuth 2.0 is an industry-standard, open-source authorization protocol, which is used to gain partial access to a user's account on an HTTP service. An example of an OAuth 2.0 authorization is the sign in screen that appears when  a third-party application (also known as a client) requests partial access to a social media account, such as Facebook, Google, or Yahoo.
 

Important terminology

  1. Client - The application requesting access to data stored in an external system. When creating a connector in Zoho Developer Console, the client is Zoho CRM or your custom vertical CRM system.
  2. Resource - The application or service that the client is trying to access. In our case, the resource is the third-party service (ex: Dropbox) you are trying to integrate.
  3. Request Token URL - This URL is used to send authorization requests to the resource server. The resource server prompts the resource owner (user) to authorize this request.
  4. Access Token URL - Once the request is authorized by the resource owner, the server sends an access token to the client. This token has to be exchanged every time the clients wants to access the resource data.
  5. Refresh Token URL - Some access tokens are valid only for a limited period of time. When an access token expires, the client has to get another access token from the resource, using the refresh token URL.
  6. Client ID - A unique identifier provided to every client application. This ID is provided by the resource owner.
  7. Client Secret - Every client application has a secret code mapped to it. This is done to prevent unauthorized access to the resource.
  8. Redirect URL - This is the URL to which the end user will be redirected, once data access has been authorized. The client application will generate a redirect URL automatically.
 

Create a connector

To create a connector
  1. Log in to Zoho Developer console and click Build Connectors.
  2. Click Create Connector.
  3. Provide a suitable name and description for the connector.
  4. Provide the following details about the third-party server:
    1. Request Token URL: This allow the connector to request authorization to access data on the resource server.
    2. Access Token URL: Once authorized, the Request Token and Token Key will be exchanged for the Access Token, allowing the connector to draw specific information from the third-party server.
    3. Refresh Token URL: Some applications increase security by limiting the duration of time a particular token is valid. In these cases, you will need to provide the Refresh Token URL to allow the connector to reauthorize access.
  5. Click Save.
  6. Provide the Client ID and Client Secret of your application in the space provided.
    This Client ID and Client secret can be obtained by creating a OAuth 2.0 client/ application (terminology varies with the resource application) . An example  is provided at the bottom of this page.
  7. Copy the Redirect URL available in the Set Client Credentials page and enter it in the appropriate space in your web application.
    This is the URL to which the user will be redirected once the authorization process is complete.
  8. Click Save.


About Tokens
Request Tokens, Access Tokens and Refresh Token URLs are provided by the web application. You can obtain these URLs from the developer space of the web app. For example, the URLs for Google applications can be obtained here .
For any service, the Request Token, Access Token and Refresh Token URLs will have multiple parameters, including scope, state, client id, and access type. These parameters can vary from service to service. However, three parameters are common to all the services: Redirect URL, Client ID and Response type. These parameters will be handled by Zoho. If there are any other mandatory parameters such as 'scope', 'state', or 'access type', the developer will have to supply them in the format specified by the third-party service.
Sample Google API:
  1. https://accounts.google.com/o/oauth2/v2/auth?
  2. scope=email%20profile&
  3. state=security_token%3D138r5719ru3e1%26url%3Dhttps://oa2cb.example.com/myHome&
  4. access_type=offline

Add APIs

Once your connector has been created, define the actions it can perform by adding an API for each action taken by the connector. For example, once you have integrated with Google Drive, you can export your CRM data to your google drive or import data from drive to CRM. Both these process will require different APIs. These APIs will be available in the developer documentation of the application.

To add an API
1. In your Zoho Developer Console home page, click Connectors.
2. Click Add API when hovering over your chosen connector.
    The Create Connector API page will appear.

3. In the Create Connector API page, fill in the following details:
  1. Provide a name for the API.
  2. Choose the Method type and provide the API URL.
    The API method type and the API URL can be obtained from the resource application.
    Incase your API's URL contains dynamic values, they should be preceded by a "$" symbol and enclosed within {..}.
    For example, http://example.com/callback?id=${myid}&key=${mykey}.
    Here myid and mykey are dynamic variables whose values you will have to define in the custom function that is used to invoke  this API.
  3. Specify the header fields and URL parameters
4. Specify the header fields and the URL parameters if applicable and click Create.

Once it's been is added, you can validate the API by executing and checking the response.

To execute an API
  1. In the Connectors page, hover over the connector containing the API to be executed and click View All API.
    A new page will appear, displaying all APIs associating with the connector.
  2. Click Execute next to the API you're interested in. 

      3.If the API fails, you will be notified in the API response area. Make changes in the code and then execute it again.

Publish a connector

Publishing a connector technically means publishing the APIs associated with the connector. Your connector will be automatically published as soon as the first API associated with it is published.

To publish an API
  1. In the Connectors page, hover over the connector in which the API has to be added and click View All API.
  2. Hover over the API you'd like to publish and click the Publish.   
  3. Click OK.
Both the API and the connector will now be published, allowing you to add this connector to your extension.
 

Add connector to an extension

To associate connectors to your extension
  1. In your Zoho Developer Console home page, click Extensions for Zoho CRM.
  2. Select the extension to which you'd like to associate the connector.
  3. Click Connectors in the left pane.
  4. Click Add Connector.
  5. Choose the connector you'd like to add from the list of available connectors and click Add.    
  6. In the resulting pop up, enter the Client ID and Client Secret, unique codes provided by the third-party service.
    This will be used to authorize your account during the integration.
  7. Copy the auto-generated Redirect URL available in this page and provide it to the third-party service.

      8.Click Save.  
      9. This adds the connectors and all its associated APIs to your extension.


Note
Only the connectors that have been published will be displayed in the list of connectors in Add Connector pop-up. Before trying to add a connector with an extension make sure it is published and ready to access.


 Invoke Connectors

Once your connector is published and added to an extension, it can be invoked whenever necessary. You can invoke a connector using a custom function.

The syntax for the custom function to invoke a connector is
  1. response_variable =zoho.crm.invokeConnector("API unique identifier",map);
The API unique identifier can be obtained from the extension in which the connector is associated.

Map() function is used to replace dynamic values present in the API with user-specific values. For example, if the API must fetch the lead's details such as name, email address, contact number, etc., these values will be represented by a dynamic value in the API. This dynamic value can be replaced with the actual value from the Leads Details page using the map() function. Examples given later in this document will give more detailed information about this function.

To know more about the functions and variables used in writing custom functions, to learn more, click Custom Functions .

To find the API identifier
  1. In the Extension's Details page click Connectors and select the connector you're working on.
  2. Click View All APIs and select the API you're interested in. The page that appears contains the unique API identifier.



This page will contain the API unique- identifier.


An example custom function is provided here .

Sample Connector

To demonstrate how connectors work, let's take a look at an example scenario. Suppose you want to add certain CRM contacts (those matching a particular criteria) to your Google contacts list. Zoho's existing Google contact integration won't work for your purpose because it syncs the entire CRM contact list with Google contacts. To get the functionality you need, you'll have to create a connector that integrates your CRM system with Google contacts and then write a custom function that executes this connector whenever particular conditions are satisfied.

Step 1: Provide the Request, Access, and Refresh Token URLs

The first step is to provide the Request Token, Access Token and Refresh Token URLs from the Google server.
  1. In your Zoho Developer Console homepage, click Build Connectors.
  2. Click Create Connector.
  3. Provide the Request, Access, Refresh token URLs for Google Contacts:
    1. Request Token URL:
      https://accounts.google.com/o/oauth2/v2/auth?scope=https://www.google.com/m8/feeds
    2. Access Token URL:
      https://www.googleapis.com/oauth2/v4/token
    3. Refresh Token URL:
      https://www.googleapis.com/oauth2/v4/token
  4. Click Save.



Note
  1. The basic format for a Request Token URL is <requesttokenURL>?scope="<scopelink>".
  2. To create a specific Request token for Google Contacts, combine the Google Request token URL ("https://accounts.google.com/o/oauth2/v2/auth") with the scope for Google Contacts ("https://www.google.com/m8/feeds").
  3. Thus the complete request token URL should be
    https://accounts.google.com/o/oauth2/v2/auth?scope=https://www.google.com/m8/feeds

Step 2: Provide the Client ID and Client Secret

The next step is getting your application's Client ID and Client Secret from Google.
To get these credentials
  1. In the Google Developer Console home-page , click Select a Project in the upper right corner of the screen. A drop-down list will open. Choose Create a Project
  2. Provide a name for your project.
  3. A default Project ID based on the project name will be generated. Click Edit to change the ID.
  4. Click Create


  5. Click Enable and Manage APIs at the top of the dashboard on the Google Developer Console.
  6. Click Google APIs and select Contacts API under the Google Apps APIs tab.
  7. Click Enable.
  8. Once the API is enabled, choose Credentials in the left pane.
  9. Click Create Credentials and select OAuth Cliend ID.     

      10. In the Create client ID page, do the following
  1. Select Web application as the Application type.
  2. Provide a Name for the credential.
  3. Provide a Redirect URL.
    This URL can be obtained from the Zoho Developer Console.
  4. Click Create.
      11. Your client ID and client secret will be generated.

      Copy the ID and Client Secret and paste them into the Zoho developer console.
      12. Click Save.

Step 3: Authorize your connector

Once your connector has been created, it will need to be authorized in order to sync with your Google account.

To authorize your connector
      1. In the Connectors page of your Zoho developer, click Authorize link next to the connector you're working on.

      2. If you're not already logged in to your Google account, you will be prompted to do so.
      3. Once you're logged in, the authorization window will explain the access permissions for the connector.
      4. Click Allow. Your connector is now authorized. 


Step 4: Add APIs

After you've created your connector, you have to add APIs to perform the necessary action. Each operation will have a different API.
To add APIs
  1. In your Zoho Developer Console home page, click Connectors.
  2. Click Add API next to the connector you're wokring on.
  3. Fill in the required details on the Create Connector API page.
  4. To add new contacts to your Google Contacts, fill in the following API details:
    1. Method type- Post
    2. API URLhttps://www.google.com/m8/feeds/contacts/{userEmail}/full
      In place of "useremail" use default to refer to the authenticated user.
    3. Header Fields- Content-Type: application/atom+xml
    4. Request Body-
  1. <atom:entry xmlns:atom="http://www.w3.org/2005/Atom"
  2. xmlns:gd="http://schemas.google.com/g/2005">
  3. <atom:category scheme="http://schemas.google.com/g/2005#kind"
  4. term="http://schemas.google.com/contact/2008#contact"></atom:category>
  5. <gd:name>
  6. <gd:givenName>${Fname}</gd:givenName>
  7. <gd:familyName>${Lname}</gd:familyName>
  8. </gd:name>
  9. <atom:content type="text">Notes</atom:content>
  10. <gd:email rel="http://schemas.google.com/g/2005#work"
  11. primary="true"
  12. address="${Email}" displayName="${Fname}"></gd:email>
  13. <gd:phoneNumber rel="http://schemas.google.com/g/2005#work"
  14. primary="true">
  15. ${Mobile}
  16. </gd:phoneNumber>
  17. </atom:entry>
  1. The APIs for other operations are available here .
      5. Click Create.
      6. Execute  your API.

Once your API has been executed successfully, publish your API and assocaiate the connector to your extension. 

Step 5: Write a custom function to invoke the connector

Once the connector has been published and associated with the extension, it can be invoked using a custom function. Using a connector, you can do either of the following:

1. Post data from CRM to your Google Contacts account.

For example, if you want to add a new contact from your CRM to Google Contacts if the contact's mailing address lists the country as Ireland. You'll need to write a custom function that invokes the connector, then associate the custom function with a workflow rule. Create a workflow rule with the following settings
  1. Module: Contacts
  2. Rule Trigger: Based on a record action whenever a record is created.
  3. Rule Criteria: Mailing country is Ireland.
  4. Instant Action: Call Custom Functions
The custom function for the case mentioned above is :
  1. Fnam = input.contact.get("FIRSTNAME");
  2. Lnam = input.contact.get("LASTNAME");
  3. mail = input.contact.get("EMAIL");
  4. Mob = input.contact.get("MOBILE");
  5. map = { "Fname" : Fnam, "Lname" : Lnam, "Email" : mail, "Mobile" : Mob};
  6. response = zoho.crm.invokeConnector("googledrive.contacts",map);
This custom function will create a Google Contact entry for your customer.

2. Get data from Google Contact to your Zoho CRM.

You can get data from third party services( Ex: Google Contacts) and add it to your Zoho CRM. The custom function to achieve this action is
  1. mapp=Map();
  2. resp=zoho.crm.invokeConnector("googleintegration.contactsintegration.addcontacttogoogle",mapp);
  3. if(resp.get("status_code").contains ("201")){
  4. apiresponse = resp.get("response");
  5. //Use the variable "apiresponse" to get the required data from the API that was executed
  6. }





    Access your files securely from anywhere

      Zoho CRM Training Programs

      Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

      Zoho CRM Training
        Redefine the way you work
        with Zoho Workplace

          Zoho DataPrep Personalized Demo

          If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

          Zoho CRM Training

            Create, share, and deliver

            beautiful slides from anywhere.

            Get Started Now


              Zoho Sign now offers specialized one-on-one training for both administrators and developers.

              BOOK A SESSION





                          Quick Links Workflow Automation Data Collection
                          Web Forms Enterprise Begin Data Collection
                          Interactive Forms Workplace Data Collection App
                          CRM Forms Customer Service Accessible Forms
                          Digital Forms Marketing Forms for Small Business
                          HTML Forms Education Forms for Enterprise
                          Contact Forms E-commerce Forms for any business
                          Lead Generation Forms Healthcare Forms for Startups
                          Wordpress Forms Customer onboarding Order Forms for Small Business
                          No Code Forms Construction RSVP tool for holidays
                          Free Forms Travel
                          Prefill Forms Non-Profit

                          Intake Forms Legal
                          Mobile App
                          Form Designer HR
                          Mobile Forms
                          Card Forms Food Offline Forms
                          Assign Forms Photography
                          Mobile Forms Features
                          Translate Forms Real Estate Kiosk in Mobile Forms
                          Electronic Forms

                          Notification Emails for Forms Alternatives Security & Compliance
                          Holiday Forms Google Forms alternative  GDPR
                          Form to PDF Jotform alternative HIPAA Forms
                          Email Forms
                          Encrypted Forms
                          Embeddable Forms
                          Secure Forms
                          Drag and Drop form builder
                          WCAG


                                            You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.




                                                Manage your brands on social media

                                                  Zoho Desk Resources

                                                  • Desk Community Learning Series


                                                  • Digest


                                                  • Functions


                                                  • Meetups


                                                  • Kbase


                                                  • Resources


                                                  • Glossary


                                                  • Desk Marketplace


                                                  • MVP Corner


                                                  • Word of the Day


                                                    Zoho Marketing Automation

                                                      Zoho Sheet Resources

                                                       

                                                          Zoho Forms Resources


                                                            Secure your business
                                                            communication with Zoho Mail


                                                            Mail on the move with
                                                            Zoho Mail mobile application

                                                              Stay on top of your schedule
                                                              at all times


                                                              Carry your calendar with you
                                                              Anytime, anywhere




                                                                    Zoho Sign Resources

                                                                      Sign, Paperless!

                                                                      Sign and send business documents on the go!

                                                                      Get Started Now




                                                                              Zoho TeamInbox Resources



                                                                                      Zoho DataPrep Resources



                                                                                        Zoho DataPrep Demo

                                                                                        Get a personalized demo or POC

                                                                                        REGISTER NOW


                                                                                          Design. Discuss. Deliver.

                                                                                          Create visually engaging stories with Zoho Show.

                                                                                          Get Started Now









                                                                                                              • Related Articles

                                                                                                              • Connectors

                                                                                                                Connectors power up your solution and add functionalities by Integrating with other services through its APIs (OAuth 2.0). Getting Started with Connectors Connectors enable the process of establishing integrations between the solutions built over ...
                                                                                                              • Integrating with third-party applications

                                                                                                                Each industry comes with a unique set of problems to solve. To accommodate this diversity within the business world, we've created the Zoho Developer console, which allows you to integrate almost any third-party application with your CRM ...
                                                                                                              • Developing Third-party Integrations - Custom Variables

                                                                                                                The guide will help you with the following: Create a custom variable The Variable VariableMap Example Create a Read-only custom variable Create a Hidden custom variable Custom variables are global variables that store information in your CRM. These ...
                                                                                                              • Custom SalesSignal

                                                                                                                The SalesSignals feature in Zoho CRM provides real-time notifications of all touch points from your leads, contacts, or potential customers. You can keep track of all the customer interactions across various channels and follow-up with them from one ...
                                                                                                              • Quickstart Guide For Extensions

                                                                                                                Extensions—prebundled software components that can add a set of custom features to your Zoho CRM—enable developers to deliver a range of functionality not available by default on our system. This allows our partners to streamline the customization ...
                                                                                                                Wherever you are is as good as
                                                                                                                your workplace

                                                                                                                  Resources

                                                                                                                  Videos

                                                                                                                  Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                                                                                                  eBooks

                                                                                                                  Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                                                                                                  Webinars

                                                                                                                  Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                                                                                  CRM Tips

                                                                                                                  Make the most of Zoho CRM with these useful tips.



                                                                                                                    Zoho Show Resources