CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-zohocrm--nodejs-sdk-2-0

Node.js SDK for Zoho CRM API v2.0 providing OAuth authentication, multi-user support, and complete CRUD operations for CRM data

Pending
Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

index.mddocs/

Zoho CRM Node.js SDK 2.0

The Zoho CRM Node.js SDK provides a comprehensive interface for integrating Node.js applications with Zoho CRM APIs. It features OAuth 2.0 authentication, multi-user support, complete CRUD operations for all CRM entities, and support for multiple data centers and environments.

Package Information

  • Package Name: @zohocrm/nodejs-sdk-2.0
  • Package Type: npm
  • Language: JavaScript (Node.js)
  • Installation: npm install @zohocrm/nodejs-sdk-2.0

Core Imports

const { InitializeBuilder } = require("@zohocrm/nodejs-sdk-2.0/routes/initialize_builder");
const { UserSignature } = require("@zohocrm/nodejs-sdk-2.0/routes/user_signature");
const { OAuthBuilder } = require("@zohocrm/nodejs-sdk-2.0/models/authenticator/oauth_builder");
const { USDataCenter } = require("@zohocrm/nodejs-sdk-2.0/routes/dc/us_data_center");

For ES modules:

import { InitializeBuilder } from "@zohocrm/nodejs-sdk-2.0/routes/initialize_builder";
import { UserSignature } from "@zohocrm/nodejs-sdk-2.0/routes/user_signature";
import { OAuthBuilder } from "@zohocrm/nodejs-sdk-2.0/models/authenticator/oauth_builder";
import { USDataCenter } from "@zohocrm/nodejs-sdk-2.0/routes/dc/us_data_center";

Basic Usage

const { InitializeBuilder } = require("@zohocrm/nodejs-sdk-2.0/routes/initialize_builder");
const { UserSignature } = require("@zohocrm/nodejs-sdk-2.0/routes/user_signature");
const { OAuthBuilder } = require("@zohocrm/nodejs-sdk-2.0/models/authenticator/oauth_builder");
const { USDataCenter } = require("@zohocrm/nodejs-sdk-2.0/routes/dc/us_data_center");
const { RecordOperations } = require("@zohocrm/nodejs-sdk-2.0/core/com/zoho/crm/api/record/record_operations");

// Initialize the SDK
async function initializeSDK() {
    const user = new UserSignature("user@example.com");
    const environment = USDataCenter.PRODUCTION();
    const token = new OAuthBuilder()
        .clientId("your_client_id")
        .clientSecret("your_client_secret")
        .refreshToken("your_refresh_token")
        .redirectURL("your_redirect_url")
        .build();

    await new InitializeBuilder()
        .user(user)
        .environment(environment)
        .token(token)
        .initialize();
}

// Use the SDK
async function getRecords() {
    const recordOperations = new RecordOperations();
    const response = await recordOperations.getRecords("Leads");

    if (response != null) {
        console.log("Status Code: " + response.statusCode);
        const responseObject = response.object;
        // Process response...
    }
}

Architecture

The Zoho CRM SDK is built around several key architectural patterns:

  • Initialization Framework: Centralized SDK configuration through InitializeBuilder with support for multiple users, environments, and token stores
  • Operations Pattern: Each CRM module has a dedicated Operations class (e.g., RecordOperations, UsersOperations) serving as the primary interface
  • Data Center Abstraction: Support for multiple global data centers (US, EU, IN, AU, CN, JP) with environment-specific configurations
  • OAuth 2.0 Integration: Complete OAuth implementation with flexible token persistence (file, database, or custom)
  • Response Wrapper System: Standardized response handling with specific wrappers for different operation types
  • Multi-User Support: Dynamic user switching capabilities for multi-tenant applications

Capabilities

SDK Initialization

Core SDK initialization and configuration, including user authentication, environment setup, and multi-user support.

