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

zohordeu

v0.0.3

Published

Improved Zoho CRM API wrapper for Node.js, allowing for nested elements and with EU servers

Downloads

4

Readme

ZOHORDE

Node module to connect your application to zoho CRM API, specifically built for bulk operations.

Comment from @urgent: For alteration to original zohorde, see: https://github.com/urgent/zohordex/commit/e237211c28f2b1089399269c27376a946669216d#diff-ebdab6bf2779869f27eb6f4775a03bdd

Comment from me (@janek26): My fork uses the EU servers instead of the US ones, because the api keys generated with an EU account won't work on the US servers. I just changed every zoho.com to zoho.eu.

Initialization

var ZOHO_CRM_AUTH_KEY = '99e00de081d1cd9a38e467fee6ab684e'
var zohorde = require('zohorde')(ZOHO_CRM_AUTH_KEY)

Now you can call the APIs.

API

All APIs:

  • are asynchronous and using promise (specifically, Bluebird promise).
  • if contain the word "bulk", the request data will be split to chunks and submitted sequentially.
  • may return promise rejection.
    • For insert/update single record, rejects on failed insertion/update and network error.
    • For bulk operation, rejects on network error after several retries.

Disclaimer: following documentation contains copies from https://www.zoho.com/crm/help/api

insert

Response version 2 is used.

Typical usage:

var moduleName = 'Contact';
var params = {
  data: {
    'First Name': 'Joko',
    'Last Name': 'Susilo',
    Email: '[email protected]'
  }
};

zohorde.insert(moduleName, params);

Params:

  • parseResult: Boolean. In case of failed insertion, determine if you want to parse the response body. Defaults to true.
  • data: Object representing your record, with key = field name in zoho and value = desired value.
  • wfTrigger: Boolean, determining to trigger workflow after insertion or not.
  • duplicateCheck: Set value as "1" to check the duplicate records and throw an error response or "2" to check the duplicate records, if exists, update the same.
  • isApproval: By default, records are inserted directly . To keep the records in approval mode, set value as true. You can use this parameters for Leads, Contacts, and Cases module.
  • newFormat:
    • newFormat=1: To exclude fields with "null" values while inserting data from your CRM account.
    • newFormat=2: To include fields with "null" values while inserting data from your CRM account.

Returns:

  • On failed, return zoho's API response. If you set parseResult to false, the raw string will be returned. Otherwise, it will be parsed and returned as javascript object.
  • On success, return record detail from zoho (you can find it in respose.result.recorddetail) in javascript object.

Example:

{
  Id: '12312412312315',
  'Created Time': '2016-09-05 17:43:13',
  'Modified Time': '2016-09-05 17:43:13',
  'Created By': 'CS Account',
  'Modified By': 'CS Account'
}

insertBulk

Response version 4 is used.

Typical usage:

var moduleName = 'Contact';
var params = {
  data: [
    {
      'First Name': 'Joko',
      'Last Name': 'Susilo',
      Email: '[email protected]'
    },
    {
      'First Name': 'Suparman',
      'Last Name': 'Prasetya',
      Email: '[email protected]'
    }    
  ]
};

zohorde.insertBulk(moduleName, params);

Params:

  • data: Array of objects representing your record, with key = field name in zoho and value = desired value.
  • duplicateCheck: Set value as "1" to check the duplicate records and throw an error response or "2" to check the duplicate records, if exists, update the same.
  • isApproval: By default, records are inserted directly . To keep the records in approval mode, set value as true. You can use this parameters for Leads, Contacts, and Cases module.
  • newFormat:
    • newFormat=1: To exclude fields with "null" values while inserting data from your CRM account.
    • newFormat=2: To include fields with "null" values while inserting data from your CRM account.

Returns:

  • Array of objects, for each objects in your params.data, order preserved:
{
  data: { // null if insertion failed
    Id: <zoho record ID>,
    'Created Time': ...,
    'Modified Time': ...,
    'Created By': ...,
    'Modified By': ...
  }
  message: <zoho message> // null if record successfully inserted/no response from zoho
  code: <zoho status code> // null if no response from zoho
}

