@trg-admin/n8n-nodes-zoho-desk 0.1.20 → 0.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/nodes/ZohoDesk/ZohoDesk.node.js +244 -15
- package/package.json +1 -1
|
@@ -127,8 +127,8 @@ class ZohoDesk {
|
|
|
127
127
|
},
|
|
128
128
|
default: '',
|
|
129
129
|
required: true,
|
|
130
|
-
displayOptions: { show: { resource: ['ticket'], operation: ['create'
|
|
131
|
-
description: 'Department to assign
|
|
130
|
+
displayOptions: { show: { resource: ['ticket'], operation: ['create'] } },
|
|
131
|
+
description: 'Department to assign ticket to. Make sure Organization ID is filled in first.',
|
|
132
132
|
},
|
|
133
133
|
{
|
|
134
134
|
displayName: 'Description',
|
|
@@ -241,22 +241,162 @@ class ZohoDesk {
|
|
|
241
241
|
},
|
|
242
242
|
],
|
|
243
243
|
},
|
|
244
|
+
{
|
|
245
|
+
displayName: 'Return All',
|
|
246
|
+
name: 'returnAll',
|
|
247
|
+
type: 'boolean',
|
|
248
|
+
default: false,
|
|
249
|
+
displayOptions: { show: { resource: ['ticket'], operation: ['getAll'] } },
|
|
250
|
+
description: 'Whether to return all results or limit to specified number',
|
|
251
|
+
},
|
|
244
252
|
{
|
|
245
253
|
displayName: 'Limit',
|
|
246
254
|
name: 'limit',
|
|
247
255
|
type: 'number',
|
|
248
256
|
typeOptions: { minValue: 1, maxValue: 100 },
|
|
249
|
-
default:
|
|
250
|
-
displayOptions: {
|
|
251
|
-
|
|
257
|
+
default: 50,
|
|
258
|
+
displayOptions: {
|
|
259
|
+
show: {
|
|
260
|
+
resource: ['ticket'],
|
|
261
|
+
operation: ['getAll'],
|
|
262
|
+
returnAll: [false],
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
description: 'Max number of results to return (1-100)',
|
|
252
266
|
},
|
|
253
267
|
{
|
|
254
|
-
displayName: '
|
|
255
|
-
name: '
|
|
256
|
-
type: '
|
|
257
|
-
|
|
268
|
+
displayName: 'Options',
|
|
269
|
+
name: 'options',
|
|
270
|
+
type: 'collection',
|
|
271
|
+
placeholder: 'Add Option',
|
|
272
|
+
default: {},
|
|
258
273
|
displayOptions: { show: { resource: ['ticket'], operation: ['getAll'] } },
|
|
259
|
-
|
|
274
|
+
options: [
|
|
275
|
+
{
|
|
276
|
+
displayName: 'Assignee',
|
|
277
|
+
name: 'assignee',
|
|
278
|
+
type: 'string',
|
|
279
|
+
default: '',
|
|
280
|
+
placeholder: 'Unassigned or Agent ID',
|
|
281
|
+
description: 'ID of the assignee, or "Unassigned" for tickets not assigned to any agent. Multiple values can be separated with commas.',
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
displayName: 'Channel',
|
|
285
|
+
name: 'channel',
|
|
286
|
+
type: 'string',
|
|
287
|
+
default: '',
|
|
288
|
+
placeholder: 'Email, Phone, Web, Chat',
|
|
289
|
+
description: 'Channel through which the ticket was created. Multiple values can be separated with commas.',
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
displayName: 'Department',
|
|
293
|
+
name: 'departmentId',
|
|
294
|
+
type: 'options',
|
|
295
|
+
typeOptions: {
|
|
296
|
+
loadOptionsMethod: 'getDepartments',
|
|
297
|
+
loadOptionsDependsOn: ['organizationId'],
|
|
298
|
+
},
|
|
299
|
+
default: '',
|
|
300
|
+
description: 'Filter tickets by department. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
displayName: 'Department IDs',
|
|
304
|
+
name: 'departmentIds',
|
|
305
|
+
type: 'string',
|
|
306
|
+
default: '',
|
|
307
|
+
placeholder: '[BR_PHONE_LANDLINE_REDACTED]5,[BR_PHONE_LANDLINE_REDACTED]6',
|
|
308
|
+
description: 'Comma-separated department IDs to fetch tickets from (e.g. for "All Departments" view)',
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
displayName: 'Fields',
|
|
312
|
+
name: 'fields',
|
|
313
|
+
type: 'string',
|
|
314
|
+
default: '',
|
|
315
|
+
placeholder: 'statusType,webUrl,layoutId',
|
|
316
|
+
description: 'Comma-separated list of system and custom fields to include in the response (maximum 30 fields)',
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
displayName: 'From (Offset)',
|
|
320
|
+
name: 'from',
|
|
321
|
+
type: 'number',
|
|
322
|
+
typeOptions: { minValue: 0 },
|
|
323
|
+
default: 0,
|
|
324
|
+
description: 'Index number from which the tickets should be fetched. Only applied when Return All is disabled.',
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
displayName: 'Include',
|
|
328
|
+
name: 'include',
|
|
329
|
+
type: 'multiOptions',
|
|
330
|
+
default: [],
|
|
331
|
+
options: [
|
|
332
|
+
{ name: 'Assignee', value: 'assignee' },
|
|
333
|
+
{ name: 'Contacts', value: 'contacts' },
|
|
334
|
+
{ name: 'Departments', value: 'departments' },
|
|
335
|
+
{ name: 'Is Read', value: 'isRead' },
|
|
336
|
+
{ name: 'Products', value: 'products' },
|
|
337
|
+
{ name: 'Team', value: 'team' },
|
|
338
|
+
],
|
|
339
|
+
description: 'Additional related information to include in the response',
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
displayName: 'Priority',
|
|
343
|
+
name: 'priority',
|
|
344
|
+
type: 'string',
|
|
345
|
+
default: '',
|
|
346
|
+
placeholder: 'Low, Medium, High',
|
|
347
|
+
description: 'Priority of the ticket (e.g., Low, Medium, High). Multiple values can be separated with commas.',
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
displayName: 'Received in Days',
|
|
351
|
+
name: 'receivedInDays',
|
|
352
|
+
type: 'options',
|
|
353
|
+
default: 30,
|
|
354
|
+
options: [
|
|
355
|
+
{ name: '15 Days', value: 15 },
|
|
356
|
+
{ name: '30 Days', value: 30 },
|
|
357
|
+
{ name: '90 Days', value: 90 },
|
|
358
|
+
],
|
|
359
|
+
description: 'Time period (in days) for fetching tickets based on customerResponseTime',
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
displayName: 'Sort By',
|
|
363
|
+
name: 'sortBy',
|
|
364
|
+
type: 'options',
|
|
365
|
+
default: '-createdTime',
|
|
366
|
+
options: [
|
|
367
|
+
{ name: 'Created Time (Newest First)', value: '-createdTime' },
|
|
368
|
+
{ name: 'Created Time (Oldest First)', value: 'createdTime' },
|
|
369
|
+
{ name: 'Customer Response Time (Newest First)', value: '-customerResponseTime' },
|
|
370
|
+
{ name: 'Customer Response Time (Oldest First)', value: 'customerResponseTime' },
|
|
371
|
+
{ name: 'Response Due Date (Ascending)', value: 'responseDueDate' },
|
|
372
|
+
{ name: 'Response Due Date (Descending)', value: '-responseDueDate' },
|
|
373
|
+
],
|
|
374
|
+
description: 'Sort tickets by the specified attribute. Prefix with (-) for descending order.',
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
displayName: 'Status',
|
|
378
|
+
name: 'status',
|
|
379
|
+
type: 'string',
|
|
380
|
+
default: '',
|
|
381
|
+
placeholder: 'Open, On Hold, Escalated, Closed',
|
|
382
|
+
description: 'Status of the ticket (e.g., Open, On Hold, Escalated, Closed). Multiple values can be separated with commas.',
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
displayName: 'Team IDs',
|
|
386
|
+
name: 'teamIds',
|
|
387
|
+
type: 'string',
|
|
388
|
+
default: '',
|
|
389
|
+
placeholder: 'Unassigned or Team ID',
|
|
390
|
+
description: 'ID(s) of the team, or "Unassigned". Multiple values can be separated with commas.',
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
displayName: 'View ID',
|
|
394
|
+
name: 'viewId',
|
|
395
|
+
type: 'string',
|
|
396
|
+
default: '',
|
|
397
|
+
description: 'ID of the Zoho Desk view based on which tickets must be fetched',
|
|
398
|
+
},
|
|
399
|
+
],
|
|
260
400
|
},
|
|
261
401
|
// ================== Contact Resource Parameters ==================
|
|
262
402
|
{
|
|
@@ -620,19 +760,108 @@ class ZohoDesk {
|
|
|
620
760
|
}
|
|
621
761
|
if (operation === 'getAll') {
|
|
622
762
|
const returnAll = this.getNodeParameter('returnAll', i, false);
|
|
623
|
-
const
|
|
763
|
+
const options = this.getNodeParameter('options', i, {});
|
|
764
|
+
const qs = {};
|
|
765
|
+
const cleanCommaSeparated = (value) => {
|
|
766
|
+
if (typeof value !== 'string') {
|
|
767
|
+
return '';
|
|
768
|
+
}
|
|
769
|
+
return value
|
|
770
|
+
.split(',')
|
|
771
|
+
.map((s) => s.trim())
|
|
772
|
+
.filter(Boolean)
|
|
773
|
+
.join(',');
|
|
774
|
+
};
|
|
775
|
+
// Department filtering: options.departmentIds, options.departmentId, or legacy parameter
|
|
776
|
+
const topLevelDepartmentId = this.getNodeParameter('departmentId', i, '');
|
|
777
|
+
if (options.departmentIds) {
|
|
778
|
+
const cleaned = cleanCommaSeparated(options.departmentIds);
|
|
779
|
+
if (cleaned)
|
|
780
|
+
qs.departmentIds = cleaned;
|
|
781
|
+
}
|
|
782
|
+
else if (options.departmentId) {
|
|
783
|
+
const cleaned = String(options.departmentId).trim();
|
|
784
|
+
if (cleaned)
|
|
785
|
+
qs.departmentId = cleaned;
|
|
786
|
+
}
|
|
787
|
+
else if (topLevelDepartmentId) {
|
|
788
|
+
const cleaned = String(topLevelDepartmentId).trim();
|
|
789
|
+
if (cleaned)
|
|
790
|
+
qs.departmentId = cleaned;
|
|
791
|
+
}
|
|
792
|
+
if (options.viewId) {
|
|
793
|
+
const cleaned = String(options.viewId).trim();
|
|
794
|
+
if (cleaned)
|
|
795
|
+
qs.viewId = cleaned;
|
|
796
|
+
}
|
|
797
|
+
if (options.assignee) {
|
|
798
|
+
const cleaned = cleanCommaSeparated(options.assignee);
|
|
799
|
+
if (cleaned)
|
|
800
|
+
qs.assignee = cleaned;
|
|
801
|
+
}
|
|
802
|
+
if (options.teamIds) {
|
|
803
|
+
const cleaned = cleanCommaSeparated(options.teamIds);
|
|
804
|
+
if (cleaned)
|
|
805
|
+
qs.teamIds = cleaned;
|
|
806
|
+
}
|
|
807
|
+
if (options.channel) {
|
|
808
|
+
const cleaned = cleanCommaSeparated(options.channel);
|
|
809
|
+
if (cleaned)
|
|
810
|
+
qs.channel = cleaned;
|
|
811
|
+
}
|
|
812
|
+
if (options.status) {
|
|
813
|
+
const cleaned = cleanCommaSeparated(options.status);
|
|
814
|
+
if (cleaned)
|
|
815
|
+
qs.status = cleaned;
|
|
816
|
+
}
|
|
817
|
+
if (options.priority) {
|
|
818
|
+
const cleaned = cleanCommaSeparated(options.priority);
|
|
819
|
+
if (cleaned)
|
|
820
|
+
qs.priority = cleaned;
|
|
821
|
+
}
|
|
822
|
+
if (options.sortBy) {
|
|
823
|
+
const cleaned = String(options.sortBy).trim();
|
|
824
|
+
if (cleaned)
|
|
825
|
+
qs.sortBy = cleaned;
|
|
826
|
+
}
|
|
827
|
+
if (options.receivedInDays) {
|
|
828
|
+
qs.receivedInDays = options.receivedInDays;
|
|
829
|
+
}
|
|
830
|
+
if (options.fields) {
|
|
831
|
+
const cleaned = cleanCommaSeparated(options.fields);
|
|
832
|
+
if (cleaned)
|
|
833
|
+
qs.fields = cleaned;
|
|
834
|
+
}
|
|
835
|
+
if (options.include) {
|
|
836
|
+
if (Array.isArray(options.include)) {
|
|
837
|
+
if (options.include.length > 0) {
|
|
838
|
+
qs.include = options.include.map((s) => String(s).trim()).filter(Boolean).join(',');
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
else if (typeof options.include === 'string') {
|
|
842
|
+
const cleaned = cleanCommaSeparated(options.include);
|
|
843
|
+
if (cleaned)
|
|
844
|
+
qs.include = cleaned;
|
|
845
|
+
}
|
|
846
|
+
}
|
|
624
847
|
if (returnAll) {
|
|
625
|
-
const responseData = await GenericFunctions_1.zohoDeskApiRequestAllItems.call(this, 'GET', '/tickets', {},
|
|
848
|
+
const responseData = await GenericFunctions_1.zohoDeskApiRequestAllItems.call(this, 'GET', '/tickets', {}, qs, i);
|
|
626
849
|
for (const row of responseData) {
|
|
627
850
|
returnData.push({ json: row });
|
|
628
851
|
}
|
|
629
852
|
}
|
|
630
853
|
else {
|
|
631
|
-
const limit = this.getNodeParameter('limit', i);
|
|
632
|
-
|
|
854
|
+
const limit = this.getNodeParameter('limit', i, 50);
|
|
855
|
+
qs.limit = limit;
|
|
856
|
+
if (options.from !== undefined && options.from !== null && options.from !== '') {
|
|
857
|
+
qs.from = options.from;
|
|
858
|
+
}
|
|
859
|
+
const responseData = await GenericFunctions_1.zohoDeskApiRequest.call(this, 'GET', '/tickets', {}, qs, i);
|
|
633
860
|
const data = Array.isArray(responseData.data)
|
|
634
861
|
? responseData.data
|
|
635
|
-
:
|
|
862
|
+
: Array.isArray(responseData)
|
|
863
|
+
? responseData
|
|
864
|
+
: [responseData];
|
|
636
865
|
for (const row of data) {
|
|
637
866
|
returnData.push({ json: row });
|
|
638
867
|
}
|