class InitializeBuilder {
    user(user: UserSignature): InitializeBuilder;
    environment(environment: Environment): InitializeBuilder;
    token(token: Token): InitializeBuilder;
    store(store: TokenStore): InitializeBuilder;
    SDKConfig(config: SDKConfig): InitializeBuilder;
    resourcePath(path: string): InitializeBuilder;
    logger(logger: Logger): InitializeBuilder;
    requestProxy(proxy: RequestProxy): InitializeBuilder;
    initialize(): Promise<void>;
    switchUser(): Promise<void>;
}

class UserSignature {
    constructor(email: string);
    getEmail(): string;
}

SDK Initialization

Authentication & Token Management

OAuth 2.0 authentication with support for various token storage methods and multi-user scenarios.

class OAuthBuilder {
    clientId(clientId: string): OAuthBuilder;
    clientSecret(clientSecret: string): OAuthBuilder;
    refreshToken(refreshToken: string): OAuthBuilder;
    grantToken(grantToken: string): OAuthBuilder;
    accessToken(accessToken: string): OAuthBuilder;
    redirectURL(redirectURL: string): OAuthBuilder;
    id(id: string): OAuthBuilder;
    build(): OAuthToken;
}

abstract class TokenStore {
    getToken(user: UserSignature, token: Token): Promise<Token>;
    saveToken(user: UserSignature, token: Token): Promise<void>;
    deleteToken(token: Token): Promise<void>;
    getTokens(): Promise<Token[]>;
    deleteTokens(): Promise<void>;
    getTokenById(id: string, token: Token): Promise<Token>;
}

Authentication

Records Management

Complete CRUD operations for CRM records including creation, retrieval, updating, deletion, and bulk operations.

class RecordOperations {
    getRecords(moduleAPIName: string, paramInstance?: ParameterMap, headerInstance?: HeaderMap): Promise<APIResponse>;
    createRecords(moduleAPIName: string, request: BodyWrapper): Promise<APIResponse>;
    updateRecords(moduleAPIName: string, request: BodyWrapper): Promise<APIResponse>;
    deleteRecords(moduleAPIName: string, paramInstance: ParameterMap): Promise<APIResponse>;
    upsertRecords(moduleAPIName: string, request: BodyWrapper): Promise<APIResponse>;
    getDeletedRecords(moduleAPIName: string, paramInstance?: ParameterMap, headerInstance?: HeaderMap): Promise<APIResponse>;
    searchRecords(moduleAPIName: string, paramInstance?: ParameterMap): Promise<APIResponse>;
    convertLead(leadId: BigInt, request: BodyWrapper): Promise<APIResponse>;
    getPhoto(moduleAPIName: string, recordId: BigInt): Promise<APIResponse>;
    uploadPhoto(moduleAPIName: string, recordId: BigInt, request: FileBodyWrapper): Promise<APIResponse>;
    deletePhoto(moduleAPIName: string, recordId: BigInt): Promise<APIResponse>;
    massUpdateRecords(moduleAPIName: string, request: BodyWrapper): Promise<APIResponse>;
    getMassUpdateStatus(moduleAPIName: string, paramInstance?: ParameterMap): Promise<APIResponse>;
    getRecordUsingExternalId(externalFieldValue: string, moduleAPIName: string, paramInstance?: ParameterMap, headerInstance?: HeaderMap): Promise<APIResponse>;
    updateRecordUsingExternalId(externalFieldValue: string, moduleAPIName: string, request: BodyWrapper, headerInstance?: HeaderMap): Promise<APIResponse>;
    deleteRecordUsingExternalId(externalFieldValue: string, moduleAPIName: string, paramInstance?: ParameterMap, headerInstance?: HeaderMap): Promise<APIResponse>;
    getRecord(moduleAPIName: string, recordId: BigInt, paramInstance?: ParameterMap, headerInstance?: HeaderMap): Promise<APIResponse>;
    updateRecord(moduleAPIName: string, recordId: BigInt, request: BodyWrapper): Promise<APIResponse>;
    deleteRecord(moduleAPIName: string, recordId: BigInt, paramInstance?: ParameterMap): Promise<APIResponse>;
}

