@trg-admin/n8n-nodes-zoho-desk 0.1.20 → 0.1.21
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 +210 -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,74 @@ 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
|
+
// Department filtering: options.departmentIds, options.departmentId, or legacy parameter
|
|
766
|
+
const topLevelDepartmentId = this.getNodeParameter('departmentId', i, '');
|
|
767
|
+
if (options.departmentIds) {
|
|
768
|
+
qs.departmentIds = options.departmentIds;
|
|
769
|
+
}
|
|
770
|
+
else if (options.departmentId) {
|
|
771
|
+
qs.departmentId = options.departmentId;
|
|
772
|
+
}
|
|
773
|
+
else if (topLevelDepartmentId) {
|
|
774
|
+
qs.departmentId = topLevelDepartmentId;
|
|
775
|
+
}
|
|
776
|
+
if (options.viewId) {
|
|
777
|
+
qs.viewId = options.viewId;
|
|
778
|
+
}
|
|
779
|
+
if (options.assignee) {
|
|
780
|
+
qs.assignee = options.assignee;
|
|
781
|
+
}
|
|
782
|
+
if (options.teamIds) {
|
|
783
|
+
qs.teamIds = options.teamIds;
|
|
784
|
+
}
|
|
785
|
+
if (options.channel) {
|
|
786
|
+
qs.channel = options.channel;
|
|
787
|
+
}
|
|
788
|
+
if (options.status) {
|
|
789
|
+
qs.status = options.status;
|
|
790
|
+
}
|
|
791
|
+
if (options.priority) {
|
|
792
|
+
qs.priority = options.priority;
|
|
793
|
+
}
|
|
794
|
+
if (options.sortBy) {
|
|
795
|
+
qs.sortBy = options.sortBy;
|
|
796
|
+
}
|
|
797
|
+
if (options.receivedInDays) {
|
|
798
|
+
qs.receivedInDays = options.receivedInDays;
|
|
799
|
+
}
|
|
800
|
+
if (options.fields) {
|
|
801
|
+
qs.fields = options.fields;
|
|
802
|
+
}
|
|
803
|
+
if (options.include) {
|
|
804
|
+
if (Array.isArray(options.include)) {
|
|
805
|
+
if (options.include.length > 0) {
|
|
806
|
+
qs.include = options.include.join(',');
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
else if (typeof options.include === 'string' && options.include.trim()) {
|
|
810
|
+
qs.include = options.include.trim();
|
|
811
|
+
}
|
|
812
|
+
}
|
|
624
813
|
if (returnAll) {
|
|
625
|
-
const responseData = await GenericFunctions_1.zohoDeskApiRequestAllItems.call(this, 'GET', '/tickets', {},
|
|
814
|
+
const responseData = await GenericFunctions_1.zohoDeskApiRequestAllItems.call(this, 'GET', '/tickets', {}, qs, i);
|
|
626
815
|
for (const row of responseData) {
|
|
627
816
|
returnData.push({ json: row });
|
|
628
817
|
}
|
|
629
818
|
}
|
|
630
819
|
else {
|
|
631
|
-
const limit = this.getNodeParameter('limit', i);
|
|
632
|
-
|
|
820
|
+
const limit = this.getNodeParameter('limit', i, 50);
|
|
821
|
+
qs.limit = limit;
|
|
822
|
+
if (options.from !== undefined && options.from !== null && options.from !== '') {
|
|
823
|
+
qs.from = options.from;
|
|
824
|
+
}
|
|
825
|
+
const responseData = await GenericFunctions_1.zohoDeskApiRequest.call(this, 'GET', '/tickets', {}, qs, i);
|
|
633
826
|
const data = Array.isArray(responseData.data)
|
|
634
827
|
? responseData.data
|
|
635
|
-
:
|
|
828
|
+
: Array.isArray(responseData)
|
|
829
|
+
? responseData
|
|
830
|
+
: [responseData];
|
|
636
831
|
for (const row of data) {
|
|
637
832
|
returnData.push({ json: row });
|
|
638
833
|
}
|