npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cc-nodejs-sdk

v1.0.1

Published

Node JS SDK for CommandCenter

Downloads

1

Readme

License

Copyright (c) 2021, ZOHO CORPORATION PRIVATE LIMITED 
All rights reserved. 

Licensed under the Apache License, Version 2.0 (the "License"); 
you may not use this file except in compliance with the License. 
You may obtain a copy of the License at 

    http://www.apache.org/licenses/LICENSE-2.0 

Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an "AS IS" BASIS, 
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
See the License for the specific language governing permissions and 
limitations under the License.

ZOHOCRM PATHFINDER NODEJS SDK 1.0

Table Of Contents

Overview

Zoho CRM NodeJS SDK offers a way to create client NodeJS applications that can be integrated with Zoho CRM PathFinder.

Environmental Setup

NodeJS SDK is installable through npm. npm is a tool for dependency management in NodeJS. SDK expects the following from the client app.

  • Client app must have Node(version 12 and above)

  • NodeJS SDK must be installed into client app through npm.

Including the SDK in your project

You can include the SDK to your project using:

  • Install Node from nodejs.org (if not installed).

  • Install NodeJS SDK

    • Navigate to the workspace of your client app.
    • Run the command below:
    npm install cc-nodejs-sdk
  • The NodeJS SDK will be installed and a package named -sdk will be created in the local machine.

  • Another method to install the SDK

    • Add dependencies to the package.json of the node server with the latest version (recommended)
    • Run npm install in the directory which installs all the dependencies mentioned in package.json.

Configuration

Before you get started with creating your NodeJS application, you need to create a SDK configuration in ZOHOCRM PathFinder.


  • Configure API environment which decides the domain and the URL to make API calls.

    const USDataCenter = require( "cc-nodejs-sdk/routes/dc/us_data_center").USDataCenter;
    
    const EUDataCenter = require( "cc-nodejs-sdk/routes/dc/eu_data_center").EUDataCenter;
    /*
     * Configure the environment
     * which is of the pattern Domain.Environment
     * Available Domains: USDataCenter, EUDataCenter, INDataCenter, CNDataCenter, AUDataCenter
     * Available Environments: PRODUCTION()
    */
    let environment = USDataCenter.PRODUCTION();
  • Create an instance of SDKConfig containing the SDK configuration.

    const SDKConfigBuilder = require("cc-nodejs-sdk/routes/sdk_config_builder").SDKConfigBuilder;
    
    /*
     * By default, the SDK creates the SDKConfig instance
     */
    let sdkConfig = new SDKConfigBuilder().build();

Initializing the Application

Initialize the SDK using the following code.

const InitializeBuilder = require("cc-nodejs-sdk/routes/initialize_builder").InitializeBuilder;
const USDataCenter = require("cc-nodejs-sdk/routes/dc/us_data_center").USDataCenter;
const SDKConfigBuilder = require("cc-nodejs-sdk/routes/sdk_config_builder").SDKConfigBuilder;

class Initializer {

    static async initialize() {

       /*
	    * Configure the environment
	    * which is of the pattern Domain.Environment
	    * Available Domains: USDataCenter, EUDataCenter, INDataCenter, CNDataCenter, AUDataCenter
	    * Available Environments: PRODUCTION()
	    */
        let environment = USDataCenter.PRODUCTION();

       /*
        * By default, the SDK creates the SDKConfig instance
        */
        let sdkConfig = new SDKConfigBuilder().build();

       /*
        * Set the following in InitializeBuilder
        * environment -> Environment instance
        * SDKConfig -> SDKConfig instance
        */
        (await new InitializeBuilder())
            .environment(environment)
            .SDKConfig(sdkConfig)
            .initialize();

    }
}

Initializer.initialize();
  • You can now access the functionalities of the SDK. Refer to the sample codes to make various API calls through the SDK.

Responses and Exceptions

All SDK method calls return an instance of APIResponse.

After a successful API request, the getObject() method returns an instance of the APIGET (for GET).

APIGET (for GET requests) are the expected objects for Zoho CRM PathFinder APIs’ responses

All other exceptions such as SDK anomalies and other unexpected behaviours are thrown under the SDKException class.

SDK Sample code

const fs = require("fs");
const path = require("path");
const InitializeBuilder = require("cc-nodejs-sdk/routes/initialize_builder").InitializeBuilder;
const USDataCenter = require("cc-nodejs-sdk/routes/dc/us_data_center").USDataCenter;
const SDKConfigBuilder = require("cc-nodejs-sdk/routes/sdk_config_builder").SDKConfigBuilder;
const HeaderMap = require("cc-nodejs-sdk/routes/header_map").HeaderMap;
const ParameterMap = require("cc-nodejs-sdk/routes/parameter_map").ParameterMap;
const Param = require("cc-nodejs-sdk/routes/param").Param;
const ApiTriggerOperations = require("cc-nodejs-sdk/core/com/zoho/crm/api_trigger/api_trigger_operations").ApiTriggerOperations;
const GetAPITriggerParam = require("cc-nodejs-sdk/core/com/zoho/crm/api_trigger/api_trigger_operations").GetAPITriggerParam;
class Initializer {

    static async initialize() {

        /*
	    * Configure the environment
	    * which is of the pattern Domain.Environment
	    * Available Domains: USDataCenter, EUDataCenter, INDataCenter, CNDataCenter, AUDataCenter
	    * Available Environments: PRODUCTION()
	    */
        let environment = USDataCenter.PRODUCTION();

       /*
        * By default, the SDK creates the SDKConfig instance
        */
        let sdkConfig = new SDKConfigBuilder().build();

       
        try {
           /*
            * Set the following in InitializeBuilder
            * environment -> Environment instance
            * SDKConfig -> SDKConfig instance
            */
            (await new InitializeBuilder())
                .environment(environment)
                .SDKConfig(sdkConfig)
                .initialize();
        } catch (error) {
            console.log(error);
        }
        
        let paramInstance = new ParameterMap();
        //Pass Processname, Statename, Digestkey configured in the CRM PathFinder and pass dynamic Identifiers and Params to that PathFinder Process
        await paramInstance.add(GetAPITriggerParam.PROCESSNAME, "sdkprocess");
		await paramInstance.add(GetAPITriggerParam.STATENAME, "state1");
		await paramInstance.add(GetAPITriggerParam.DIGESTKEY, "15542307");
		await paramInstance.add(GetAPITriggerParam.IDENTIFIER1, "a1");
        await paramInstance.add(GetAPITriggerParam.IDENTIFIER2, "a2");
        await paramInstance.add(GetAPITriggerParam.IDENTIFIER3, "a3");
        //Supported dataTypes for Param: String, Integer, Boolean, DateTime, Date
		await paramInstance.add(new Param("stringparam", "String"), "xyz");
        await paramInstance.add(new Param("integerparam", "Integer"), 12345678901);
        //await paramInstance.add(new Param("booleanparam", "Boolean"), true);
        //await paramInstance.add(new Param("dateparam", "Date"), new Date(2022, 11, 15));
        //let startDateTime = new Date(2022, 11, 15, 18, 1, 10, 0);
        //await paramInstance.add(new Param("datetimeparam", "DateTime"), startDateTime);
    
        let apiTrigOperations = new ApiTriggerOperations();
        try{
            //Checks the response of an API
            let response = await apiTrigOperations.getAPITriggerWithParam(paramInstance);
            console.log(response.getObject().getMessage());
        }catch (ex) {
            console.log(ex);
        }
    }
}

Initializer.initialize();