Records Management

Notes Management

Note and comment management for CRM records.

class NotesOperations {
    getNotes(paramInstance?: ParameterMap, headerInstance?: HeaderMap): Promise<APIResponse>;
    createNotes(request: BodyWrapper): Promise<APIResponse>;
    updateNotes(request: BodyWrapper): Promise<APIResponse>;
    deleteNotes(paramInstance?: ParameterMap): Promise<APIResponse>;
    getNote(noteId: BigInt, paramInstance?: ParameterMap, headerInstance?: HeaderMap): Promise<APIResponse>;
    updateNote(noteId: BigInt, request: BodyWrapper): Promise<APIResponse>;
    deleteNote(noteId: BigInt): Promise<APIResponse>;
}

Note: Notes operations are documented within Records Management for comprehensive record-related functionality.

Users Management

User account management including user retrieval, creation, updates, and role assignments.

class UsersOperations {
    getUsers(paramInstance?: ParameterMap, headerInstance?: HeaderMap): Promise<APIResponse>;
    createUser(request: BodyWrapper): Promise<APIResponse>;
    updateUser(userId: string, request: BodyWrapper): Promise<APIResponse>;
    deleteUser(userId: string): Promise<APIResponse>;
    getUser(userId: string, paramInstance?: ParameterMap, headerInstance?: HeaderMap): Promise<APIResponse>;
}

class RolesOperations {
    getRoles(): Promise<APIResponse>;
    getRole(roleId: BigInt): Promise<APIResponse>;
}

class ProfilesOperations {
    constructor(ifModifiedSince?: Date);
    getProfiles(): Promise<APIResponse>;
    getProfile(profileId: BigInt): Promise<APIResponse>;
}

Users Management

Fields & Metadata

Field definitions, picklist values, and CRM metadata management.

class FieldsOperations {
    getFields(moduleAPIName: string): Promise<APIResponse>;
    getField(moduleAPIName: string, fieldId: string): Promise<APIResponse>;
}

class ModulesOperations {
    getModules(paramInstance?: ParameterMap, headerInstance?: HeaderMap): Promise<APIResponse>;
    getModule(moduleAPIName: string): Promise<APIResponse>;
    updateModuleByAPIName(moduleAPIName: string, request: BodyWrapper): Promise<APIResponse>;
    updateModuleById(moduleId: string, request: BodyWrapper): Promise<APIResponse>;
}

class LayoutsOperations {
    constructor(module?: string);
    getLayouts(): Promise<APIResponse>;
    getLayout(layoutId: BigInt): Promise<APIResponse>;
}

class CustomViewsOperations {
    constructor(module?: string);
    getCustomViews(paramInstance?: ParameterMap): Promise<APIResponse>;
    getCustomView(customViewId: BigInt, paramInstance?: ParameterMap): Promise<APIResponse>;
}

class BluePrintOperations {
    constructor(recordId: BigInt, moduleAPIName: string);
    getBlueprint(): Promise<APIResponse>;
    updateBlueprint(request: BodyWrapper): Promise<APIResponse>;
}

Fields & Metadata

Bulk Operations

High-volume data import and export operations for handling large datasets efficiently.

class BulkReadOperations {
    createBulkReadJob(request: RequestWrapper): Promise<APIResponse>;
    getBulkReadJobDetails(jobId: string): Promise<APIResponse>;
    downloadResult(jobId: string): Promise<APIResponse>;
}

class BulkWriteOperations {
    uploadFile(request: FileBodyWrapper): Promise<APIResponse>;
    createBulkWriteJob(request: RequestWrapper): Promise<APIResponse>;
    getBulkWriteJobDetails(jobId: string): Promise<APIResponse>;
    downloadBulkWriteResult(jobId: string): Promise<APIResponse>;
}