Example:

[
  {
    data: {
      Id: '12312412312315',
      'Created Time': '2016-09-05 17:43:13',
      'Modified Time': '2016-09-05 17:43:13',
      'Created By': 'CS Account',
      'Modified By': 'CS Account'
    },
    message: null,
    code: '2000'
  },
  {
    data: null,
    message: 'Duplicate record found!',
    code: '4012'
  }
]

Note:

  • Can insert arbitrarily many records, even though zoho limit us by 100 records per insertion. This library will split it to chunks of 100 records, and insert sequentially.
  • Can't use workflow when inserting multiple records.
  • May take a long time depending on how many records to insert.

update

Response version 2 is used.

Typical usage:

var moduleName = 'Contact';
var params = {
  id: '3124124131',
  data: {
    Email: '[email protected]',
    Phone: '08181818181'
  }
};

zohorde.update(moduleName, params);

Params:

  • parseResult: Boolean. In case of failed insertion, determine if you want to parse the response body. Defaults to true.
  • id: String representing zoho record id for the record to be updated.
  • data: Object representing your record, with key = field name in zoho and value = desired value.
  • wfTrigger: Boolean, determining to trigger workflow after insertion or not.
  • newFormat:
    • newFormat=1: To exclude fields with "null" values while inserting data from your CRM account.
    • newFormat=2: To include fields with "null" values while inserting data from your CRM account.

Returns:

  • On failed, return zoho's API response. If you set parseResult to false, the raw string will be returned. Otherwise, it will be parsed and returned as javascript object.
  • On success, return record detail from zoho (you can find it in respose.result.recorddetail) in javascript object.

Example:

{
  Id: '12312412312315',
  'Created Time': '2016-09-05 17:43:13',
  'Modified Time': '2016-09-05 17:43:13',
  'Created By': 'CS Account',
  'Modified By': 'CS Account'
}

updateBulk

Response version 4 is used.

Typical usage:

var moduleName = 'Contact';
var params = {
  data: [
    {
      Id: '12312412312315',
      Email: '[email protected]',
      Phone: '08181818181'
    },
    {
      Id: '12312412312318',
      'Postal Code': '11445'
    },
    {
      Id: '9999999999999',
      'Postal Code': 'zzz'
    }    
  ]
};

zohorde.updateBulk(moduleName, params);

Params:

  • data: Array of objects representing your record, with key = field name in zoho and value = desired value.
  • newFormat:
    • newFormat=1: To exclude fields with "null" values while inserting data from your CRM account.
    • newFormat=2: To include fields with "null" values while inserting data from your CRM account.

Returns:

  • Array of strings, representing zoho record ids for each rows successfully updated.

Example:

['12312412312315', '12312412312318']

Note:

  • Can update arbitrarily many records, even though zoho limit us by 100 records per update. This library will split it to chunks of 100 records, and update sequentially.
  • Can't use workflow when updating multiple records.
  • May take a long time depending on how many records to update.

getBulkById

Response version 2 is used.

Typical usage:

var moduleName = 'Contact';
var params = {
  data: ['12312412312315', '12312412312318', '129199191910']
};

zohorde.getBulkById(moduleName, params);

Params:

  • data: Array of strings representing zoho record ids to be fetched.
  • newFormat:
    • newFormat=1: To exclude fields with "null" values.
    • newFormat=2: To include fields with "null" values.

Returns:

  • Array of objects, representing zoho records you requested. If not found, will not present in the result.

Example:

[
  {
    CONTACT_ID: '12312412312315',
    'First Name': 'Joko',
    'Last Name': 'Susilo',
    'Email': ...,
    ...
  },
  {
    CONTACT_ID: '12312412312318',
    'First Name': 'Suparman',
    'Last Name': 'Prasetya',
    'Email': ...,
    ...
  }
]

