@arathron/n8n-nodes-zoho-books
Version:
n8n community nodes for Zoho Books and Zoho Inventory API integration - Complete CRUD operations for Sales Orders, Invoices, Items, Vendors, Credit Notes, Payments, Purchase Orders, Bills, Composite Items, and Assemblies
119 lines • 4.29 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZohoBooksOAuth2 = void 0;
class ZohoBooksOAuth2 {
name = 'zohoBooksOAuth2';
extends = ['oAuth2Api'];
displayName = 'Zoho Books OAuth2 API';
documentationUrl = 'https://www.zoho.com/books/api/v3/oauth/#overview';
properties = [
{
displayName: 'Grant Type',
name: 'grantType',
type: 'hidden',
default: 'authorizationCode',
},
{
displayName: 'Data Center',
name: 'dataCenter',
type: 'options',
default: 'COM',
options: [
{
name: 'United States (COM)',
value: 'COM',
},
{
name: 'Europe (EU)',
value: 'EU',
},
{
name: 'India (IN)',
value: 'IN',
},
{
name: 'Australia (AU)',
value: 'AU',
},
{
name: 'China (CN)',
value: 'CN',
},
],
required: true,
description: 'The data center where your Zoho Books account is hosted',
},
{
displayName: 'Organization ID',
name: 'organizationId',
type: 'string',
default: '',
required: true,
description: 'Your Zoho Books Organization ID',
hint: 'Found in Zoho Books Settings > Organization Profile. Must be numeric (e.g., 123456789)',
placeholder: 'e.g., 123456789',
},
{
displayName: 'Authorization URL',
name: 'authUrl',
type: 'hidden',
default: '={{$self["dataCenter"] === "COM" ? "https://accounts.zoho.com/oauth/v2/auth" : "https://accounts.zoho." + $self["dataCenter"].toLowerCase() + "/oauth/v2/auth"}}',
required: true,
},
{
displayName: 'Access Token URL',
name: 'accessTokenUrl',
type: 'hidden',
default: '={{$self["dataCenter"] === "COM" ? "https://accounts.zoho.com/oauth/v2/token" : "https://accounts.zoho." + $self["dataCenter"].toLowerCase() + "/oauth/v2/token"}}',
required: true,
},
{
displayName: 'Scope',
name: 'scope',
type: 'hidden',
default: 'ZohoBooks.fullaccess.all',
description: 'The scope needed for Zoho Books operations',
},
{
displayName: 'Auth URI Query Parameters',
name: 'authQueryParameters',
type: 'hidden',
default: 'access_type=offline',
},
{
displayName: 'Authentication',
name: 'authentication',
type: 'hidden',
default: 'body',
},
];
authenticate = {
type: 'generic',
properties: {
headers: {
Authorization: '=Bearer {{$credentials.oauthTokenData.access_token}}',
},
},
};
test = {
request: {
baseURL: '={{$credentials.dataCenter === "COM" ? "https://www.zohoapis.com/books/v3" : $credentials.dataCenter === "AU" ? "https://www.zohoapis.com.au/books/v3" : $credentials.dataCenter === "CN" ? "https://www.zohoapis.com.cn/books/v3" : "https://www.zohoapis." + $credentials.dataCenter.toLowerCase() + "/books/v3"}}',
url: '/organizations',
headers: {
'X-com-zoho-books-organizationid': '={{$credentials.organizationId}}',
},
},
rules: [
{
type: 'responseSuccessBody',
properties: {
key: 'code',
value: 0,
message: 'Organization ID or data center may be incorrect. Please verify your Organization ID in Zoho Books Settings > Organization Profile and ensure the correct data center is selected.',
},
},
],
};
}
exports.ZohoBooksOAuth2 = ZohoBooksOAuth2;
//# sourceMappingURL=ZohoBooksOAuth2.credentials.js.map