Bulk Operations

Related Records

Managing relationships between CRM records including related lists and record associations.

class RelatedRecordsOperations {
    getRelatedRecords(relatedListAPIName: string, recordId: BigInt, moduleAPIName: string, paramInstance?: ParameterMap, headerInstance?: HeaderMap): Promise<APIResponse>;
    updateRelatedRecords(relatedListAPIName: string, recordId: BigInt, moduleAPIName: string, request: BodyWrapper): Promise<APIResponse>;
    delinkRecords(relatedListAPIName: string, recordId: BigInt, moduleAPIName: string, paramInstance: ParameterMap): Promise<APIResponse>;
    getRelatedRecord(relatedListAPIName: string, recordId: BigInt, relatedRecordId: BigInt, moduleAPIName: string, paramInstance?: ParameterMap, headerInstance?: HeaderMap): Promise<APIResponse>;
    updateRelatedRecord(relatedListAPIName: string, recordId: BigInt, relatedRecordId: BigInt, moduleAPIName: string, request: BodyWrapper): Promise<APIResponse>;
    delinkRecord(relatedListAPIName: string, recordId: BigInt, relatedRecordId: BigInt, moduleAPIName: string): Promise<APIResponse>;
}

Related Records

Tags & Organization

Tag management, sharing controls, and organizational data access.

class TagsOperations {
    getTags(moduleAPIName?: string, paramInstance?: ParameterMap): Promise<APIResponse>;
    createTags(moduleAPIName: string, request: BodyWrapper): Promise<APIResponse>;
    updateTags(moduleAPIName: string, request: BodyWrapper): Promise<APIResponse>;
    updateTag(moduleAPIName: string, tagId: string, request: BodyWrapper): Promise<APIResponse>;
    deleteTag(tagId: string): Promise<APIResponse>;
    mergeTags(tagId: string, request: BodyWrapper): Promise<APIResponse>;
    addTagsToRecord(moduleAPIName: string, recordId: BigInt, request: BodyWrapper): Promise<APIResponse>;
    removeTagsFromRecord(moduleAPIName: string, recordId: BigInt, paramInstance: ParameterMap): Promise<APIResponse>;
    addTagsToMultipleRecords(moduleAPIName: string, request: BodyWrapper): Promise<APIResponse>;
    removeTagsFromMultipleRecords(moduleAPIName: string, request: BodyWrapper): Promise<APIResponse>;
    getRecordCountForTag(moduleAPIName: string, tagId: string): Promise<APIResponse>;
}

class ShareRecordsOperations {
    getSharedRecordDetails(moduleAPIName: string, recordId: BigInt): Promise<APIResponse>;
    shareRecord(moduleAPIName: string, recordId: BigInt, request: BodyWrapper): Promise<APIResponse>;
    updateSharePermissions(moduleAPIName: string, recordId: BigInt, request: BodyWrapper): Promise<APIResponse>;
    revokeSharedRecord(moduleAPIName: string, recordId: BigInt, request: BodyWrapper): Promise<APIResponse>;
}

Tags & Organization

Attachments & Files

File upload, download, and attachment management for CRM records.

class AttachmentsOperations {
    downloadAttachment(moduleAPIName: string, recordId: BigInt, attachmentId: BigInt): Promise<APIResponse>;
    deleteAttachment(moduleAPIName: string, recordId: BigInt, attachmentId: BigInt): Promise<APIResponse>;
    uploadAttachment(moduleAPIName: string, recordId: BigInt, request: FileBodyWrapper): Promise<APIResponse>;
    getAttachments(moduleAPIName: string, recordId: BigInt, paramInstance?: ParameterMap): Promise<APIResponse>;
}

class FileOperations {
    uploadFile(request: FileBodyWrapper): Promise<APIResponse>;
}

