Node.js SDK for Zoho CRM API v2.0 providing OAuth authentication, multi-user support, and complete CRUD operations for CRM data
The Users Management module provides comprehensive operations for managing CRM users, including user creation, updates, role assignments, and user data retrieval.
Primary interface for all user-related operations in Zoho CRM.
/**
* Main operations class for CRM user management
*/
class UsersOperations {
/**
* Retrieve multiple users from the organization
* @param paramInstance - Optional parameters for filtering users
* @param headerInstance - Optional headers for request customization
* @returns Promise with APIResponse containing user data
*/
getUsers(paramInstance?: ParameterMap, headerInstance?: HeaderMap): Promise<APIResponse>;
/**
* Create a new user in the organization
* @param request - Body wrapper containing user data to create
* @returns Promise with APIResponse containing creation results
*/
createUser(request: BodyWrapper): Promise<APIResponse>;
/**
* Update an existing user
* @param userId - Unique identifier of the user to update
* @param request - Body wrapper containing updated user data
* @returns Promise with APIResponse containing update results
*/
updateUser(userId: string, request: BodyWrapper): Promise<APIResponse>;
/**
* Delete a user from the organization
* @param userId - Unique identifier of the user to delete
* @returns Promise with APIResponse containing deletion results
*/
deleteUser(userId: string): Promise<APIResponse>;
/**
* Get a specific user by ID
* @param userId - Unique identifier of the user
* @param paramInstance - Optional parameters for field selection
* @param headerInstance - Optional headers for request customization
* @returns Promise with APIResponse containing user data
*/
getUser(userId: string, paramInstance?: ParameterMap, headerInstance?: HeaderMap): Promise<APIResponse>;
}User Operations Example:
const { UsersOperations } = require("@zohocrm/nodejs-sdk-2.0/core/com/zoho/crm/api/users/users_operations");
const { BodyWrapper } = require("@zohocrm/nodejs-sdk-2.0/core/com/zoho/crm/api/users/body_wrapper");
const { User } = require("@zohocrm/nodejs-sdk-2.0/core/com/zoho/crm/api/users/user");
// Get all users
const usersOperations = new UsersOperations();
const usersResponse = await usersOperations.getUsers();
// Get specific user
const userResponse = await usersOperations.getUser("123456789012345678");
// Create a new user
const newUser = new User();
newUser.setFirstName("Jane");
newUser.setLastName("Smith");
newUser.setEmail("jane.smith@company.com");
newUser.setRole("Sales Manager");
newUser.setProfile("Sales Profile");
const createWrapper = new BodyWrapper();
createWrapper.setUsers([newUser]);
const createResponse = await usersOperations.createUser(createWrapper);
// Update user
newUser.setId("123456789012345678");
newUser.setFirstName("Jane Updated");
const updateWrapper = new BodyWrapper();
updateWrapper.setUsers([newUser]);
const updateResponse = await usersOperations.updateUser("123456789012345678", updateWrapper);
// Delete user
const deleteResponse = await usersOperations.deleteUser("123456789012345678");Access role definitions and permission configurations for user management.
/**
* Operations for retrieving role information and permissions
*/
class RolesOperations {
/**
* Get all roles in the organization
* @returns Promise with APIResponse containing roles data
*/
getRoles(): Promise<APIResponse>;
/**
* Get details of a specific role
* @param roleId - Unique identifier of the role
* @returns Promise with APIResponse containing role details
*/
getRole(roleId: BigInt): Promise<APIResponse>;
}Roles Operations Example:
const { RolesOperations } = require("@zohocrm/nodejs-sdk-2.0/core/com/zoho/crm/api/roles/roles_operations");
const rolesOp = new RolesOperations();
// Get all roles
const rolesResponse = await rolesOp.getRoles();
// Get specific role details
const roleResponse = await rolesOp.getRole(123456789012345678n);Access profile configurations that define user permissions and access levels.
/**
* Operations for retrieving user profile configurations
*/
class ProfilesOperations {
/**
* Creates a ProfilesOperations instance with optional modification date filter
* @param ifModifiedSince - Optional date to filter profiles modified since
*/
constructor(ifModifiedSince?: Date);
/**
* Get all profiles in the organization
* @returns Promise with APIResponse containing profiles data
*/
getProfiles(): Promise<APIResponse>;
/**
* Get details of a specific profile
* @param profileId - Unique identifier of the profile
* @returns Promise with APIResponse containing profile details
*/
getProfile(profileId: BigInt): Promise<APIResponse>;
}Profiles Operations Example:
const { ProfilesOperations } = require("@zohocrm/nodejs-sdk-2.0/core/com/zoho/crm/api/profiles/profiles_operations");
const profilesOp = new ProfilesOperations();
// Get all profiles
const profilesResponse = await profilesOp.getProfiles();
// Get specific profile details
const profileResponse = await profilesOp.getProfile(123456789012345678n);The core user data structure representing CRM users.
/**
* Represents a CRM user with all user information and settings
*/
class User {
/** Create a new user instance */
constructor();
/** Get user ID */
getId(): string;
/** Set user ID */
setId(id: string): void;
/** Get user's first name */
getFirstName(): string;
/** Set user's first name */
setFirstName(firstName: string): void;
/** Get user's last name */
getLastName(): string;
/** Set user's last name */
setLastName(lastName: string): void;
/** Get user's full name */
getFullName(): string;
/** Set user's full name */
setFullName(fullName: string): void;
/** Get user's email address */
getEmail(): string;
/** Set user's email address */
setEmail(email: string): void;
/** Get user's phone number */
getPhone(): string;
/** Set user's phone number */
setPhone(phone: string): void;
/** Get user's mobile number */
getMobile(): string;
/** Set user's mobile number */
setMobile(mobile: string): void;
/** Get user's website */
getWebsite(): string;
/** Set user's website */
setWebsite(website: string): void;
/** Get user's language */
getLanguage(): string;
/** Set user's language */
setLanguage(language: string): void;
/** Get user's locale */
getLocale(): string;
/** Set user's locale */
setLocale(locale: string): void;
/** Get user's timezone */
getTimeZone(): string;
/** Set user's timezone */
setTimeZone(timeZone: string): void;
/** Get user's role */
getRole(): Role;
/** Set user's role */
setRole(role: Role): void;
/** Get user's profile */
getProfile(): Profile;
/** Set user's profile */
setProfile(profile: Profile): void;
/** Get user's manager */
getReportingTo(): User;
/** Set user's manager */
setReportingTo(reportingTo: User): void;
/** Get user's status (active/inactive) */
getStatus(): string;
/** Set user's status */
setStatus(status: string): void;
/** Get user's employee number */
getEmployee(): string;
/** Set user's employee number */
setEmployee(employee: string): void;
/** Get user creation time */
getCreatedTime(): Date;
/** Get user modification time */
getModifiedTime(): Date;
/** Get user who created this user */
getCreatedBy(): User;
/** Get user who last modified this user */
getModifiedBy(): User;
/** Check if user is online */
getOnline(): boolean;
/** Get user's territories */
getTerritories(): Territory[];
/** Set user's territories */
setTerritories(territories: Territory[]): void;
/** Get user's date format */
getDateFormat(): string;
/** Set user's date format */
setDateFormat(dateFormat: string): void;
/** Get user's time format */
getTimeFormat(): string;
/** Set user's time format */
setTimeFormat(timeFormat: string): void;
/** Get user's decimal separator */
getDecimalSeparator(): string;
/** Set user's decimal separator */
setDecimalSeparator(separator: string): void;
/** Get user's thousands separator */
getThousandSeparator(): string;
/** Set user's thousands separator */
setThousandSeparator(separator: string): void;
/** Get user's currency */
getCurrency(): Currency;
/** Set user's currency */
setCurrency(currency: Currency): void;
}Wrapper classes for handling user API requests and responses.
/**
* Wrapper for user request bodies
*/
class BodyWrapper {
/** Get user data */
getUsers(): User[];
/** Set user data */
setUsers(users: User[]): void;
}
/**
* Wrapper for user responses (GET operations)
*/
class ResponseWrapper {
/** Get user data from response */
getUsers(): User[];
/** Get pagination info */
getInfo(): Info;
}
/**
* Wrapper for user action responses (POST/PUT/DELETE operations)
*/
class ActionWrapper {
/** Get action results */
getUsers(): ActionResponse[];
}Parameters and headers for customizing user operations.
/**
* Parameters for getUsers operation
*/
class GetUsersParam {
static TYPE: Param; // User type filter (AllUsers, ActiveUsers, DeactiveUsers, ConfirmedUsers, NotConfirmedUsers)
static PAGE: Param; // Page number for pagination
static PER_PAGE: Param; // Number of users per page
}
/**
* Headers for getUsers operation
*/
class GetUsersHeader {
static IF_MODIFIED_SINCE: Header; // Get users modified since specified date
}
/**
* Parameters for getUser operation
*/
class GetUserParam {
static TYPE: Param; // User type filter
}
/**
* Headers for getUser operation
*/
class GetUserHeader {
static IF_MODIFIED_SINCE: Header; // Get user if modified since specified date
}Parameter Usage Example:
const { ParameterMap } = require("@zohocrm/nodejs-sdk-2.0/routes/parameter_map");
const { HeaderMap } = require("@zohocrm/nodejs-sdk-2.0/routes/header_map");
const { GetUsersParam, GetUsersHeader } = require("@zohocrm/nodejs-sdk-2.0/core/com/zoho/crm/api/users/users_operations");
// Setup parameters for getting active users
const paramMap = new ParameterMap();
await paramMap.add(GetUsersParam.TYPE, "ActiveUsers");
await paramMap.add(GetUsersParam.PAGE, 1);
await paramMap.add(GetUsersParam.PER_PAGE, 200);
// Setup headers
const headerMap = new HeaderMap();
await headerMap.add(GetUsersHeader.IF_MODIFIED_SINCE, new Date("2023-01-01T00:00:00Z"));
// Get users with filters
const response = await usersOperations.getUsers(paramMap, headerMap);Associated types for user roles and profiles.
/**
* Represents a user role in the CRM
*/
class Role {
/** Get role ID */
getId(): string;
/** Set role ID */
setId(id: string): void;
/** Get role name */
getName(): string;
/** Set role name */
setName(name: string): void;
/** Get role display label */
getDisplayLabel(): string;
/** Set role display label */
setDisplayLabel(displayLabel: string): void;
/** Get role forecast manager */
getForecastManager(): User;
/** Set role forecast manager */
setForecastManager(forecastManager: User): void;
/** Get role share with peers */
getShareWithPeers(): boolean;
/** Set role share with peers */
setShareWithPeers(shareWithPeers: boolean): void;
}
/**
* Represents a user profile in the CRM
*/
class Profile {
/** Get profile ID */
getId(): string;
/** Set profile ID */
setId(id: string): void;
/** Get profile name */
getName(): string;
/** Set profile name */
setName(name: string): void;
/** Get profile category */
getCategory(): string;
/** Set profile category */
setCategory(category: string): void;
/** Get profile description */
getDescription(): string;
/** Set profile description */
setDescription(description: string): void;
}
/**
* Represents a territory assignment
*/
class Territory {
/** Get territory ID */
getId(): string;
/** Set territory ID */
setId(id: string): void;
/** Get territory name */
getName(): string;
/** Set territory name */
setName(name: string): void;
/** Get territory manager */
getManager(): User;
/** Set territory manager */
setManager(manager: User): void;
}
/**
* Represents currency information
*/
class Currency {
/** Get currency ID */
getId(): string;
/** Set currency ID */
setId(id: string): void;
/** Get ISO code */
getIsoCode(): string;
/** Set ISO code */
setIsoCode(isoCode: string): void;
/** Get currency symbol */
getSymbol(): string;
/** Set currency symbol */
setSymbol(symbol: string): void;
/** Get creation time */
getCreatedTime(): Date;
/** Get modification time */
getModifiedTime(): Date;
/** Check if base currency */
getIsBase(): boolean;
/** Set base currency flag */
setIsBase(isBase: boolean): void;
/** Get exchange rate */
getExchangeRate(): number;
/** Set exchange rate */
setExchangeRate(exchangeRate: number): void;
}Common user status values and types.
/**
* User status constants
*/
class UserStatus {
static ACTIVE: string = "active";
static INACTIVE: string = "inactive";
static DELETED: string = "deleted";
}
/**
* User type constants for filtering
*/
class UserType {
static ALL_USERS: string = "AllUsers";
static ACTIVE_USERS: string = "ActiveUsers";
static DEACTIVE_USERS: string = "DeactiveUsers";
static CONFIRMED_USERS: string = "ConfirmedUsers";
static NOT_CONFIRMED_USERS: string = "NotConfirmedUsers";
}Install with Tessl CLI
npx tessl i tessl/npm-zohocrm--nodejs-sdk-2-0