mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
n8n-3867-progressively-apply-prettier-to-all (#3873)
* 🔨 formatting nodes with prettier
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const conditionFields: INodeProperties[] = [
|
||||
{
|
||||
@@ -22,9 +20,7 @@ export const conditionFields: INodeProperties[] = [
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
'resource': [
|
||||
'ticket',
|
||||
],
|
||||
resource: ['ticket'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -100,9 +96,7 @@ export const conditionFields: INodeProperties[] = [
|
||||
],
|
||||
displayOptions: {
|
||||
hide: {
|
||||
field: [
|
||||
'assignee',
|
||||
],
|
||||
field: ['assignee'],
|
||||
},
|
||||
},
|
||||
default: 'is',
|
||||
@@ -148,9 +142,7 @@ export const conditionFields: INodeProperties[] = [
|
||||
],
|
||||
displayOptions: {
|
||||
show: {
|
||||
field: [
|
||||
'assignee',
|
||||
],
|
||||
field: ['assignee'],
|
||||
},
|
||||
},
|
||||
default: 'is',
|
||||
@@ -161,21 +153,11 @@ export const conditionFields: INodeProperties[] = [
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
field: [
|
||||
'status',
|
||||
],
|
||||
field: ['status'],
|
||||
},
|
||||
hide: {
|
||||
operation:[
|
||||
'changed',
|
||||
'not_changed',
|
||||
],
|
||||
field: [
|
||||
'assignee',
|
||||
'group',
|
||||
'priority',
|
||||
'type',
|
||||
],
|
||||
operation: ['changed', 'not_changed'],
|
||||
field: ['assignee', 'group', 'priority', 'type'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -208,21 +190,11 @@ export const conditionFields: INodeProperties[] = [
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
field: [
|
||||
'type',
|
||||
],
|
||||
field: ['type'],
|
||||
},
|
||||
hide: {
|
||||
operation:[
|
||||
'changed',
|
||||
'not_changed',
|
||||
],
|
||||
field: [
|
||||
'assignee',
|
||||
'group',
|
||||
'priority',
|
||||
'status',
|
||||
],
|
||||
operation: ['changed', 'not_changed'],
|
||||
field: ['assignee', 'group', 'priority', 'status'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -251,21 +223,11 @@ export const conditionFields: INodeProperties[] = [
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
field: [
|
||||
'priority',
|
||||
],
|
||||
field: ['priority'],
|
||||
},
|
||||
hide: {
|
||||
operation:[
|
||||
'changed',
|
||||
'not_changed',
|
||||
],
|
||||
field: [
|
||||
'assignee',
|
||||
'group',
|
||||
'type',
|
||||
'status',
|
||||
],
|
||||
operation: ['changed', 'not_changed'],
|
||||
field: ['assignee', 'group', 'type', 'status'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -293,23 +255,17 @@ export const conditionFields: INodeProperties[] = [
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
type: 'options',
|
||||
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getGroups',
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
field: [
|
||||
'group',
|
||||
],
|
||||
field: ['group'],
|
||||
},
|
||||
hide: {
|
||||
field: [
|
||||
'assignee',
|
||||
'priority',
|
||||
'type',
|
||||
'status',
|
||||
],
|
||||
field: ['assignee', 'priority', 'type', 'status'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -319,23 +275,17 @@ export const conditionFields: INodeProperties[] = [
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
type: 'options',
|
||||
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getUsers',
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
field: [
|
||||
'assignee',
|
||||
],
|
||||
field: ['assignee'],
|
||||
},
|
||||
hide: {
|
||||
field: [
|
||||
'group',
|
||||
'priority',
|
||||
'type',
|
||||
'status',
|
||||
],
|
||||
field: ['group', 'priority', 'type', 'status'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
OptionsWithUri,
|
||||
} from 'request';
|
||||
import { OptionsWithUri } from 'request';
|
||||
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
@@ -9,21 +7,27 @@ import {
|
||||
ILoadOptionsFunctions,
|
||||
} from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
JsonObject,
|
||||
NodeApiError,
|
||||
} from 'n8n-workflow';
|
||||
import { IDataObject, JsonObject, NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function zendeskApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
export async function zendeskApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
resource: string,
|
||||
// tslint:disable-next-line:no-any
|
||||
body: any = {},
|
||||
qs: IDataObject = {},
|
||||
uri?: string,
|
||||
option: IDataObject = {},
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
const authenticationMethod = this.getNodeParameter('authentication', 0);
|
||||
|
||||
let credentials;
|
||||
|
||||
if (authenticationMethod === 'apiToken') {
|
||||
credentials = await this.getCredentials('zendeskApi') as { subdomain: string };
|
||||
credentials = (await this.getCredentials('zendeskApi')) as { subdomain: string };
|
||||
} else {
|
||||
credentials = await this.getCredentials('zendeskOAuth2Api') as { subdomain: string };
|
||||
credentials = (await this.getCredentials('zendeskOAuth2Api')) as { subdomain: string };
|
||||
}
|
||||
|
||||
let options: OptionsWithUri = {
|
||||
@@ -46,7 +50,7 @@ export async function zendeskApiRequest(this: IHookFunctions | IExecuteFunctions
|
||||
|
||||
try {
|
||||
return await this.helpers.requestWithAuthentication.call(this, credentialType, options);
|
||||
} catch(error) {
|
||||
} catch (error) {
|
||||
throw new NodeApiError(this.getNode(), error as JsonObject);
|
||||
}
|
||||
}
|
||||
@@ -55,8 +59,16 @@ export async function zendeskApiRequest(this: IHookFunctions | IExecuteFunctions
|
||||
* Make an API request to paginated flow endpoint
|
||||
* and return all results
|
||||
*/
|
||||
export async function zendeskApiRequestAllItems(this: IHookFunctions | IExecuteFunctions| ILoadOptionsFunctions, propertyName: string, method: string, resource: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
|
||||
export async function zendeskApiRequestAllItems(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
propertyName: string,
|
||||
method: string,
|
||||
resource: string,
|
||||
// tslint:disable-next-line:no-any
|
||||
body: any = {},
|
||||
query: IDataObject = {},
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
const returnData: IDataObject[] = [];
|
||||
|
||||
let responseData;
|
||||
@@ -70,15 +82,13 @@ export async function zendeskApiRequestAllItems(this: IHookFunctions | IExecuteF
|
||||
if (query.limit && query.limit <= returnData.length) {
|
||||
return returnData;
|
||||
}
|
||||
} while (
|
||||
responseData.next_page !== undefined &&
|
||||
responseData.next_page !== null
|
||||
);
|
||||
} while (responseData.next_page !== undefined && responseData.next_page !== null);
|
||||
|
||||
return returnData;
|
||||
}
|
||||
|
||||
export function validateJSON(json: string | undefined): any { // tslint:disable-line:no-any
|
||||
// tslint:disable-next-line:no-any
|
||||
export function validateJSON(json: string | undefined): any {
|
||||
let result;
|
||||
try {
|
||||
result = JSON.parse(json!);
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const organizationOperations: INodeProperties[] = [
|
||||
{
|
||||
@@ -10,9 +8,7 @@ export const organizationOperations: INodeProperties[] = [
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'organization',
|
||||
],
|
||||
resource: ['organization'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -64,10 +60,9 @@ export const organizationOperations: INodeProperties[] = [
|
||||
];
|
||||
|
||||
export const organizationFields: INodeProperties[] = [
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* organization:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* organization:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Name',
|
||||
name: 'name',
|
||||
@@ -75,12 +70,8 @@ export const organizationFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'organization',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['organization'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
@@ -93,12 +84,8 @@ export const organizationFields: INodeProperties[] = [
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'organization',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['organization'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -126,7 +113,7 @@ export const organizationFields: INodeProperties[] = [
|
||||
displayName: 'Organization Fields',
|
||||
name: 'organizationFieldsUi',
|
||||
placeholder: 'Add Organization Field',
|
||||
description: 'Values of custom fields in the organization\'s profile',
|
||||
description: "Values of custom fields in the organization's profile",
|
||||
type: 'fixedCollection',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
@@ -141,7 +128,8 @@ export const organizationFields: INodeProperties[] = [
|
||||
displayName: 'Field Name or ID',
|
||||
name: 'field',
|
||||
type: 'options',
|
||||
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getOrganizationFields',
|
||||
},
|
||||
@@ -165,13 +153,14 @@ export const organizationFields: INodeProperties[] = [
|
||||
loadOptionsMethod: 'getTags',
|
||||
},
|
||||
default: [],
|
||||
description: 'IDs of tags applied to this organization. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'IDs of tags applied to this organization. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* organization:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* organization:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Organization ID',
|
||||
name: 'id',
|
||||
@@ -180,12 +169,8 @@ export const organizationFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'organization',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: ['organization'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -197,12 +182,8 @@ export const organizationFields: INodeProperties[] = [
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'organization',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: ['organization'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -236,7 +217,7 @@ export const organizationFields: INodeProperties[] = [
|
||||
displayName: 'Organization Fields',
|
||||
name: 'organizationFieldsUi',
|
||||
placeholder: 'Add Organization Field',
|
||||
description: 'Values of custom fields in the organization\'s profile',
|
||||
description: "Values of custom fields in the organization's profile",
|
||||
type: 'fixedCollection',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
@@ -251,7 +232,8 @@ export const organizationFields: INodeProperties[] = [
|
||||
displayName: 'Field Name or ID',
|
||||
name: 'field',
|
||||
type: 'options',
|
||||
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getOrganizationFields',
|
||||
},
|
||||
@@ -275,13 +257,14 @@ export const organizationFields: INodeProperties[] = [
|
||||
loadOptionsMethod: 'getTags',
|
||||
},
|
||||
default: [],
|
||||
description: 'IDs of tags applied to this organization. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'IDs of tags applied to this organization. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* organization:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* organization:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Organization ID',
|
||||
name: 'id',
|
||||
@@ -290,30 +273,22 @@ export const organizationFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'organization',
|
||||
],
|
||||
operation: [
|
||||
'get',
|
||||
],
|
||||
resource: ['organization'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* organization:getAll */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* organization:getAll */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'organization',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: ['organization'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
@@ -325,15 +300,9 @@ export const organizationFields: INodeProperties[] = [
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'organization',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
resource: ['organization'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
@@ -343,9 +312,9 @@ export const organizationFields: INodeProperties[] = [
|
||||
default: 100,
|
||||
description: 'Max number of results to return',
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* organization:delete */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* organization:delete */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Organization ID',
|
||||
name: 'id',
|
||||
@@ -354,18 +323,14 @@ export const organizationFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'organization',
|
||||
],
|
||||
operation: [
|
||||
'delete',
|
||||
],
|
||||
resource: ['organization'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* organization:getRelatedData */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* organization:getRelatedData */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Organization ID',
|
||||
name: 'id',
|
||||
@@ -374,12 +339,8 @@ export const organizationFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'organization',
|
||||
],
|
||||
operation: [
|
||||
'getRelatedData',
|
||||
],
|
||||
resource: ['organization'],
|
||||
operation: ['getRelatedData'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const ticketOperations: INodeProperties[] = [
|
||||
{
|
||||
@@ -10,9 +8,7 @@ export const ticketOperations: INodeProperties[] = [
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
resource: ['ticket'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -58,7 +54,6 @@ export const ticketOperations: INodeProperties[] = [
|
||||
];
|
||||
|
||||
export const ticketFields: INodeProperties[] = [
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* ticket:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
@@ -72,12 +67,8 @@ export const ticketFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['ticket'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
@@ -90,12 +81,8 @@ export const ticketFields: INodeProperties[] = [
|
||||
default: false,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['ticket'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -107,15 +94,9 @@ export const ticketFields: INodeProperties[] = [
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
jsonParameters: [
|
||||
false,
|
||||
],
|
||||
resource: ['ticket'],
|
||||
operation: ['create'],
|
||||
jsonParameters: [false],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -141,7 +122,8 @@ export const ticketFields: INodeProperties[] = [
|
||||
loadOptionsMethod: 'getCustomFields',
|
||||
},
|
||||
default: '',
|
||||
description: 'Custom field ID. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'Custom field ID. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
@@ -169,7 +151,8 @@ export const ticketFields: INodeProperties[] = [
|
||||
loadOptionsMethod: 'getGroups',
|
||||
},
|
||||
default: '',
|
||||
description: 'The group this ticket is assigned to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The group this ticket is assigned to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Recipient',
|
||||
@@ -226,7 +209,8 @@ export const ticketFields: INodeProperties[] = [
|
||||
loadOptionsMethod: 'getTags',
|
||||
},
|
||||
default: [],
|
||||
description: 'The array of tags applied to this ticket. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The array of tags applied to this ticket. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Type',
|
||||
@@ -265,18 +249,13 @@ export const ticketFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
jsonParameters: [
|
||||
true,
|
||||
],
|
||||
resource: ['ticket'],
|
||||
operation: ['create'],
|
||||
jsonParameters: [true],
|
||||
},
|
||||
},
|
||||
description: 'Object of values to set as described <a href="https://developer.zendesk.com/rest_api/docs/support/tickets">here</a>',
|
||||
description:
|
||||
'Object of values to set as described <a href="https://developer.zendesk.com/rest_api/docs/support/tickets">here</a>',
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
@@ -290,12 +269,8 @@ export const ticketFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: ['ticket'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -306,12 +281,8 @@ export const ticketFields: INodeProperties[] = [
|
||||
default: false,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: ['ticket'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -323,15 +294,9 @@ export const ticketFields: INodeProperties[] = [
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
jsonParameters: [
|
||||
false,
|
||||
],
|
||||
resource: ['ticket'],
|
||||
operation: ['update'],
|
||||
jsonParameters: [false],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -364,7 +329,8 @@ export const ticketFields: INodeProperties[] = [
|
||||
loadOptionsMethod: 'getCustomFields',
|
||||
},
|
||||
default: '',
|
||||
description: 'Custom field ID. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'Custom field ID. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
@@ -392,7 +358,8 @@ export const ticketFields: INodeProperties[] = [
|
||||
loadOptionsMethod: 'getGroups',
|
||||
},
|
||||
default: '',
|
||||
description: 'The group this ticket is assigned to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The group this ticket is assigned to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Internal Note',
|
||||
@@ -463,7 +430,8 @@ export const ticketFields: INodeProperties[] = [
|
||||
loadOptionsMethod: 'getTags',
|
||||
},
|
||||
default: [],
|
||||
description: 'The array of tags applied to this ticket. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The array of tags applied to this ticket. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Type',
|
||||
@@ -502,18 +470,13 @@ export const ticketFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
jsonParameters: [
|
||||
true,
|
||||
],
|
||||
resource: ['ticket'],
|
||||
operation: ['update'],
|
||||
jsonParameters: [true],
|
||||
},
|
||||
},
|
||||
description: 'Object of values to update as described <a href="https://developer.zendesk.com/rest_api/docs/support/tickets">here</a>',
|
||||
description:
|
||||
'Object of values to update as described <a href="https://developer.zendesk.com/rest_api/docs/support/tickets">here</a>',
|
||||
},
|
||||
{
|
||||
displayName: 'Ticket Type',
|
||||
@@ -533,14 +496,8 @@ export const ticketFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
operation: [
|
||||
'get',
|
||||
'delete',
|
||||
'getAll',
|
||||
],
|
||||
resource: ['ticket'],
|
||||
operation: ['get', 'delete', 'getAll'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -555,15 +512,9 @@ export const ticketFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
operation: [
|
||||
'get',
|
||||
],
|
||||
ticketType: [
|
||||
'regular',
|
||||
],
|
||||
resource: ['ticket'],
|
||||
operation: ['get'],
|
||||
ticketType: ['regular'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -575,15 +526,9 @@ export const ticketFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
operation: [
|
||||
'get',
|
||||
],
|
||||
ticketType: [
|
||||
'suspended',
|
||||
],
|
||||
resource: ['ticket'],
|
||||
operation: ['get'],
|
||||
ticketType: ['suspended'],
|
||||
},
|
||||
},
|
||||
description: 'Ticket ID',
|
||||
@@ -597,12 +542,8 @@ export const ticketFields: INodeProperties[] = [
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: ['ticket'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
@@ -614,15 +555,9 @@ export const ticketFields: INodeProperties[] = [
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
resource: ['ticket'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
@@ -640,12 +575,8 @@ export const ticketFields: INodeProperties[] = [
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: ['ticket'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -658,13 +589,12 @@ export const ticketFields: INodeProperties[] = [
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
'/ticketType': [
|
||||
'regular',
|
||||
],
|
||||
'/ticketType': ['regular'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'The group to search. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The group to search. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Query',
|
||||
@@ -672,13 +602,12 @@ export const ticketFields: INodeProperties[] = [
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
'/ticketType': [
|
||||
'regular',
|
||||
],
|
||||
'/ticketType': ['regular'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: '<a href="https://developer.zendesk.com/api-reference/ticketing/ticket-management/search/#syntax-examples">Query syntax</a> to search tickets',
|
||||
description:
|
||||
'<a href="https://developer.zendesk.com/api-reference/ticketing/ticket-management/search/#syntax-examples">Query syntax</a> to search tickets',
|
||||
},
|
||||
{
|
||||
displayName: 'Sort By',
|
||||
@@ -731,9 +660,7 @@ export const ticketFields: INodeProperties[] = [
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
'/ticketType': [
|
||||
'regular',
|
||||
],
|
||||
'/ticketType': ['regular'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -779,15 +706,9 @@ export const ticketFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
operation: [
|
||||
'delete',
|
||||
],
|
||||
ticketType: [
|
||||
'regular',
|
||||
],
|
||||
resource: ['ticket'],
|
||||
operation: ['delete'],
|
||||
ticketType: ['regular'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -799,15 +720,9 @@ export const ticketFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
operation: [
|
||||
'delete',
|
||||
],
|
||||
ticketType: [
|
||||
'suspended',
|
||||
],
|
||||
resource: ['ticket'],
|
||||
operation: ['delete'],
|
||||
ticketType: ['suspended'],
|
||||
},
|
||||
},
|
||||
description: 'Ticket ID',
|
||||
@@ -823,12 +738,8 @@ export const ticketFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
operation: [
|
||||
'recover',
|
||||
],
|
||||
resource: ['ticket'],
|
||||
operation: ['recover'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const ticketFieldOperations: INodeProperties[] = [
|
||||
{
|
||||
@@ -10,9 +8,7 @@ export const ticketFieldOperations: INodeProperties[] = [
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticketField',
|
||||
],
|
||||
resource: ['ticketField'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -34,10 +30,9 @@ export const ticketFieldOperations: INodeProperties[] = [
|
||||
];
|
||||
|
||||
export const ticketFieldFields: INodeProperties[] = [
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* ticketField:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* ticketField:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Ticket Field ID',
|
||||
name: 'ticketFieldId',
|
||||
@@ -46,31 +41,23 @@ export const ticketFieldFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticketField',
|
||||
],
|
||||
operation: [
|
||||
'get',
|
||||
],
|
||||
resource: ['ticketField'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* ticketField:getAll */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* ticketField:getAll */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticketField',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: ['ticketField'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
@@ -82,15 +69,9 @@ export const ticketFieldFields: INodeProperties[] = [
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticketField',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
resource: ['ticketField'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import {
|
||||
IDataObject,
|
||||
} from 'n8n-workflow';
|
||||
import { IDataObject } from 'n8n-workflow';
|
||||
|
||||
export interface IComment {
|
||||
export interface IComment {
|
||||
body?: string;
|
||||
html_body?: string;
|
||||
public?: boolean;
|
||||
|
||||
@@ -1,72 +1,70 @@
|
||||
import {
|
||||
INodePropertyOptions,
|
||||
} from 'n8n-workflow';
|
||||
import { INodePropertyOptions } from 'n8n-workflow';
|
||||
|
||||
export const triggerPlaceholders = [
|
||||
{
|
||||
name: 'Title',
|
||||
value: 'ticket.title',
|
||||
description: 'Ticket\'s subject',
|
||||
description: "Ticket's subject",
|
||||
},
|
||||
{
|
||||
name: 'Description',
|
||||
value: 'ticket.description',
|
||||
description: 'Ticket\'s description',
|
||||
description: "Ticket's description",
|
||||
},
|
||||
{
|
||||
name: 'URL',
|
||||
value: 'ticket.url',
|
||||
description: 'Ticket\'s URL',
|
||||
description: "Ticket's URL",
|
||||
},
|
||||
{
|
||||
name: 'ID',
|
||||
value: 'ticket.id',
|
||||
description: 'Ticket\'s ID',
|
||||
description: "Ticket's ID",
|
||||
},
|
||||
{
|
||||
name: 'External ID',
|
||||
value: 'ticket.external_id',
|
||||
description: 'Ticket\'s external ID',
|
||||
description: "Ticket's external ID",
|
||||
},
|
||||
{
|
||||
name: 'Via',
|
||||
value: 'ticket.via',
|
||||
description: 'Ticket\'s source',
|
||||
description: "Ticket's source",
|
||||
},
|
||||
{
|
||||
name: 'Status',
|
||||
value: 'ticket.status',
|
||||
description: 'Ticket\'s status',
|
||||
description: "Ticket's status",
|
||||
},
|
||||
{
|
||||
name: 'Priority',
|
||||
value: 'ticket.priority',
|
||||
description: 'Ticket\'s priority',
|
||||
description: "Ticket's priority",
|
||||
},
|
||||
{
|
||||
name: 'Type',
|
||||
value: 'ticket.ticket_type',
|
||||
description: 'Ticket\'s type',
|
||||
description: "Ticket's type",
|
||||
},
|
||||
{
|
||||
name: 'Group Name',
|
||||
value: 'ticket.group.name',
|
||||
description: 'Ticket\'s assigned group',
|
||||
description: "Ticket's assigned group",
|
||||
},
|
||||
{
|
||||
name: 'Brand Name',
|
||||
value: 'ticket.brand.name',
|
||||
description: 'Ticket\'s brand',
|
||||
description: "Ticket's brand",
|
||||
},
|
||||
{
|
||||
name: 'Due Date',
|
||||
value: 'ticket.due_date',
|
||||
description: 'Ticket\'s due date (relevant for tickets of type Task)',
|
||||
description: "Ticket's due date (relevant for tickets of type Task)",
|
||||
},
|
||||
{
|
||||
name: 'Account',
|
||||
value: 'ticket.account',
|
||||
description: 'This Zendesk Support\'s account name',
|
||||
description: "This Zendesk Support's account name",
|
||||
},
|
||||
{
|
||||
name: 'Assignee Email',
|
||||
@@ -76,52 +74,52 @@ export const triggerPlaceholders = [
|
||||
{
|
||||
name: 'Assignee Name',
|
||||
value: 'ticket.assignee.name',
|
||||
description: 'Assignee\'s full name',
|
||||
description: "Assignee's full name",
|
||||
},
|
||||
{
|
||||
name: 'Assignee First Name',
|
||||
value: 'ticket.assignee.first_name',
|
||||
description: 'Assignee\'s first name',
|
||||
description: "Assignee's first name",
|
||||
},
|
||||
{
|
||||
name: 'Assignee Last Name',
|
||||
value: 'ticket.assignee.last_name',
|
||||
description: 'Assignee\'s last name',
|
||||
description: "Assignee's last name",
|
||||
},
|
||||
{
|
||||
name: 'Requester Full Name',
|
||||
value: 'ticket.requester.name',
|
||||
description: 'Requester\'s full name',
|
||||
description: "Requester's full name",
|
||||
},
|
||||
{
|
||||
name: 'Requester First Name',
|
||||
value: 'ticket.requester.first_name',
|
||||
description: 'Requester\'s first name',
|
||||
description: "Requester's first name",
|
||||
},
|
||||
{
|
||||
name: 'Requester Last Name',
|
||||
value: 'ticket.requester.last_name',
|
||||
description: 'Requester\'s last name',
|
||||
description: "Requester's last name",
|
||||
},
|
||||
{
|
||||
name: 'Requester Email',
|
||||
value: 'ticket.requester.email',
|
||||
description: 'Requester\'s email',
|
||||
description: "Requester's email",
|
||||
},
|
||||
{
|
||||
name: 'Requester Language',
|
||||
value: 'ticket.requester.language',
|
||||
description: 'Requester\'s language',
|
||||
description: "Requester's language",
|
||||
},
|
||||
{
|
||||
name: 'Requester Phone',
|
||||
value: 'ticket.requester.phone',
|
||||
description: 'Requester\'s phone number',
|
||||
description: "Requester's phone number",
|
||||
},
|
||||
{
|
||||
name: 'Requester External ID',
|
||||
value: 'ticket.requester.external_id',
|
||||
description: 'Requester\'s external ID',
|
||||
description: "Requester's external ID",
|
||||
},
|
||||
{
|
||||
name: 'Requester Field',
|
||||
@@ -131,47 +129,47 @@ export const triggerPlaceholders = [
|
||||
{
|
||||
name: 'Requester Details',
|
||||
value: 'ticket.requester.details',
|
||||
description: 'Detailed information about the ticket\'s requester',
|
||||
description: "Detailed information about the ticket's requester",
|
||||
},
|
||||
{
|
||||
name: 'Requester Organization',
|
||||
value: 'ticket.organization.name',
|
||||
description: 'Requester\'s organization',
|
||||
description: "Requester's organization",
|
||||
},
|
||||
{
|
||||
name: `Ticket's Organization External ID`,
|
||||
value: 'ticket.organization.external_id',
|
||||
description: 'Ticket\'s organization external ID',
|
||||
description: "Ticket's organization external ID",
|
||||
},
|
||||
{
|
||||
name: `Organization details`,
|
||||
value: 'ticket.organization.details',
|
||||
description: 'The details about the organization of the ticket\'s requester',
|
||||
description: "The details about the organization of the ticket's requester",
|
||||
},
|
||||
{
|
||||
name: `Organization Note`,
|
||||
value: 'ticket.organization.notes',
|
||||
description: 'The notes about the organization of the ticket\'s requester',
|
||||
description: "The notes about the organization of the ticket's requester",
|
||||
},
|
||||
{
|
||||
name: `Ticket's CCs`,
|
||||
value: 'ticket.ccs',
|
||||
description: 'Ticket\'s CCs',
|
||||
description: "Ticket's CCs",
|
||||
},
|
||||
{
|
||||
name: `Ticket's CCs names`,
|
||||
value: 'ticket.cc_names',
|
||||
description: 'Ticket\'s CCs names',
|
||||
description: "Ticket's CCs names",
|
||||
},
|
||||
{
|
||||
name: `Ticket's tags`,
|
||||
value: 'ticket.tags',
|
||||
description: 'Ticket\'s tags',
|
||||
description: "Ticket's tags",
|
||||
},
|
||||
{
|
||||
name: `Current Holiday Name`,
|
||||
value: 'ticket.current_holiday_name',
|
||||
description: 'Displays the name of the current holiday on the ticket\'s schedule',
|
||||
description: "Displays the name of the current holiday on the ticket's schedule",
|
||||
},
|
||||
{
|
||||
name: `Current User Name `,
|
||||
@@ -196,12 +194,12 @@ export const triggerPlaceholders = [
|
||||
{
|
||||
name: `Current User Organization Details `,
|
||||
value: 'current_user.organization.details',
|
||||
description: 'Your default organization\'s details',
|
||||
description: "Your default organization's details",
|
||||
},
|
||||
{
|
||||
name: `Current User Organization Notes `,
|
||||
value: 'current_user.organization.notes',
|
||||
description: 'Your default organization\'s note',
|
||||
description: "Your default organization's note",
|
||||
},
|
||||
{
|
||||
name: `Current User Language `,
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const userOperations: INodeProperties[] = [
|
||||
{
|
||||
@@ -10,9 +8,7 @@ export const userOperations: INodeProperties[] = [
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'user',
|
||||
],
|
||||
resource: ['user'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -43,8 +39,8 @@ export const userOperations: INodeProperties[] = [
|
||||
{
|
||||
name: 'Get Organizations',
|
||||
value: 'getOrganizations',
|
||||
description: 'Get a user\'s organizations',
|
||||
action: 'Get a user\'s organizations',
|
||||
description: "Get a user's organizations",
|
||||
action: "Get a user's organizations",
|
||||
},
|
||||
{
|
||||
name: 'Get Related Data',
|
||||
@@ -70,10 +66,9 @@ export const userOperations: INodeProperties[] = [
|
||||
];
|
||||
|
||||
export const userFields: INodeProperties[] = [
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* user:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* user:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Name',
|
||||
name: 'name',
|
||||
@@ -81,16 +76,12 @@ export const userFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'user',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['user'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
description: 'The user\'s name',
|
||||
description: "The user's name",
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
@@ -100,12 +91,8 @@ export const userFields: INodeProperties[] = [
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'user',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['user'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -136,7 +123,7 @@ export const userFields: INodeProperties[] = [
|
||||
type: 'string',
|
||||
placeholder: 'name@email.com',
|
||||
default: '',
|
||||
description: 'The user\'s primary email address',
|
||||
description: "The user's primary email address",
|
||||
},
|
||||
{
|
||||
displayName: 'External ID',
|
||||
@@ -154,7 +141,8 @@ export const userFields: INodeProperties[] = [
|
||||
loadOptionsMethod: 'getLocales',
|
||||
},
|
||||
default: '',
|
||||
description: 'The user\'s locale. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The user\'s locale. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Moderator',
|
||||
@@ -185,28 +173,31 @@ export const userFields: INodeProperties[] = [
|
||||
},
|
||||
type: 'options',
|
||||
default: '',
|
||||
description: 'The ID of the user\'s organization. If the user has more than one organization memberships, the ID of the user\'s default organization. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The ID of the user\'s organization. If the user has more than one organization memberships, the ID of the user\'s default organization. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Phone',
|
||||
name: 'phone',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The user\'s primary phone number',
|
||||
description: "The user's primary phone number",
|
||||
},
|
||||
{
|
||||
displayName: 'Report CSV',
|
||||
name: 'report_csv',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether or not the user can access the CSV report on the Search tab of the Reporting page in the Support admin interface',
|
||||
description:
|
||||
'Whether or not the user can access the CSV report on the Search tab of the Reporting page in the Support admin interface',
|
||||
},
|
||||
{
|
||||
displayName: 'Restricted Agent',
|
||||
name: 'restricted_agent',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether the agent has any restrictions; false for admins and unrestricted agents, true for other agents',
|
||||
description:
|
||||
'Whether the agent has any restrictions; false for admins and unrestricted agents, true for other agents',
|
||||
},
|
||||
{
|
||||
displayName: 'Role',
|
||||
@@ -227,21 +218,22 @@ export const userFields: INodeProperties[] = [
|
||||
},
|
||||
],
|
||||
default: '',
|
||||
description: 'The user\'s role',
|
||||
description: "The user's role",
|
||||
},
|
||||
{
|
||||
displayName: 'Signature',
|
||||
name: 'signature',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The user\'s signature. Only agents and admins can have signatures.',
|
||||
description: "The user's signature. Only agents and admins can have signatures.",
|
||||
},
|
||||
{
|
||||
displayName: 'Suspended',
|
||||
name: 'suspended',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether the agent is suspended. Tickets from suspended users are also suspended, and these users cannot sign in to the end user portal.',
|
||||
description:
|
||||
'Whether the agent is suspended. Tickets from suspended users are also suspended, and these users cannot sign in to the end user portal.',
|
||||
},
|
||||
{
|
||||
displayName: 'Tag Names or IDs',
|
||||
@@ -251,7 +243,8 @@ export const userFields: INodeProperties[] = [
|
||||
loadOptionsMethod: 'getTags',
|
||||
},
|
||||
default: [],
|
||||
description: 'The array of tags applied to this user. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The array of tags applied to this user. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Ticket Restriction',
|
||||
@@ -283,13 +276,13 @@ export const userFields: INodeProperties[] = [
|
||||
name: 'time_zone',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The user\'s time zone',
|
||||
description: "The user's time zone",
|
||||
},
|
||||
{
|
||||
displayName: 'User Fields',
|
||||
name: 'userFieldsUi',
|
||||
placeholder: 'Add User Field',
|
||||
description: 'Values of custom fields in the user\'s profile',
|
||||
description: "Values of custom fields in the user's profile",
|
||||
type: 'fixedCollection',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
@@ -308,7 +301,8 @@ export const userFields: INodeProperties[] = [
|
||||
loadOptionsMethod: 'getUserFields',
|
||||
},
|
||||
default: '',
|
||||
description: 'Name of the field to sort on. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'Name of the field to sort on. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
@@ -326,13 +320,13 @@ export const userFields: INodeProperties[] = [
|
||||
name: 'verified',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether the user\'s primary identity is verified or not',
|
||||
description: "Whether the user's primary identity is verified or not",
|
||||
},
|
||||
],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* user:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* user:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'User ID',
|
||||
name: 'id',
|
||||
@@ -341,12 +335,8 @@ export const userFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'user',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: ['user'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -358,12 +348,8 @@ export const userFields: INodeProperties[] = [
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'user',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: ['user'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -394,7 +380,7 @@ export const userFields: INodeProperties[] = [
|
||||
type: 'string',
|
||||
placeholder: 'name@email.com',
|
||||
default: '',
|
||||
description: 'The user\'s primary email address',
|
||||
description: "The user's primary email address",
|
||||
},
|
||||
{
|
||||
displayName: 'External ID',
|
||||
@@ -412,7 +398,8 @@ export const userFields: INodeProperties[] = [
|
||||
loadOptionsMethod: 'getLocales',
|
||||
},
|
||||
default: '',
|
||||
description: 'The user\'s locale. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The user\'s locale. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Moderator',
|
||||
@@ -426,7 +413,7 @@ export const userFields: INodeProperties[] = [
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The user\'s name',
|
||||
description: "The user's name",
|
||||
},
|
||||
{
|
||||
displayName: 'Notes',
|
||||
@@ -450,28 +437,31 @@ export const userFields: INodeProperties[] = [
|
||||
},
|
||||
type: 'options',
|
||||
default: '',
|
||||
description: 'The ID of the user\'s organization. If the user has more than one organization memberships, the ID of the user\'s default organization. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The ID of the user\'s organization. If the user has more than one organization memberships, the ID of the user\'s default organization. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Phone',
|
||||
name: 'phone',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The user\'s primary phone number',
|
||||
description: "The user's primary phone number",
|
||||
},
|
||||
{
|
||||
displayName: 'Report CSV',
|
||||
name: 'report_csv',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether or not the user can access the CSV report on the Search tab of the Reporting page in the Support admin interface',
|
||||
description:
|
||||
'Whether or not the user can access the CSV report on the Search tab of the Reporting page in the Support admin interface',
|
||||
},
|
||||
{
|
||||
displayName: 'Restricted Agent',
|
||||
name: 'restricted_agent',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether the agent has any restrictions; false for admins and unrestricted agents, true for other agents',
|
||||
description:
|
||||
'Whether the agent has any restrictions; false for admins and unrestricted agents, true for other agents',
|
||||
},
|
||||
{
|
||||
displayName: 'Role',
|
||||
@@ -492,21 +482,22 @@ export const userFields: INodeProperties[] = [
|
||||
},
|
||||
],
|
||||
default: '',
|
||||
description: 'The user\'s role',
|
||||
description: "The user's role",
|
||||
},
|
||||
{
|
||||
displayName: 'Signature',
|
||||
name: 'signature',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The user\'s signature. Only agents and admins can have signatures.',
|
||||
description: "The user's signature. Only agents and admins can have signatures.",
|
||||
},
|
||||
{
|
||||
displayName: 'Suspended',
|
||||
name: 'suspended',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether the agent is suspended. Tickets from suspended users are also suspended, and these users cannot sign in to the end user portal.',
|
||||
description:
|
||||
'Whether the agent is suspended. Tickets from suspended users are also suspended, and these users cannot sign in to the end user portal.',
|
||||
},
|
||||
{
|
||||
displayName: 'Tag Names or IDs',
|
||||
@@ -516,7 +507,8 @@ export const userFields: INodeProperties[] = [
|
||||
loadOptionsMethod: 'getTags',
|
||||
},
|
||||
default: [],
|
||||
description: 'The array of tags applied to this user. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The array of tags applied to this user. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Ticket Restriction',
|
||||
@@ -548,13 +540,13 @@ export const userFields: INodeProperties[] = [
|
||||
name: 'time_zone',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The user\'s time zone',
|
||||
description: "The user's time zone",
|
||||
},
|
||||
{
|
||||
displayName: 'User Fields',
|
||||
name: 'userFieldsUi',
|
||||
placeholder: 'Add User Field',
|
||||
description: 'Values of custom fields in the user\'s profile',
|
||||
description: "Values of custom fields in the user's profile",
|
||||
type: 'fixedCollection',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
@@ -573,7 +565,8 @@ export const userFields: INodeProperties[] = [
|
||||
loadOptionsMethod: 'getUserFields',
|
||||
},
|
||||
default: '',
|
||||
description: 'Name of the field to sort on. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'Name of the field to sort on. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
@@ -591,13 +584,13 @@ export const userFields: INodeProperties[] = [
|
||||
name: 'verified',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether the user\'s primary identity is verified or not',
|
||||
description: "Whether the user's primary identity is verified or not",
|
||||
},
|
||||
],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* user:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* user:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'User ID',
|
||||
name: 'id',
|
||||
@@ -606,30 +599,22 @@ export const userFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'user',
|
||||
],
|
||||
operation: [
|
||||
'get',
|
||||
],
|
||||
resource: ['user'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* user:getAll */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* user:getAll */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'user',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: ['user'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
@@ -641,15 +626,9 @@ export const userFields: INodeProperties[] = [
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'user',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
resource: ['user'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
@@ -667,12 +646,8 @@ export const userFields: INodeProperties[] = [
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'user',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: ['user'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -698,21 +673,17 @@ export const userFields: INodeProperties[] = [
|
||||
},
|
||||
],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* user:search */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* user:search */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'user',
|
||||
],
|
||||
operation: [
|
||||
'search',
|
||||
],
|
||||
resource: ['user'],
|
||||
operation: ['search'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
@@ -724,15 +695,9 @@ export const userFields: INodeProperties[] = [
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'user',
|
||||
],
|
||||
operation: [
|
||||
'search',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
resource: ['user'],
|
||||
operation: ['search'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
@@ -750,12 +715,8 @@ export const userFields: INodeProperties[] = [
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'user',
|
||||
],
|
||||
operation: [
|
||||
'search',
|
||||
],
|
||||
resource: ['user'],
|
||||
operation: ['search'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -773,9 +734,9 @@ export const userFields: INodeProperties[] = [
|
||||
},
|
||||
],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* user:delete */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* user:delete */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'User ID',
|
||||
name: 'id',
|
||||
@@ -784,18 +745,14 @@ export const userFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'user',
|
||||
],
|
||||
operation: [
|
||||
'delete',
|
||||
],
|
||||
resource: ['user'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* user:getRelatedData */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* user:getRelatedData */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'User ID',
|
||||
name: 'id',
|
||||
@@ -804,18 +761,14 @@ export const userFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'user',
|
||||
],
|
||||
operation: [
|
||||
'getRelatedData',
|
||||
],
|
||||
resource: ['user'],
|
||||
operation: ['getRelatedData'],
|
||||
},
|
||||
},
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* user:getOrganizations */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* user:getOrganizations */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'User ID',
|
||||
name: 'id',
|
||||
@@ -824,12 +777,8 @@ export const userFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'user',
|
||||
],
|
||||
operation: [
|
||||
'getOrganizations',
|
||||
],
|
||||
resource: ['user'],
|
||||
operation: ['getOrganizations'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
@@ -13,36 +11,17 @@ import {
|
||||
NodeOperationError,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
validateJSON,
|
||||
zendeskApiRequest,
|
||||
zendeskApiRequestAllItems,
|
||||
} from './GenericFunctions';
|
||||
import { validateJSON, zendeskApiRequest, zendeskApiRequestAllItems } from './GenericFunctions';
|
||||
|
||||
import {
|
||||
ticketFields,
|
||||
ticketOperations
|
||||
} from './TicketDescription';
|
||||
import { ticketFields, ticketOperations } from './TicketDescription';
|
||||
|
||||
import {
|
||||
ticketFieldFields,
|
||||
ticketFieldOperations
|
||||
} from './TicketFieldDescription';
|
||||
import { ticketFieldFields, ticketFieldOperations } from './TicketFieldDescription';
|
||||
|
||||
import {
|
||||
userFields,
|
||||
userOperations
|
||||
} from './UserDescription';
|
||||
import { userFields, userOperations } from './UserDescription';
|
||||
|
||||
import {
|
||||
organizationFields,
|
||||
organizationOperations
|
||||
} from './OrganizationDescription';
|
||||
import { organizationFields, organizationOperations } from './OrganizationDescription';
|
||||
|
||||
import {
|
||||
IComment,
|
||||
ITicket,
|
||||
} from './TicketInterface';
|
||||
import { IComment, ITicket } from './TicketInterface';
|
||||
|
||||
export class Zendesk implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
@@ -64,9 +43,7 @@ export class Zendesk implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
authentication: [
|
||||
'apiToken',
|
||||
],
|
||||
authentication: ['apiToken'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -75,9 +52,7 @@ export class Zendesk implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
authentication: [
|
||||
'oAuth2',
|
||||
],
|
||||
authentication: ['oAuth2'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -108,7 +83,8 @@ export class Zendesk implements INodeType {
|
||||
{
|
||||
name: 'Ticket',
|
||||
value: 'ticket',
|
||||
description: 'Tickets are the means through which your end users (customers) communicate with agents in Zendesk Support',
|
||||
description:
|
||||
'Tickets are the means through which your end users (customers) communicate with agents in Zendesk Support',
|
||||
},
|
||||
{
|
||||
name: 'Ticket Field',
|
||||
@@ -159,7 +135,12 @@ export class Zendesk implements INodeType {
|
||||
'multiselect',
|
||||
'tagger',
|
||||
];
|
||||
const fields = await zendeskApiRequestAllItems.call(this, 'ticket_fields', 'GET', '/ticket_fields');
|
||||
const fields = await zendeskApiRequestAllItems.call(
|
||||
this,
|
||||
'ticket_fields',
|
||||
'GET',
|
||||
'/ticket_fields',
|
||||
);
|
||||
for (const field of fields) {
|
||||
if (customFields.includes(field.type)) {
|
||||
const fieldName = field.title;
|
||||
@@ -223,7 +204,12 @@ export class Zendesk implements INodeType {
|
||||
// select them easily
|
||||
async getUserFields(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
const fields = await zendeskApiRequestAllItems.call(this, 'user_fields', 'GET', '/user_fields');
|
||||
const fields = await zendeskApiRequestAllItems.call(
|
||||
this,
|
||||
'user_fields',
|
||||
'GET',
|
||||
'/user_fields',
|
||||
);
|
||||
for (const field of fields) {
|
||||
const fieldName = field.title;
|
||||
const fieldId = field.key;
|
||||
@@ -238,7 +224,12 @@ export class Zendesk implements INodeType {
|
||||
// Get all the organization fields to display them to the user for easy selection
|
||||
async getOrganizationFields(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
const fields = await zendeskApiRequestAllItems.call(this, 'organization_fields', 'GET', '/organization_fields');
|
||||
const fields = await zendeskApiRequestAllItems.call(
|
||||
this,
|
||||
'organization_fields',
|
||||
'GET',
|
||||
'/organization_fields',
|
||||
);
|
||||
for (const field of fields) {
|
||||
const fieldName = field.title;
|
||||
const fieldId = field.key;
|
||||
@@ -252,7 +243,14 @@ export class Zendesk implements INodeType {
|
||||
|
||||
async getOrganizations(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
const fields = await zendeskApiRequestAllItems.call(this, 'organizations', 'GET', `/organizations`, {}, {});
|
||||
const fields = await zendeskApiRequestAllItems.call(
|
||||
this,
|
||||
'organizations',
|
||||
'GET',
|
||||
`/organizations`,
|
||||
{},
|
||||
{},
|
||||
);
|
||||
for (const field of fields) {
|
||||
returnData.push({
|
||||
name: field.name,
|
||||
@@ -287,21 +285,23 @@ export class Zendesk implements INodeType {
|
||||
comment,
|
||||
};
|
||||
if (jsonParameters) {
|
||||
const additionalFieldsJson = this.getNodeParameter('additionalFieldsJson', i) as string;
|
||||
const additionalFieldsJson = this.getNodeParameter(
|
||||
'additionalFieldsJson',
|
||||
i,
|
||||
) as string;
|
||||
|
||||
if (additionalFieldsJson !== '') {
|
||||
|
||||
if (validateJSON(additionalFieldsJson) !== undefined) {
|
||||
|
||||
Object.assign(body, JSON.parse(additionalFieldsJson));
|
||||
|
||||
} else {
|
||||
throw new NodeOperationError(this.getNode(), 'Additional fields must be a valid JSON', { itemIndex: i });
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
'Additional fields must be a valid JSON',
|
||||
{ itemIndex: i },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||
|
||||
if (additionalFields.type) {
|
||||
@@ -326,7 +326,8 @@ export class Zendesk implements INodeType {
|
||||
body.tags = additionalFields.tags as string[];
|
||||
}
|
||||
if (additionalFields.customFieldsUi) {
|
||||
body.custom_fields = (additionalFields.customFieldsUi as IDataObject).customFieldsValues as IDataObject[];
|
||||
body.custom_fields = (additionalFields.customFieldsUi as IDataObject)
|
||||
.customFieldsValues as IDataObject[];
|
||||
}
|
||||
}
|
||||
responseData = await zendeskApiRequest.call(this, 'POST', '/tickets', { ticket: body });
|
||||
@@ -342,18 +343,17 @@ export class Zendesk implements INodeType {
|
||||
const updateFieldsJson = this.getNodeParameter('updateFieldsJson', i) as string;
|
||||
|
||||
if (updateFieldsJson !== '') {
|
||||
|
||||
if (validateJSON(updateFieldsJson) !== undefined) {
|
||||
|
||||
Object.assign(body, JSON.parse(updateFieldsJson));
|
||||
|
||||
} else {
|
||||
throw new NodeOperationError(this.getNode(), 'Additional fields must be a valid JSON', { itemIndex: i });
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
'Additional fields must be a valid JSON',
|
||||
{ itemIndex: i },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
|
||||
|
||||
if (updateFields.type) {
|
||||
@@ -378,7 +378,8 @@ export class Zendesk implements INodeType {
|
||||
body.tags = updateFields.tags as string[];
|
||||
}
|
||||
if (updateFields.customFieldsUi) {
|
||||
body.custom_fields = (updateFields.customFieldsUi as IDataObject).customFieldsValues as IDataObject[];
|
||||
body.custom_fields = (updateFields.customFieldsUi as IDataObject)
|
||||
.customFieldsValues as IDataObject[];
|
||||
}
|
||||
if (updateFields.assigneeEmail) {
|
||||
body.assignee_email = updateFields.assigneeEmail as string;
|
||||
@@ -398,9 +399,10 @@ export class Zendesk implements INodeType {
|
||||
};
|
||||
body.comment = comment;
|
||||
}
|
||||
|
||||
}
|
||||
responseData = await zendeskApiRequest.call(this, 'PUT', `/tickets/${ticketId}`, { ticket: body });
|
||||
responseData = await zendeskApiRequest.call(this, 'PUT', `/tickets/${ticketId}`, {
|
||||
ticket: body,
|
||||
});
|
||||
responseData = responseData.ticket;
|
||||
}
|
||||
//https://developer.zendesk.com/rest_api/docs/support/tickets#show-ticket
|
||||
@@ -408,7 +410,8 @@ export class Zendesk implements INodeType {
|
||||
if (operation === 'get') {
|
||||
const ticketType = this.getNodeParameter('ticketType', i) as string;
|
||||
const ticketId = this.getNodeParameter('id', i) as string;
|
||||
const endpoint = (ticketType === 'regular') ? `/tickets/${ticketId}` : `/suspended_tickets/${ticketId}`;
|
||||
const endpoint =
|
||||
ticketType === 'regular' ? `/tickets/${ticketId}` : `/suspended_tickets/${ticketId}`;
|
||||
responseData = await zendeskApiRequest.call(this, 'GET', endpoint, {});
|
||||
responseData = responseData.ticket || responseData.suspended_ticket;
|
||||
}
|
||||
@@ -435,10 +438,17 @@ export class Zendesk implements INodeType {
|
||||
if (options.sortOrder) {
|
||||
qs.sort_order = options.sortOrder;
|
||||
}
|
||||
const endpoint = (ticketType === 'regular') ? `/search` : `/suspended_tickets`;
|
||||
const property = (ticketType === 'regular') ? 'results' : 'suspended_tickets';
|
||||
const endpoint = ticketType === 'regular' ? `/search` : `/suspended_tickets`;
|
||||
const property = ticketType === 'regular' ? 'results' : 'suspended_tickets';
|
||||
if (returnAll) {
|
||||
responseData = await zendeskApiRequestAllItems.call(this, property, 'GET', endpoint, {}, qs);
|
||||
responseData = await zendeskApiRequestAllItems.call(
|
||||
this,
|
||||
property,
|
||||
'GET',
|
||||
endpoint,
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
} else {
|
||||
const limit = this.getNodeParameter('limit', i) as number;
|
||||
qs.per_page = limit;
|
||||
@@ -451,7 +461,8 @@ export class Zendesk implements INodeType {
|
||||
if (operation === 'delete') {
|
||||
const ticketType = this.getNodeParameter('ticketType', i) as string;
|
||||
const ticketId = this.getNodeParameter('id', i) as string;
|
||||
const endpoint = (ticketType === 'regular') ? `/tickets/${ticketId}` : `/suspended_tickets/${ticketId}`;
|
||||
const endpoint =
|
||||
ticketType === 'regular' ? `/tickets/${ticketId}` : `/suspended_tickets/${ticketId}`;
|
||||
responseData = await zendeskApiRequest.call(this, 'DELETE', endpoint, {});
|
||||
responseData = { success: true };
|
||||
}
|
||||
@@ -459,7 +470,12 @@ export class Zendesk implements INodeType {
|
||||
if (operation === 'recover') {
|
||||
const ticketId = this.getNodeParameter('id', i) as string;
|
||||
try {
|
||||
responseData = await zendeskApiRequest.call(this, 'PUT', `/suspended_tickets/${ticketId}/recover`, {});
|
||||
responseData = await zendeskApiRequest.call(
|
||||
this,
|
||||
'PUT',
|
||||
`/suspended_tickets/${ticketId}/recover`,
|
||||
{},
|
||||
);
|
||||
responseData = responseData.ticket;
|
||||
} catch (error) {
|
||||
throw new NodeApiError(this.getNode(), error);
|
||||
@@ -471,18 +487,37 @@ export class Zendesk implements INodeType {
|
||||
//https://developer.zendesk.com/rest_api/docs/support/tickets#show-ticket
|
||||
if (operation === 'get') {
|
||||
const ticketFieldId = this.getNodeParameter('ticketFieldId', i) as string;
|
||||
responseData = await zendeskApiRequest.call(this, 'GET', `/ticket_fields/${ticketFieldId}`, {});
|
||||
responseData = await zendeskApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/ticket_fields/${ticketFieldId}`,
|
||||
{},
|
||||
);
|
||||
responseData = responseData.ticket_field;
|
||||
}
|
||||
//https://developer.zendesk.com/rest_api/docs/support/ticket_fields#list-ticket-fields
|
||||
if (operation === 'getAll') {
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
if (returnAll) {
|
||||
responseData = await zendeskApiRequestAllItems.call(this, 'ticket_fields', 'GET', '/ticket_fields', {}, qs);
|
||||
responseData = await zendeskApiRequestAllItems.call(
|
||||
this,
|
||||
'ticket_fields',
|
||||
'GET',
|
||||
'/ticket_fields',
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
} else {
|
||||
const limit = this.getNodeParameter('limit', i) as number;
|
||||
qs.limit = limit;
|
||||
responseData = await zendeskApiRequestAllItems.call(this, 'ticket_fields', 'GET', '/ticket_fields', {}, qs);
|
||||
responseData = await zendeskApiRequestAllItems.call(
|
||||
this,
|
||||
'ticket_fields',
|
||||
'GET',
|
||||
'/ticket_fields',
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
responseData = responseData.slice(0, limit);
|
||||
}
|
||||
}
|
||||
@@ -501,7 +536,8 @@ export class Zendesk implements INodeType {
|
||||
Object.assign(body, additionalFields);
|
||||
|
||||
if (body.userFieldsUi) {
|
||||
const userFields = (body.userFieldsUi as IDataObject).userFieldValues as IDataObject[];
|
||||
const userFields = (body.userFieldsUi as IDataObject)
|
||||
.userFieldValues as IDataObject[];
|
||||
if (userFields) {
|
||||
body.user_fields = {};
|
||||
for (const userField of userFields) {
|
||||
@@ -524,7 +560,8 @@ export class Zendesk implements INodeType {
|
||||
Object.assign(body, updateFields);
|
||||
|
||||
if (body.userFieldsUi) {
|
||||
const userFields = (body.userFieldsUi as IDataObject).userFieldValues as IDataObject[];
|
||||
const userFields = (body.userFieldsUi as IDataObject)
|
||||
.userFieldValues as IDataObject[];
|
||||
if (userFields) {
|
||||
body.user_fields = {};
|
||||
for (const userField of userFields) {
|
||||
@@ -535,7 +572,9 @@ export class Zendesk implements INodeType {
|
||||
}
|
||||
}
|
||||
|
||||
responseData = await zendeskApiRequest.call(this, 'PUT', `/users/${userId}`, { user: body });
|
||||
responseData = await zendeskApiRequest.call(this, 'PUT', `/users/${userId}`, {
|
||||
user: body,
|
||||
});
|
||||
responseData = responseData.user;
|
||||
}
|
||||
//https://developer.zendesk.com/api-reference/ticketing/users/users/#show-user
|
||||
@@ -552,7 +591,14 @@ export class Zendesk implements INodeType {
|
||||
Object.assign(qs, options);
|
||||
|
||||
if (returnAll) {
|
||||
responseData = await zendeskApiRequestAllItems.call(this, 'users', 'GET', `/users`, {}, qs);
|
||||
responseData = await zendeskApiRequestAllItems.call(
|
||||
this,
|
||||
'users',
|
||||
'GET',
|
||||
`/users`,
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
} else {
|
||||
const limit = this.getNodeParameter('limit', i) as number;
|
||||
qs.per_page = limit;
|
||||
@@ -563,7 +609,12 @@ export class Zendesk implements INodeType {
|
||||
//https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#list-organizations
|
||||
if (operation === 'getOrganizations') {
|
||||
const userId = this.getNodeParameter('id', i) as string;
|
||||
responseData = await zendeskApiRequest.call(this, 'GET', `/users/${userId}/organizations`, {});
|
||||
responseData = await zendeskApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/users/${userId}/organizations`,
|
||||
{},
|
||||
);
|
||||
responseData = responseData.organizations;
|
||||
}
|
||||
//https://developer.zendesk.com/api-reference/ticketing/users/users/#search-users
|
||||
@@ -574,7 +625,14 @@ export class Zendesk implements INodeType {
|
||||
Object.assign(qs, options);
|
||||
|
||||
if (returnAll) {
|
||||
responseData = await zendeskApiRequestAllItems.call(this, 'users', 'GET', `/users/search`, {}, qs);
|
||||
responseData = await zendeskApiRequestAllItems.call(
|
||||
this,
|
||||
'users',
|
||||
'GET',
|
||||
`/users/search`,
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
} else {
|
||||
const limit = this.getNodeParameter('limit', i) as number;
|
||||
qs.per_page = limit;
|
||||
@@ -591,7 +649,12 @@ export class Zendesk implements INodeType {
|
||||
//https://developer.zendesk.com/api-reference/ticketing/users/users/#show-user-related-information
|
||||
if (operation === 'getRelatedData') {
|
||||
const userId = this.getNodeParameter('id', i) as string;
|
||||
responseData = await zendeskApiRequest.call(this, 'GET', `/users/${userId}/related`, {});
|
||||
responseData = await zendeskApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/users/${userId}/related`,
|
||||
{},
|
||||
);
|
||||
responseData = responseData.user_related;
|
||||
}
|
||||
}
|
||||
@@ -601,11 +664,21 @@ export class Zendesk implements INodeType {
|
||||
if (operation === 'create') {
|
||||
const name = this.getNodeParameter('name', i) as string;
|
||||
|
||||
const body: IDataObject & { name: string; organization_fields?: { [key: string]: object | string } } = {
|
||||
const body: IDataObject & {
|
||||
name: string;
|
||||
organization_fields?: { [key: string]: object | string };
|
||||
} = {
|
||||
name,
|
||||
};
|
||||
|
||||
const { organizationFieldsUi, ...rest } = this.getNodeParameter('additionalFields', i) as IDataObject & { organizationFieldsUi?: { organizationFieldValues: Array<{ field: string; value: string; }> } };
|
||||
const { organizationFieldsUi, ...rest } = this.getNodeParameter(
|
||||
'additionalFields',
|
||||
i,
|
||||
) as IDataObject & {
|
||||
organizationFieldsUi?: {
|
||||
organizationFieldValues: Array<{ field: string; value: string }>;
|
||||
};
|
||||
};
|
||||
|
||||
Object.assign(body, rest);
|
||||
|
||||
@@ -619,7 +692,9 @@ export class Zendesk implements INodeType {
|
||||
}
|
||||
}
|
||||
|
||||
responseData = await zendeskApiRequest.call(this, 'POST', '/organizations', { organization: body });
|
||||
responseData = await zendeskApiRequest.call(this, 'POST', '/organizations', {
|
||||
organization: body,
|
||||
});
|
||||
responseData = responseData.organization;
|
||||
}
|
||||
//https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#delete-organization
|
||||
@@ -636,7 +711,12 @@ export class Zendesk implements INodeType {
|
||||
//https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#show-organization
|
||||
if (operation === 'get') {
|
||||
const organizationId = this.getNodeParameter('id', i) as string;
|
||||
responseData = await zendeskApiRequest.call(this, 'GET', `/organizations/${organizationId}`, {});
|
||||
responseData = await zendeskApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/organizations/${organizationId}`,
|
||||
{},
|
||||
);
|
||||
responseData = responseData.organization;
|
||||
}
|
||||
//https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#list-organizations
|
||||
@@ -644,7 +724,14 @@ export class Zendesk implements INodeType {
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
|
||||
if (returnAll) {
|
||||
responseData = await zendeskApiRequestAllItems.call(this, 'organizations', 'GET', `/organizations`, {}, qs);
|
||||
responseData = await zendeskApiRequestAllItems.call(
|
||||
this,
|
||||
'organizations',
|
||||
'GET',
|
||||
`/organizations`,
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
} else {
|
||||
const limit = this.getNodeParameter('limit', i) as number;
|
||||
qs.per_page = limit;
|
||||
@@ -655,16 +742,29 @@ export class Zendesk implements INodeType {
|
||||
//https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#show-organizations-related-information
|
||||
if (operation === 'getRelatedData') {
|
||||
const organizationId = this.getNodeParameter('id', i) as string;
|
||||
responseData = await zendeskApiRequest.call(this, 'GET', `/organizations/${organizationId}/related`, {});
|
||||
responseData = await zendeskApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/organizations/${organizationId}/related`,
|
||||
{},
|
||||
);
|
||||
responseData = responseData.organization_related;
|
||||
}
|
||||
//https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#update-organization
|
||||
if (operation === 'update') {
|
||||
const organizationId = this.getNodeParameter('id', i) as string;
|
||||
|
||||
const body: IDataObject & { organization_fields?: { [key: string]: object | string } } = {};
|
||||
const body: IDataObject & { organization_fields?: { [key: string]: object | string } } =
|
||||
{};
|
||||
|
||||
const { organizationFieldsUi, ...rest } = this.getNodeParameter('updateFields', i) as IDataObject & { organizationFieldsUi?: { organizationFieldValues: Array<{ field: string; value: string; }> } };
|
||||
const { organizationFieldsUi, ...rest } = this.getNodeParameter(
|
||||
'updateFields',
|
||||
i,
|
||||
) as IDataObject & {
|
||||
organizationFieldsUi?: {
|
||||
organizationFieldValues: Array<{ field: string; value: string }>;
|
||||
};
|
||||
};
|
||||
|
||||
Object.assign(body, rest);
|
||||
|
||||
@@ -678,10 +778,14 @@ export class Zendesk implements INodeType {
|
||||
}
|
||||
}
|
||||
|
||||
responseData = await zendeskApiRequest.call(this, 'PUT', `/organizations/${organizationId}`, { organization: body });
|
||||
responseData = await zendeskApiRequest.call(
|
||||
this,
|
||||
'PUT',
|
||||
`/organizations/${organizationId}`,
|
||||
{ organization: body },
|
||||
);
|
||||
responseData = responseData.organization;
|
||||
}
|
||||
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
import {
|
||||
parse as urlParse,
|
||||
} from 'url';
|
||||
import { parse as urlParse } from 'url';
|
||||
|
||||
import {
|
||||
IHookFunctions,
|
||||
IWebhookFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IHookFunctions, IWebhookFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
@@ -17,17 +12,10 @@ import {
|
||||
NodeOperationError,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
zendeskApiRequest,
|
||||
zendeskApiRequestAllItems,
|
||||
} from './GenericFunctions';
|
||||
import {
|
||||
conditionFields,
|
||||
} from './ConditionDescription';
|
||||
import { zendeskApiRequest, zendeskApiRequestAllItems } from './GenericFunctions';
|
||||
import { conditionFields } from './ConditionDescription';
|
||||
|
||||
import {
|
||||
triggerPlaceholders
|
||||
} from './TriggerPlaceholders';
|
||||
import { triggerPlaceholders } from './TriggerPlaceholders';
|
||||
|
||||
export class ZendeskTrigger implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
@@ -48,9 +36,7 @@ export class ZendeskTrigger implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
authentication: [
|
||||
'apiToken',
|
||||
],
|
||||
authentication: ['apiToken'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -59,9 +45,7 @@ export class ZendeskTrigger implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
authentication: [
|
||||
'oAuth2',
|
||||
],
|
||||
authentication: ['oAuth2'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -110,9 +94,7 @@ export class ZendeskTrigger implements INodeType {
|
||||
type: 'collection',
|
||||
displayOptions: {
|
||||
show: {
|
||||
service: [
|
||||
'support',
|
||||
],
|
||||
service: ['support'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
@@ -120,7 +102,8 @@ export class ZendeskTrigger implements INodeType {
|
||||
{
|
||||
displayName: 'Field Names or IDs',
|
||||
name: 'fields',
|
||||
description: 'The fields to return the values of. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The fields to return the values of. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
type: 'multiOptions',
|
||||
default: [],
|
||||
typeOptions: {
|
||||
@@ -140,9 +123,7 @@ export class ZendeskTrigger implements INodeType {
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
service: [
|
||||
'support',
|
||||
],
|
||||
service: ['support'],
|
||||
},
|
||||
},
|
||||
description: 'The condition to set',
|
||||
@@ -151,21 +132,16 @@ export class ZendeskTrigger implements INodeType {
|
||||
{
|
||||
name: 'all',
|
||||
displayName: 'All',
|
||||
values: [
|
||||
...conditionFields,
|
||||
],
|
||||
values: [...conditionFields],
|
||||
},
|
||||
{
|
||||
name: 'any',
|
||||
displayName: 'Any',
|
||||
values: [
|
||||
...conditionFields,
|
||||
],
|
||||
values: [...conditionFields],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
};
|
||||
methods = {
|
||||
loadOptions: {
|
||||
@@ -183,7 +159,12 @@ export class ZendeskTrigger implements INodeType {
|
||||
'multiselect',
|
||||
'tagger',
|
||||
];
|
||||
const fields = await zendeskApiRequestAllItems.call(this, 'ticket_fields', 'GET', '/ticket_fields');
|
||||
const fields = await zendeskApiRequestAllItems.call(
|
||||
this,
|
||||
'ticket_fields',
|
||||
'GET',
|
||||
'/ticket_fields',
|
||||
);
|
||||
for (const field of fields) {
|
||||
if (customFields.includes(field.type) && field.removable && field.active) {
|
||||
const fieldName = field.title;
|
||||
@@ -246,7 +227,8 @@ export class ZendeskTrigger implements INodeType {
|
||||
const conditions = this.getNodeParameter('conditions') as IDataObject;
|
||||
|
||||
let endpoint = '';
|
||||
const resultAll = [], resultAny = [];
|
||||
const resultAll = [],
|
||||
resultAny = [];
|
||||
|
||||
const conditionsAll = conditions.all as [IDataObject];
|
||||
if (conditionsAll) {
|
||||
@@ -254,8 +236,7 @@ export class ZendeskTrigger implements INodeType {
|
||||
const aux: IDataObject = {};
|
||||
aux.field = conditionAll.field;
|
||||
aux.operator = conditionAll.operation;
|
||||
if (conditionAll.operation !== 'changed'
|
||||
&& conditionAll.operation !== 'not_changed') {
|
||||
if (conditionAll.operation !== 'changed' && conditionAll.operation !== 'not_changed') {
|
||||
aux.value = conditionAll.value;
|
||||
} else {
|
||||
aux.value = null;
|
||||
@@ -270,8 +251,7 @@ export class ZendeskTrigger implements INodeType {
|
||||
const aux: IDataObject = {};
|
||||
aux.field = conditionAny.field;
|
||||
aux.operator = conditionAny.operation;
|
||||
if (conditionAny.operation !== 'changed'
|
||||
&& conditionAny.operation !== 'not_changed') {
|
||||
if (conditionAny.operation !== 'changed' && conditionAny.operation !== 'not_changed') {
|
||||
aux.value = conditionAny.value;
|
||||
} else {
|
||||
aux.value = null;
|
||||
@@ -296,18 +276,24 @@ export class ZendeskTrigger implements INodeType {
|
||||
}
|
||||
|
||||
endpoint = `/triggers/active`;
|
||||
const triggers = await zendeskApiRequestAllItems.call(this, 'triggers', 'GET', endpoint);
|
||||
const triggers = await zendeskApiRequestAllItems.call(this, 'triggers', 'GET', endpoint);
|
||||
|
||||
for (const trigger of triggers) {
|
||||
const toDeleteTriggers = [];
|
||||
// this trigger belong to the current target
|
||||
if (trigger.actions[0].value[0].toString() === webhookData.targetId?.toString()) {
|
||||
toDeleteTriggers.push(trigger.id);
|
||||
}
|
||||
// delete all trigger attach to this target;
|
||||
if (toDeleteTriggers.length !== 0) {
|
||||
await zendeskApiRequest.call(this, 'DELETE', '/triggers/destroy_many', {}, { ids: toDeleteTriggers.join(',') } );
|
||||
}
|
||||
const toDeleteTriggers = [];
|
||||
// this trigger belong to the current target
|
||||
if (trigger.actions[0].value[0].toString() === webhookData.targetId?.toString()) {
|
||||
toDeleteTriggers.push(trigger.id);
|
||||
}
|
||||
// delete all trigger attach to this target;
|
||||
if (toDeleteTriggers.length !== 0) {
|
||||
await zendeskApiRequest.call(
|
||||
this,
|
||||
'DELETE',
|
||||
'/triggers/destroy_many',
|
||||
{},
|
||||
{ ids: toDeleteTriggers.join(',') },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -319,7 +305,8 @@ export class ZendeskTrigger implements INodeType {
|
||||
|
||||
if (service === 'support') {
|
||||
const message: IDataObject = {};
|
||||
const resultAll = [], resultAny = [];
|
||||
const resultAll = [],
|
||||
resultAny = [];
|
||||
const conditions = this.getNodeParameter('conditions') as IDataObject;
|
||||
const options = this.getNodeParameter('options') as IDataObject;
|
||||
|
||||
@@ -342,8 +329,10 @@ export class ZendeskTrigger implements INodeType {
|
||||
const aux: IDataObject = {};
|
||||
aux.field = conditionAll.field;
|
||||
aux.operator = conditionAll.operation;
|
||||
if (conditionAll.operation !== 'changed'
|
||||
&& conditionAll.operation !== 'not_changed') {
|
||||
if (
|
||||
conditionAll.operation !== 'changed' &&
|
||||
conditionAll.operation !== 'not_changed'
|
||||
) {
|
||||
aux.value = conditionAll.value;
|
||||
} else {
|
||||
aux.value = null;
|
||||
@@ -358,8 +347,10 @@ export class ZendeskTrigger implements INodeType {
|
||||
const aux: IDataObject = {};
|
||||
aux.field = conditionAny.field;
|
||||
aux.operator = conditionAny.operation;
|
||||
if (conditionAny.operation !== 'changed'
|
||||
&& conditionAny.operation !== 'not_changed') {
|
||||
if (
|
||||
conditionAny.operation !== 'changed' &&
|
||||
conditionAny.operation !== 'not_changed'
|
||||
) {
|
||||
aux.value = conditionAny.value;
|
||||
} else {
|
||||
aux.value = null;
|
||||
@@ -376,7 +367,7 @@ export class ZendeskTrigger implements INodeType {
|
||||
conditions: {
|
||||
all: resultAll,
|
||||
any: resultAny,
|
||||
},
|
||||
},
|
||||
actions: [
|
||||
{
|
||||
field: 'notification_webhook',
|
||||
@@ -388,14 +379,12 @@ export class ZendeskTrigger implements INodeType {
|
||||
|
||||
const bodyTarget: IDataObject = {
|
||||
webhook: {
|
||||
name:'n8n webhook',
|
||||
name: 'n8n webhook',
|
||||
endpoint: webhookUrl,
|
||||
http_method:'POST',
|
||||
status:'active',
|
||||
request_format:'json',
|
||||
subscriptions: [
|
||||
'conditional_ticket_events',
|
||||
],
|
||||
http_method: 'POST',
|
||||
status: 'active',
|
||||
request_format: 'json',
|
||||
subscriptions: ['conditional_ticket_events'],
|
||||
},
|
||||
};
|
||||
let target: IDataObject = {};
|
||||
@@ -407,7 +396,8 @@ export class ZendeskTrigger implements INodeType {
|
||||
} else {
|
||||
// create a webhook
|
||||
// https://developer.zendesk.com/api-reference/event-connectors/webhooks/webhooks/#create-or-clone-webhook
|
||||
target = (await zendeskApiRequest.call(this, 'POST', '/webhooks', bodyTarget)).webhook as IDataObject;
|
||||
target = (await zendeskApiRequest.call(this, 'POST', '/webhooks', bodyTarget))
|
||||
.webhook as IDataObject;
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
@@ -424,7 +414,7 @@ export class ZendeskTrigger implements INodeType {
|
||||
try {
|
||||
await zendeskApiRequest.call(this, 'DELETE', `/triggers/${webhookData.webhookId}`);
|
||||
await zendeskApiRequest.call(this, 'DELETE', `/webhooks/${webhookData.targetId}`);
|
||||
} catch(error) {
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
delete webhookData.triggerId;
|
||||
@@ -437,9 +427,7 @@ export class ZendeskTrigger implements INodeType {
|
||||
async webhook(this: IWebhookFunctions): Promise<IWebhookResponseData> {
|
||||
const req = this.getRequestObject();
|
||||
return {
|
||||
workflowData: [
|
||||
this.helpers.returnJsonArray(req.body),
|
||||
],
|
||||
workflowData: [this.helpers.returnJsonArray(req.body)],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user