Attachments & Files

Organization Settings

Organization-level configuration including currency management, organization details, and custom variables.

class CurrenciesOperations {
    getCurrencies(): Promise<APIResponse>;
    addCurrencies(request: BodyWrapper): Promise<APIResponse>;
    updateCurrencies(request: BodyWrapper): Promise<APIResponse>;
    enableMultipleCurrencies(request: BodyWrapper): Promise<APIResponse>;
    updateBaseCurrency(request: BodyWrapper): Promise<APIResponse>;
    getCurrency(currencyId: BigInt): Promise<APIResponse>;
    updateCurrency(currencyId: BigInt, request: BodyWrapper): Promise<APIResponse>;
}

class OrgOperations {
    getOrganization(): Promise<APIResponse>;
    uploadOrganizationPhoto(request: FileBodyWrapper): Promise<APIResponse>;
}

class VariablesOperations {
    getVariables(): Promise<APIResponse>;
    createVariables(request: BodyWrapper): Promise<APIResponse>;
    updateVariables(request: BodyWrapper): Promise<APIResponse>;
    deleteVariables(request: BodyWrapper): Promise<APIResponse>;
    getVariableById(variableId: BigInt): Promise<APIResponse>;
    updateVariableById(variableId: BigInt, request: BodyWrapper): Promise<APIResponse>;
    deleteVariable(variableId: BigInt): Promise<APIResponse>;
    getVariableForAPIName(apiName: string): Promise<APIResponse>;
    updateVariableByAPIName(apiName: string, request: BodyWrapper): Promise<APIResponse>;
}

class VariableGroupsOperations {
    getVariableGroups(): Promise<APIResponse>;
    getVariableGroupById(groupId: BigInt): Promise<APIResponse>;
    getVariableGroupByAPIName(apiName: string): Promise<APIResponse>;
}

Organization Settings

Data Centers & Environments

class USDataCenter {
    static PRODUCTION(): Environment;
    static SANDBOX(): Environment;
    static DEVELOPER(): Environment;
}

class EUDataCenter {
    static PRODUCTION(): Environment;
    static SANDBOX(): Environment;
    static DEVELOPER(): Environment;
}

class INDataCenter {
    static PRODUCTION(): Environment;
    static SANDBOX(): Environment;
    static DEVELOPER(): Environment;
}

class AUDataCenter {
    static PRODUCTION(): Environment;
    static SANDBOX(): Environment;
    static DEVELOPER(): Environment;
}

class CNDataCenter {
    static PRODUCTION(): Environment;
    static SANDBOX(): Environment;
    static DEVELOPER(): Environment;
}

class JPDataCenter {
    static PRODUCTION(): Environment;
    static SANDBOX(): Environment;
    static DEVELOPER(): Environment;
}

Core Types

interface APIResponse {
    statusCode: number;
    object: any;
    headers: Map<string, string>;
}

class ParameterMap {
    add(param: Param, value: any): Promise<void>;
}

class HeaderMap {
    add(header: Header, value: any): Promise<void>;
}

class SDKConfig {
    autoRefreshFields: boolean;
    pickListValidation: boolean;
}

class SDKConfigBuilder {
    autoRefreshFields(autoRefreshFields: boolean): SDKConfigBuilder;
    pickListValidation(pickListValidation: boolean): SDKConfigBuilder;
    build(): SDKConfig;
}

class RequestProxy {
    host: string;
    port: number;
    user?: string;
    password?: string;
}

class ProxyBuilder {
    host(host: string): ProxyBuilder;
    port(port: number): ProxyBuilder;
    user(user: string): ProxyBuilder;
    password(password: string): ProxyBuilder;
    build(): RequestProxy;
}

docs

attachments-files.md

authentication.md

bulk-operations.md

fields-metadata.md

index.md

initialization.md

organization-settings.md

records.md

related-records.md

tags-organization.md

users.md

tile.json