Note:

  • Can get arbitrarily many records, even though zoho limit us by 100 records. This library will split it to chunks of 100 records, and fetch sequentially.
  • May take a long time depending on how many records to fetch.

getBulkUpdatedAfter

Response version 2 is used.

Typical usage:

var moduleName = 'Contact';
var params = {
  lastModifiedTime: '2016-10-15 17:10:21'
};

zohorde.getBulkUpdatedAfter(moduleName, params);

Params:

  • lastModifiedTime: String in format 'YYYY-MM-DD HH:mm:ss'
  • selectColumns: Array of strings representing the fields for "query projection"
  • limit: Additional param to stop fetching if the number of records fetched reached this limit. Limit is ignored as long as the record 'Modified Time' fetched is still the same as requested lastModifiedTime.
  • newFormat:
    • newFormat=1: To exclude fields with "null" values.
    • newFormat=2: To include fields with "null" values.

Returns:

  • Array of objects, representing zoho records you requested.

Example:

[
  {
    CONTACT_ID: '12312412312315',
    'First Name': 'Joko',
    'Last Name': 'Susilo',
    'Email': ...,
    ...
  },
  {
    CONTACT_ID: '12312412312318',
    'First Name': 'Suparman',
    'Last Name': 'Prasetya',
    'Email': ...,
    ...
  }
]

Note:

  • Can get arbitrarily many records, even though zoho limit us by 200 records. This library will split it to chunks and fetch sequentially.
  • May take a long time depending on how many records to fetch.

getByCriteria

Find up to 200 records based on criteria. If you need more, then we need to implement getBulkByCriteria.

Typical usage:

var moduleName = 'Contact';
var params = {
  criteria: '((Email:[email protected]) OR (Email:[email protected]))'
}

zohorde.getByCriteria(moduleName, params);

Params:

  • lastModifiedTime: String in format 'YYYY-MM-DD HH:mm:ss'
  • criteria: String representing the criteria, consult zoho API documentation for the format
  • newFormat:
    • newFormat=1: To exclude fields with "null" values.
    • newFormat=2: To include fields with "null" values.

Returns:

  • Array of objects representing zoho record you requested.
  • Empty array, of course, if no record match your request.

Example:

[
  {
    CONTACT_ID: '12312412312315',
    'First Name': 'Joko',
    'Last Name': 'Susilo',
    'Email': '[email protected]',
    ...
  },
  {
    CONTACT_ID: '12312412312317',
    'First Name': 'Suparman',
    'Last Name': 'Prasetya',
    'Email': '[email protected]',
    ...
  }
]

getBulkByValueIn

An extension from getByCriteria, specifically used for fetching some records with value in given list.

Typical usage:

var moduleName = 'Contact';
var params = {
  key: 'Email',
  valueIn: ['[email protected]', '[email protected]']
};

zohorde.getBulkByValueIn(moduleName, params);

Params:

  • lastModifiedTime: String in format 'YYYY-MM-DD HH:mm:ss'
  • key: String for the field name to be used in matching
  • valueIn: Array of strings for the allowed value
  • newFormat:
    • newFormat=1: To exclude fields with "null" values.
    • newFormat=2: To include fields with "null" values.

Returns:

  • Array of objects, representing zoho records you requested.

Example:

[
  {
    CONTACT_ID: '12312412312315',
    'First Name': 'Joko',
    'Last Name': 'Susilo',
    'Email': ...,
    ...
  },
  {
    CONTACT_ID: '12312412312318',
    'First Name': 'Suparman',
    'Last Name': 'Prasetya',
    'Email': ...,
    ...
  }
]

Note:

  • Can get arbitrarily many records, even though zoho limit us by some records. This library will split it to chunks and fetch sequentially.
  • This works by converting the "$in" query to chain of "$or". It is limited to 5 "$or" clause per request
  • May take a long time depending on how many records to fetch.