feat(HighLevel Node): Add HighLevel node

* HighLevel Node & Credentials with basic Get/GetAll contacts

* moved contact description into subfolder

* improving all  HighLevel contact crud operations

* Get All Contacts request filters and options

* Get All Contacts request operation pagination

* Get All Contacts pagination with rootProperty

* fixing contact operations lint error node-param-options-type-unsorted-items

* Get All Contact pagination using response total to terminate loop

* Get All Contacts pagination using qs startAfterId and startAfter instead of nextPageUrl

* cleanup ContactDescription.ts operations

* added OpportunityDescription.ts Get All Operation

* added PipelineDescription.ts Get All pipelines (pagination no supported)

* GenericFunctions.ts created highLevelApiPagination method

* removed returnAll from getAll pipelines because pagination not supported

* minor improvement using IPostReceiveRootProperty Interface

* added TaskDescription.ts GetAll operation

* TaskDescription get operation

* task delete operation

* ContactDescription fixing duplicate additionalFields

* OpportunityDescription.ts adding filters for get all operation

* opportunity get and delete operation

* opportunity create additional fields

* task create with additionalFields

* create opportunity added missing status

* pagination resource mapping; create opportunity for contact email/phone/id

* create task format field dueDate to suppressMilliseconds

* opportunity's pipeline options with loadOptions

* fixed task dueDate; task update operation

* added contact dnd fields

* added contact tags

* add contact source parameter

* using returnAll Tasks with undocumented limit property

* add contact customField with loadOptions

* task dueDate preSendAction throw required error

* opportunity stageId using getPipelineStages method

* improve update contacts operation; renaming identifier to contactId

* contact tasks renamed contactIdentifier to contactId and identifier to taskId

* delete unused postReceiveAction

* getTaskPostReceiceAction to inject contactId into items

* remove source field from update contact because not supported

* renaming opportunities pipelineIdentifier to pipelineId

* opportunity parameter reordering

* opportunity update operation

* opportunity renamed "Identifier" to "Opporituny ID"

* create opportunity additional field tags

* opportunity create/update additional fields

* opportunity update contactIdentifier

* deleted pipeline getAll resource; cleanup generic functions;

* opportunity getAll option stageId use getPipelineStages

* opportunity assignedTo options use loadOptionsMethod getUsers

* added loadOptions description ''Choose from the list, or specify an ID [...]'

* getAll Tasks removing output maxResults

* highLevelApiRequest  add IPollFunctions

* add HighLevelTriggerNode

* add highLevelOAuth2Api credentials

* revert from v2 oauth2 back to apiKey v1 (incompatible client-oauth2)

* delete run.sh (was commited by accidant)

* removed HighLevelTrigger.node.ts (polling) until we support API V2 webhooks

* task additionalFields in alphabetical order; task assignedTo using loadOptions getUsers

* contact additionalFields/updateFields/filters in alphabetical order

* opportunity additionalFields/fields in alphabetical order

* ⚡ linter fixes, formating

* ⚡ fixed deprecated auth

* ⚡ lock file and auth fix

* ⚡ linter fixes

* ⚡ requestWithAuthentication in highLevelApiRequest

* ⚡ timeZones autoload and naming fixes

* contact property dnd - improved display name and description

* contact property dnd - improved display name and description

* contact create/update pre send action to validate email/phone

* updated description for contact lookup email and phone parameters

* opportunity monetary value - removed getAll filter (doesn't work) - added param description

* opportunity getAll startDate and endDate to type dateTime and dateTimeToEpochPreSendAction

* loadOption getTimezones() using /timezones and not moment.tz.names()

* improved description for opportunity parameter assignedTo

* added hint to opportunity param contactIdentifier "there can only be one..."

* added contact phone description and placeholder

* contact renamed operation "create" to "create or update" and added notice

* update opportunity - prefetch fields title/status required by api

* create/update task splitting up additionalFields to prep update changes

* update task- prefetch fields title/dueDate required by api

* linter fixes

* ⚡ improvements

* ⚡ updated autoloaded parameters names to follow convention

* update opportunity added hint "You cannot update an opportunity's pipeline ID."

Co-authored-by: Michael Kret <michael.k@radency.com>
This commit is contained in:
MarcusandMichael Kret authored and GitHub committed 2022-08-30 11:25:06 +02:00
1 parent 0e8cb74ab3
commit c2e97a89f9
9 files changed
+2498

No files matched your search

@@ -0,0 +1,34 @@
import {
IAuthenticateGeneric,
ICredentialTestRequest,
ICredentialType,
NodePropertyTypes,
} from 'n8n-workflow';
export class HighLevelApi implements ICredentialType {
name = 'highLevelApi';
displayName = 'HighLevel API';
documentationUrl = 'highLevel';
properties = [
{
displayName: 'API Key',
name: 'apiKey',
type: 'string' as NodePropertyTypes,
default: '',
},
];
authenticate: IAuthenticateGeneric = {
type: 'generic',
properties: {
headers: {
Authorization: '=Bearer {{$credentials.apiKey}}',
},
},
};
test: ICredentialTestRequest = {
request: {
baseURL: 'https://rest.gohighlevel.com/v1',
url: '/custom-values/',
},
};
}
@@ -0,0 +1,282 @@
import {
DeclarativeRestApiSettings,
IDataObject,
IExecuteFunctions,
IExecutePaginationFunctions,
IExecuteSingleFunctions,
IHookFunctions,
IHttpRequestOptions,
ILoadOptionsFunctions,
IN8nHttpFullResponse,
INodeExecutionData,
INodePropertyOptions,
IPollFunctions,
IWebhookFunctions,
NodeApiError,
} from 'n8n-workflow';
import { OptionsWithUri } from 'request';
import { DateTime, ToISOTimeOptions } from 'luxon';
const VALID_EMAIL_REGEX =
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
const VALID_PHONE_REGEX =
/((?:\+|00)[17](?: |\-)?|(?:\+|00)[1-9]\d{0,2}(?: |\-)?|(?:\+|00)1\-\d{3}(?: |\-)?)?(0\d|\([0-9]{3}\)|[1-9]{0,3})(?:((?: |\-)[0-9]{2}){4}|((?:[0-9]{2}){4})|((?: |\-)[0-9]{3}(?: |\-)[0-9]{4})|([0-9]{7}))/;
export function isEmailValid(email: string): boolean {
return VALID_EMAIL_REGEX.test(String(email).toLowerCase());
}
export function isPhoneValid(phone: string): boolean {
return VALID_PHONE_REGEX.test(String(phone));
}
function dateToIsoSupressMillis(dateTime: string) {
const options: ToISOTimeOptions = { suppressMilliseconds: true };
return DateTime.fromISO(dateTime).toISO(options);
}
export async function taskPostReceiceAction(
this: IExecuteSingleFunctions,
items: INodeExecutionData[],
response: IN8nHttpFullResponse,
): Promise<INodeExecutionData[]> {
const contactId = this.getNodeParameter('contactId');
items.forEach((item) => (item.json.contactId = contactId));
return items;
}
export async function dueDatePreSendAction(
this: IExecuteSingleFunctions,
requestOptions: IHttpRequestOptions,
): Promise<IHttpRequestOptions> {
let dueDateParam = this.getNodeParameter('dueDate', null) as string;
if (!dueDateParam) {
const fields = this.getNodeParameter('updateFields') as { dueDate: string };
dueDateParam = fields.dueDate;
}
if (!dueDateParam) {
throw new NodeApiError(
this.getNode(),
{},
{ message: 'dueDate is required', description: 'dueDate is required' },
);
}
const dueDate = dateToIsoSupressMillis(dueDateParam);
requestOptions.body = (requestOptions.body || {}) as object;
Object.assign(requestOptions.body, { dueDate });
return requestOptions;
}
export async function contactIdentifierPreSendAction(
this: IExecuteSingleFunctions,
requestOptions: IHttpRequestOptions,
): Promise<IHttpRequestOptions> {
requestOptions.body = (requestOptions.body || {}) as object;
let identifier = this.getNodeParameter('contactIdentifier', null) as string;
if (!identifier) {
const fields = this.getNodeParameter('updateFields') as { contactIdentifier: string };
identifier = fields.contactIdentifier;
}
if (isEmailValid(identifier)) {
Object.assign(requestOptions.body, { email: identifier });
} else if (isPhoneValid(identifier)) {
Object.assign(requestOptions.body, { phone: identifier });
} else {
Object.assign(requestOptions.body, { contactId: identifier });
}
return requestOptions;
}
export async function validEmailAndPhonePreSendAction(
this: IExecuteSingleFunctions,
requestOptions: IHttpRequestOptions,
): Promise<IHttpRequestOptions> {
const body = (requestOptions.body || {}) as { email?: string; phone?: string };
if (body.email && !isEmailValid(body.email)) {
const message = `email "${body.email}" has invalid format`;
throw new NodeApiError(this.getNode(), {}, { message, description: message });
}
if (body.phone && !isPhoneValid(body.phone)) {
const message = `phone "${body.phone}" has invalid format`;
throw new NodeApiError(this.getNode(), {}, { message, description: message });
}
return requestOptions;
}
export async function dateTimeToEpochPreSendAction(
this: IExecuteSingleFunctions,
requestOptions: IHttpRequestOptions,
): Promise<IHttpRequestOptions> {
const qs = (requestOptions.qs || {}) as {
startDate?: string | number;
endDate?: string | number;
};
const toEpoch = (dt: string) => new Date(dt).getTime();
if (qs.startDate) qs.startDate = toEpoch(qs.startDate as string);
if (qs.endDate) qs.endDate = toEpoch(qs.endDate as string);
return requestOptions;
}
export async function opportunityUpdatePreSendAction(
this: IExecuteSingleFunctions,
requestOptions: IHttpRequestOptions,
): Promise<IHttpRequestOptions> {
const body = (requestOptions.body || {}) as { title?: string; status?: string };
if (!body.status || !body.title) {
const pipelineId = this.getNodeParameter('pipelineId');
const opportunityId = this.getNodeParameter('opportunityId');
const resource = `/pipelines/${pipelineId}/opportunities/${opportunityId}`;
const responseData = await highLevelApiRequest.call(this, 'GET', resource);
body.status = body.status || responseData.status;
body.title = body.title || responseData.name;
requestOptions.body = body;
}
return requestOptions;
}
export async function taskUpdatePreSendAction(
this: IExecuteSingleFunctions,
requestOptions: IHttpRequestOptions,
): Promise<IHttpRequestOptions> {
const body = (requestOptions.body || {}) as { title?: string; dueDate?: string };
if (!body.title || !body.dueDate) {
const contactId = this.getNodeParameter('contactId');
const taskId = this.getNodeParameter('taskId');
const resource = `/contacts/${contactId}/tasks/${taskId}`;
const responseData = await highLevelApiRequest.call(this, 'GET', resource);
body.title = body.title || responseData.title;
// the api response dueDate has to be formatted or it will error on update
body.dueDate = body.dueDate || dateToIsoSupressMillis(responseData.dueDate);
requestOptions.body = body;
}
return requestOptions;
}
export async function splitTagsPreSendAction(
this: IExecuteSingleFunctions,
requestOptions: IHttpRequestOptions,
): Promise<IHttpRequestOptions> {
const body = (requestOptions.body || {}) as IDataObject;
if (body.tags) {
if (Array.isArray(body.tags)) return requestOptions;
body.tags = (body.tags as string).split(',').map((tag) => tag.trim());
}
return requestOptions;
}
export async function highLevelApiPagination(
this: IExecutePaginationFunctions,
requestData: DeclarativeRestApiSettings.ResultOptions,
): Promise<INodeExecutionData[]> {
const responseData: INodeExecutionData[] = [];
const resource = this.getNodeParameter('resource') as string;
const returnAll = this.getNodeParameter('returnAll', false) as boolean;
const resourceMapping: { [key: string]: string } = {
contact: 'contacts',
opportunity: 'opportunities',
};
const rootProperty = resourceMapping[resource];
requestData.options.qs = requestData.options.qs || {};
if (returnAll) requestData.options.qs.limit = 100;
let responseTotal = 0;
do {
const pageResponseData: INodeExecutionData[] = await this.makeRoutingRequest(requestData);
const items = pageResponseData[0].json[rootProperty] as [];
items.forEach((item) => responseData.push({ json: item }));
const meta = pageResponseData[0].json.meta as IDataObject;
const startAfterId = meta.startAfterId as string;
const startAfter = meta.startAfter as number;
requestData.options.qs = { startAfterId, startAfter };
responseTotal = (meta.total as number) || 0;
} while (returnAll && responseTotal > responseData.length);
return responseData;
}
export async function highLevelApiRequest(
this:
| IExecuteFunctions
| IExecuteSingleFunctions
| IWebhookFunctions
| IPollFunctions
| IHookFunctions
| ILoadOptionsFunctions,
method: string,
resource: string,
body: IDataObject = {},
qs: IDataObject = {},
uri?: string,
option: IDataObject = {},
) {
let options: OptionsWithUri = {
method,
body,
qs,
uri: uri || `https://rest.gohighlevel.com/v1${resource}`,
json: true,
};
if (!Object.keys(body).length) {
delete options.body;
}
if (!Object.keys(qs).length) {
delete options.qs;
}
options = Object.assign({}, options, option);
try {
return await this.helpers.requestWithAuthentication.call(this, 'highLevelApi', options);
} catch (error) {
throw new NodeApiError(this.getNode(), error, {
message: error.message,
});
}
}
export async function getPipelineStages(
this: ILoadOptionsFunctions,
): Promise<INodePropertyOptions[]> {
const pipelineId = this.getCurrentNodeParameter('pipelineId') as string;
const responseData = await highLevelApiRequest.call(this, 'GET', '/pipelines');
const pipelines = responseData.pipelines as [
{ id: string; stages: [{ id: string; name: string }] },
];
const pipeline = pipelines.find((p) => p.id === pipelineId);
if (pipeline) {
const options: INodePropertyOptions[] = pipeline.stages.map((stage) => {
const name = stage.name;
const value = stage.id;
return { name, value };
});
return options;
}
return [];
}
export async function getUsers(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
const responseData = await highLevelApiRequest.call(this, 'GET', '/users');
const users = responseData.users as [{ id: string; name: string; email: string }];
const options: INodePropertyOptions[] = users.map((user) => {
const name = user.name;
const value = user.id;
return { name, value };
});
return options;
}
export async function getTimezones(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
const responseData = await highLevelApiRequest.call(this, 'GET', '/timezones');
const timezones = responseData.timezones as string[];
return timezones.map((zone) => ({
name: zone,
value: zone,
})) as INodePropertyOptions[];
}
@@ -0,0 +1,18 @@
{
"node": "n8n-nodes-base.highLevel",
"nodeVersion": "1.0",
"codexVersion": "1.0",
"categories": ["Marketing & Content", "Sales"],
"resources": {
"credentialDocumentation": [
{
"url": "https://docs.n8n.io/credentials/highLevel"
}
],
"primaryDocumentation": [
{
"url": "https://docs.n8n.io/nodes/n8n-nodes-base.highLevel/"
}
]
}
}
@@ -0,0 +1,88 @@
import { INodeProperties, INodeType, INodeTypeDescription } from 'n8n-workflow';
import { contactFields, contactNotes, contactOperations } from './description/ContactDescription';
import { opportunityFields, opportunityOperations } from './description/OpportunityDescription';
import { taskFields, taskOperations } from './description/TaskDescription';
import {
getPipelineStages,
getTimezones,
getUsers,
highLevelApiPagination,
} from './GenericFunctions';
const ressources: INodeProperties[] = [
{
displayName: 'Resource',
name: 'resource',
type: 'options',
noDataExpression: true,
options: [
{
name: 'Contact',
value: 'contact',
},
{
name: 'Opportunity',
value: 'opportunity',
},
{
name: 'Task',
value: 'task',
},
],
default: 'contact',
required: true,
},
];
export class HighLevel implements INodeType {
description: INodeTypeDescription = {
displayName: 'HighLevel',
name: 'highLevel',
icon: 'file:highLevel.svg',
group: ['transform'],
version: 1,
description: 'Consume HighLevel API',
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
defaults: {
name: 'HighLevel',
color: '#f1be40',
},
inputs: ['main'],
outputs: ['main'],
credentials: [
{
name: 'highLevelApi',
required: true,
},
],
requestDefaults: {
baseURL: 'https://rest.gohighlevel.com/v1',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
},
requestOperations: {
pagination: highLevelApiPagination,
},
properties: [
...ressources,
...contactOperations,
...contactNotes,
...contactFields,
...opportunityOperations,
...opportunityFields,
...taskOperations,
...taskFields,
],
};
methods = {
loadOptions: {
getPipelineStages,
getUsers,
getTimezones,
},
};
}
@@ -0,0 +1,856 @@
import { INodeProperties } from 'n8n-workflow';
import { splitTagsPreSendAction, validEmailAndPhonePreSendAction } from '../GenericFunctions';
export const contactOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['contact'],
},
},
options: [
{
name: 'Create or Update',
value: 'create',
routing: {
request: {
method: 'POST',
url: '/contacts',
},
send: {
preSend: [validEmailAndPhonePreSendAction, splitTagsPreSendAction],
},
output: {
postReceive: [
{
type: 'rootProperty',
properties: {
property: 'contact',
},
},
],
},
},
action: 'Create or update a contact',
},
{
name: 'Delete',
value: 'delete',
routing: {
request: {
method: 'DELETE',
url: '=/contacts/{{$parameter.contactId}}',
},
output: {
postReceive: [
{
type: 'set',
properties: {
value: '={{ { "success": true } }}',
},
},
],
},
},
action: 'Delete a contact',
},
{
name: 'Get',
value: 'get',
routing: {
request: {
method: 'GET',
url: '=/contacts/{{$parameter.contactId}}',
},
output: {
postReceive: [
{
type: 'rootProperty',
properties: {
property: 'contact',
},
},
],
},
},
action: 'Get a contact',
},
{
name: 'Get All',
value: 'getAll',
routing: {
request: {
method: 'GET',
url: '=/contacts',
},
send: {
paginate: true,
},
},
action: 'Get all contacts',
},
{
name: 'Lookup',
value: 'lookup',
routing: {
request: {
method: 'GET',
url: '=/contacts/lookup?email={{$parameter.email}}&phone={{$parameter.phone}}',
},
output: {
postReceive: [
{
type: 'rootProperty',
properties: {
property: 'contacts',
},
},
],
},
},
action: 'Lookup a contact',
},
{
name: 'Update',
value: 'update',
routing: {
request: {
method: 'PUT',
url: '=/contacts/{{$parameter.contactId}}',
},
send: {
preSend: [validEmailAndPhonePreSendAction, splitTagsPreSendAction],
},
output: {
postReceive: [
{
type: 'rootProperty',
properties: {
property: 'contact',
},
},
],
},
},
action: 'Update a contact',
},
],
default: 'create',
},
];
export const contactNotes: INodeProperties[] = [
{
displayName:
'Create a new contact or update an existing one if email or phone matches (upsert)',
name: 'contactCreateNotice',
type: 'notice',
displayOptions: {
show: {
resource: ['contact'],
operation: ['create'],
},
},
default: '',
},
];
const customFields: INodeProperties = {
displayName: 'Custom Fields',
name: 'customFields',
placeholder: 'Add Field',
type: 'fixedCollection',
default: {},
typeOptions: {
multipleValues: true,
},
options: [
{
name: 'values',
displayName: 'Value',
values: [
{
displayName: 'Field Name or ID',
name: 'fieldId',
type: 'options',
required: true,
default: '',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>',
typeOptions: {
loadOptions: {
routing: {
request: {
url: '/custom-fields',
method: 'GET',
},
output: {
postReceive: [
{
type: 'rootProperty',
properties: {
property: 'customFields',
},
},
{
type: 'setKeyValue',
properties: {
name: '={{$responseItem.name}}',
value: '={{$responseItem.id}}',
},
},
{
type: 'sort',
properties: {
key: 'name',
},
},
],
},
},
},
},
},
{
displayName: 'Field Value',
name: 'fieldValue',
type: 'string',
default: '',
routing: {
send: {
value: '={{$value}}',
property: '=customField.{{$parent.fieldId}}',
type: 'body',
},
},
},
],
},
],
};
const createProperties: INodeProperties[] = [
{
displayName: 'Email',
name: 'email',
type: 'string',
placeholder: 'name@email.com',
description: 'Email or Phone are required to create contact',
displayOptions: {
show: {
resource: ['contact'],
operation: ['create'],
},
},
default: '',
routing: {
send: {
type: 'body',
property: 'email',
},
},
},
{
displayName: 'Phone',
name: 'phone',
type: 'string',
description:
'Phone or Email are required to create contact. Phone number has to start with a valid <a href="https://en.wikipedia.org/wiki/List_of_country_calling_codes">country code</a> leading with + sign.',
placeholder: '+491234567890',
displayOptions: {
show: {
resource: ['contact'],
operation: ['create'],
},
},
default: '',
routing: {
send: {
type: 'body',
property: 'phone',
},
},
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['contact'],
operation: ['create'],
},
},
options: [
{
displayName: 'Address',
name: 'address1',
type: 'string',
default: '',
routing: {
send: {
type: 'body',
property: 'address1',
},
},
},
{
displayName: 'City',
name: 'city',
type: 'string',
default: '',
routing: {
send: {
type: 'body',
property: 'city',
},
},
},
customFields,
{
displayName: 'Do Not Disturb',
name: 'dnd',
description:
'Whether automated/manual outbound messages are permitted to go out or not. True means NO outbound messages are permitted.',
type: 'boolean',
default: false,
routing: {
send: {
type: 'body',
property: 'dnd',
},
},
},
{
displayName: 'First Name',
name: 'firstName',
type: 'string',
default: '',
routing: {
send: {
type: 'body',
property: 'firstName',
},
},
},
{
displayName: 'Last Name',
name: 'lastName',
type: 'string',
default: '',
routing: {
send: {
type: 'body',
property: 'lastName',
},
},
},
{
displayName: 'Name',
name: 'name',
type: 'string',
default: 'e.g. John Deo',
description:
"The full name of the contact, will be overwritten by 'First Name' and 'Last Name' if set",
routing: {
send: {
type: 'body',
property: 'name',
},
},
},
{
displayName: 'Postal Code',
name: 'postalCode',
type: 'string',
default: '',
routing: {
send: {
type: 'body',
property: 'postalCode',
},
},
},
{
displayName: 'Source',
name: 'source',
type: 'string',
default: '',
placeholder: 'e.g. Public API',
routing: {
send: {
type: 'body',
property: 'source',
},
},
},
{
displayName: 'State',
name: 'state',
type: 'string',
default: '',
routing: {
send: {
type: 'body',
property: 'state',
},
},
},
{
displayName: 'Tags',
name: 'tags',
type: 'string',
hint: 'Comma separated list of tags, array of strings can be set in expression',
default: '',
routing: {
send: {
type: 'body',
property: 'tags',
},
},
},
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Timezone',
name: 'timezone',
type: 'options',
default: '',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
typeOptions: {
loadOptionsMethod: 'getTimezones',
},
routing: {
send: {
type: 'body',
property: 'timezone',
},
},
},
{
displayName: 'Website',
name: 'website',
type: 'string',
default: '',
routing: {
send: {
type: 'body',
property: 'website',
},
},
},
],
},
];
const updateProperties: INodeProperties[] = [
{
displayName: 'Contact ID',
name: 'contactId',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['contact'],
operation: ['update'],
},
},
default: '',
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['contact'],
operation: ['update'],
},
},
options: [
{
displayName: 'Address',
name: 'address1',
type: 'string',
default: '',
routing: {
send: {
type: 'body',
property: 'address1',
},
},
},
{
displayName: 'City',
name: 'city',
type: 'string',
default: '',
routing: {
send: {
type: 'body',
property: 'city',
},
},
},
customFields,
{
displayName: 'Do Not Disturb',
name: 'dnd',
description:
'Whether automated/manual outbound messages are permitted to go out or not. True means NO outbound messages are permitted.',
type: 'boolean',
default: false,
routing: {
send: {
type: 'body',
property: 'dnd',
},
},
},
{
displayName: 'Email',
name: 'email',
type: 'string',
placeholder: 'name@email.com',
default: '',
routing: {
send: {
type: 'body',
property: 'email',
},
},
},
{
displayName: 'First Name',
name: 'firstName',
type: 'string',
default: '',
routing: {
send: {
type: 'body',
property: 'firstName',
},
},
},
{
displayName: 'Last Name',
name: 'lastName',
type: 'string',
default: '',
routing: {
send: {
type: 'body',
property: 'lastName',
},
},
},
{
displayName: 'Name',
name: 'name',
type: 'string',
description:
"The full name of the contact, will be overwritten by 'First Name' and 'Last Name' if set",
default: 'e.g. John Deo',
routing: {
send: {
type: 'body',
property: 'name',
},
},
},
{
displayName: 'Phone',
name: 'phone',
type: 'string',
default: '',
description:
'Phone number has to start with a valid <a href="https://en.wikipedia.org/wiki/List_of_country_calling_codes">country code</a> leading with + sign',
placeholder: '+491234567890',
routing: {
send: {
type: 'body',
property: 'phone',
},
},
},
{
displayName: 'Postal Code',
name: 'postalCode',
type: 'string',
default: '',
routing: {
send: {
type: 'body',
property: 'postalCode',
},
},
},
{
displayName: 'State',
name: 'state',
type: 'string',
default: '',
routing: {
send: {
type: 'body',
property: 'state',
},
},
},
{
displayName: 'Tags',
name: 'tags',
type: 'string',
hint: 'Comma separated list of tags, array of strings can be set in expression',
default: '',
routing: {
send: {
type: 'body',
property: 'tags',
},
},
},
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Timezone',
name: 'timezone',
type: 'options',
default: '',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
typeOptions: {
loadOptionsMethod: 'getTimezones',
},
routing: {
send: {
type: 'body',
property: 'timezone',
},
},
},
{
displayName: 'Website',
name: 'website',
type: 'string',
default: '',
routing: {
send: {
type: 'body',
property: 'website',
},
},
},
],
},
];
const deleteProperties: INodeProperties[] = [
{
displayName: 'Contact ID',
name: 'contactId',
type: 'string',
displayOptions: {
show: {
resource: ['contact'],
operation: ['delete'],
},
},
default: '',
},
];
const getProperties: INodeProperties[] = [
{
displayName: 'Contact ID',
name: 'contactId',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['contact'],
operation: ['get'],
},
},
default: '',
},
];
const getAllProperties: INodeProperties[] = [
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
resource: ['contact'],
operation: ['getAll'],
},
},
default: false,
description: 'Whether to return all results or only up to a given limit',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
resource: ['contact'],
operation: ['getAll'],
returnAll: [false],
},
},
typeOptions: {
minValue: 1,
maxValue: 100,
},
default: 20,
routing: {
send: {
type: 'query',
property: 'limit',
},
output: {
maxResults: '={{$value}}', // Set maxResults to the value of current parameter
},
},
description: 'Max number of results to return',
},
{
displayName: 'Filters',
name: 'filters',
type: 'collection',
placeholder: 'Add Filter',
default: {},
displayOptions: {
show: {
resource: ['contact'],
operation: ['getAll'],
},
},
options: [
{
displayName: 'Query',
name: 'query',
type: 'string',
default: '',
description:
'Query will search on these fields: Name, Phone, Email, Tags, and Company Name',
routing: {
send: {
type: 'query',
property: 'query',
},
},
},
],
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
resource: ['contact'],
operation: ['getAll'],
},
},
options: [
{
displayName: 'Order',
name: 'order',
type: 'options',
options: [
{
name: 'Descending',
value: 'desc',
},
{
name: 'Ascending',
value: 'asc',
},
],
default: 'desc',
routing: {
send: {
type: 'query',
property: 'order',
},
},
},
{
displayName: 'Sort By',
name: 'sortBy',
type: 'options',
options: [
{
name: 'Date Added',
value: 'date_added',
},
{
name: 'Date Updated',
value: 'date_updated',
},
],
default: 'date_added',
routing: {
send: {
type: 'query',
property: 'sortBy',
},
},
},
],
},
];
const lookupProperties: INodeProperties[] = [
{
displayName: 'Email',
name: 'email',
type: 'string',
placeholder: 'name@email.com',
description:
'Lookup Contact by Email. If Email is not found it will try to find a contact by phone.',
displayOptions: {
show: {
resource: ['contact'],
operation: ['lookup'],
},
},
default: '',
},
{
displayName: 'Phone',
name: 'phone',
type: 'string',
description:
'Lookup Contact by Phone. It will first try to find a contact by Email and than by Phone.',
displayOptions: {
show: {
resource: ['contact'],
operation: ['lookup'],
},
},
default: '',
},
];
export const contactFields: INodeProperties[] = [
...createProperties,
...updateProperties,
...deleteProperties,
...getProperties,
...getAllProperties,
...lookupProperties,
];
@@ -0,0 +1,740 @@
import { INodeProperties } from 'n8n-workflow';
import {
contactIdentifierPreSendAction,
dateTimeToEpochPreSendAction,
opportunityUpdatePreSendAction,
splitTagsPreSendAction,
} from '../GenericFunctions';
export const opportunityOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['opportunity'],
},
},
options: [
{
name: 'Create',
value: 'create',
routing: {
send: {
preSend: [splitTagsPreSendAction],
},
request: {
method: 'POST',
url: '=/pipelines/{{$parameter.pipelineId}}/opportunities',
},
},
action: 'Create an opportunity',
},
{
name: 'Delete',
value: 'delete',
routing: {
request: {
method: 'DELETE',
url: '=/pipelines/{{$parameter.pipelineId}}/opportunities/{{$parameter.opportunityId}}',
},
output: {
postReceive: [
{
type: 'set',
properties: {
value: '={{ { "success": true } }}',
},
},
],
},
},
action: 'Delete an opportunity',
},
{
name: 'Get',
value: 'get',
routing: {
request: {
method: 'GET',
url: '=/pipelines/{{$parameter.pipelineId}}/opportunities/{{$parameter.opportunityId}}',
},
},
action: 'Get an opportunity',
},
{
name: 'Get All',
value: 'getAll',
routing: {
request: {
method: 'GET',
url: '=/pipelines/{{$parameter.pipelineId}}/opportunities',
},
send: {
paginate: true,
},
},
action: 'Get all opportunities',
},
{
name: 'Update',
value: 'update',
routing: {
request: {
method: 'PUT',
url: '=/pipelines/{{$parameter.pipelineId}}/opportunities/{{$parameter.opportunityId}}',
},
send: {
preSend: [opportunityUpdatePreSendAction, splitTagsPreSendAction],
},
},
action: 'Update an opportunity',
},
],
default: 'create',
},
];
const pipelineId: INodeProperties = {
displayName: 'Pipeline Name or ID',
name: 'pipelineId',
type: 'options',
displayOptions: {
show: {
resource: ['opportunity'],
operation: ['create', 'delete', 'get', 'getAll', 'update'],
},
},
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>',
typeOptions: {
loadOptions: {
routing: {
request: {
url: '/pipelines',
method: 'GET',
},
output: {
postReceive: [
{
type: 'rootProperty',
properties: {
property: 'pipelines',
},
},
{
type: 'setKeyValue',
properties: {
name: '={{$responseItem.name}}',
value: '={{$responseItem.id}}',
},
},
{
type: 'sort',
properties: {
key: 'name',
},
},
],
},
},
},
},
default: '',
};
const createProperties: INodeProperties[] = [
{
displayName: 'Stage Name or ID',
name: 'stageId',
type: 'options',
required: true,
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
displayOptions: {
show: {
resource: ['opportunity'],
operation: ['create'],
},
},
default: '',
typeOptions: {
loadOptionsDependsOn: ['pipelineId'],
loadOptionsMethod: 'getPipelineStages',
},
routing: {
send: {
type: 'body',
property: 'stageId',
},
},
},
{
displayName: 'Contact Identifier',
name: 'contactIdentifier',
required: true,
type: 'string',
description: 'Either Email, Phone or Contact ID',
hint: 'There can only be one opportunity for each contact.',
displayOptions: {
show: {
resource: ['opportunity'],
operation: ['create'],
},
},
default: '',
routing: {
send: {
preSend: [contactIdentifierPreSendAction],
},
},
},
{
displayName: 'Title',
name: 'title',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['opportunity'],
operation: ['create'],
},
},
default: '',
routing: {
send: {
type: 'body',
property: 'title',
},
},
},
{
displayName: 'Status',
name: 'status',
type: 'options',
required: true,
displayOptions: {
show: {
resource: ['opportunity'],
operation: ['create'],
},
},
options: [
{
name: 'Open',
value: 'open',
},
{
name: 'Won',
value: 'won',
},
{
name: 'Lost',
value: 'lost',
},
{
name: 'Abandoned',
value: 'abandoned',
},
],
default: 'open',
routing: {
send: {
type: 'body',
property: 'status',
},
},
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['opportunity'],
operation: ['create'],
},
},
options: [
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Assigned To',
name: 'assignedTo',
type: 'options',
default: '',
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
description:
'Choose staff member from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
routing: {
send: {
type: 'body',
property: 'assignedTo',
},
},
},
{
displayName: 'Company Name',
name: 'companyName',
type: 'string',
default: '',
routing: {
send: {
type: 'body',
property: 'companyName',
},
},
},
{
displayName: 'Monetary Value',
name: 'monetaryValue',
type: 'number',
default: '',
description: 'Monetary value of lead opportunity',
routing: {
send: {
type: 'body',
property: 'monetaryValue',
},
},
},
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
placeholder: 'e.g. John Deo',
routing: {
send: {
type: 'body',
property: 'name',
},
},
},
{
displayName: 'Tags',
name: 'tags',
type: 'string',
hint: 'Comma separated list of tags, array of strings can be set in expression',
default: '',
routing: {
send: {
type: 'body',
property: 'tags',
},
},
},
],
},
];
const deleteProperties: INodeProperties[] = [
{
displayName: 'Opportunity ID',
name: 'opportunityId',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['opportunity'],
operation: ['delete'],
},
},
default: '',
},
];
const getProperties: INodeProperties[] = [
{
displayName: 'Opportunity ID',
name: 'opportunityId',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['opportunity'],
operation: ['get'],
},
},
default: '',
},
];
const getAllProperties: INodeProperties[] = [
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
resource: ['opportunity'],
operation: ['getAll'],
},
},
default: false,
description: 'Whether to return all results or only up to a given limit',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
resource: ['opportunity'],
operation: ['getAll'],
returnAll: [false],
},
},
typeOptions: {
minValue: 1,
maxValue: 100,
},
default: 20,
routing: {
send: {
type: 'query',
property: 'limit',
},
},
description: 'Max number of results to return',
},
{
displayName: 'Filters',
name: 'filters',
type: 'collection',
placeholder: 'Add Filter',
default: {},
displayOptions: {
show: {
resource: ['opportunity'],
operation: ['getAll'],
},
},
options: [
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Assigned To',
name: 'assignedTo',
type: 'options',
default: '',
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
description:
'Choose staff member from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
routing: {
send: {
type: 'query',
property: 'assignedTo',
},
},
},
{
displayName: 'Campaign ID',
name: 'campaignId',
type: 'string',
default: '',
routing: {
send: {
type: 'query',
property: 'campaignId',
},
},
},
{
displayName: 'End Date',
name: 'endDate',
type: 'dateTime',
default: '',
routing: {
send: {
type: 'query',
property: 'endDate',
preSend: [dateTimeToEpochPreSendAction],
},
},
},
// api should filter by monetary value but doesn't
// {
// displayName: 'Monetary Value',
// name: 'monetaryValue',
// type: 'number',
// default: '',
// routing: {
// send: {
// type: 'query',
// property: 'monetaryValue',
// },
// },
// },
{
displayName: 'Stage Name or ID',
name: 'stageId',
type: 'options',
default: '',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
typeOptions: {
loadOptionsDependsOn: ['pipelineId'],
loadOptionsMethod: 'getPipelineStages',
},
routing: {
send: {
type: 'query',
property: 'stageId',
},
},
},
{
displayName: 'Start Date',
name: 'startDate',
type: 'dateTime',
default: '',
routing: {
send: {
type: 'query',
property: 'startDate',
preSend: [dateTimeToEpochPreSendAction],
},
},
},
{
displayName: 'Status',
name: 'status',
type: 'options',
options: [
{
name: 'Open',
value: 'open',
},
{
name: 'Won',
value: 'won',
},
{
name: 'Lost',
value: 'lost',
},
{
name: 'Abandoned',
value: 'abandoned',
},
],
default: 'open',
routing: {
send: {
type: 'query',
property: 'status',
},
},
},
{
displayName: 'Query',
name: 'query',
type: 'string',
default: '',
description:
'Query will search on these fields: Name, Phone, Email, Tags, and Company Name',
routing: {
send: {
type: 'query',
property: 'query',
},
},
},
],
},
];
const updateProperties: INodeProperties[] = [
{
displayName: 'Opportunity ID',
name: 'opportunityId',
type: 'string',
required: true,
hint: 'You cannot update an opportunity\'s pipeline ID.',
displayOptions: {
show: {
resource: ['opportunity'],
operation: ['update'],
},
},
default: '',
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['opportunity'],
operation: ['update'],
},
},
options: [
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Assigned To',
name: 'assignedTo',
type: 'options',
default: '',
// eslint-disable-next-line n8n-nodes-base/node-param-description-wrong-for-dynamic-options
description:
'Choose staff member from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
routing: {
send: {
type: 'body',
property: 'assignedTo',
},
},
},
{
displayName: 'Company Name',
name: 'companyName',
type: 'string',
default: '',
routing: {
send: {
type: 'body',
property: 'companyName',
},
},
},
{
displayName: 'Contact Identifier',
name: 'contactIdentifier',
type: 'string',
description: 'Either Email, Phone or Contact ID',
hint: 'There can only be one opportunity for each contact.',
default: '',
routing: {
send: {
preSend: [contactIdentifierPreSendAction],
},
},
},
{
displayName: 'Monetary Value',
name: 'monetaryValue',
type: 'number',
default: '',
description: 'Monetary value of lead opportunity',
routing: {
send: {
type: 'body',
property: 'monetaryValue',
},
},
},
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
placeholder: 'e.g. John Deo',
routing: {
send: {
type: 'body',
property: 'name',
},
},
},
{
displayName: 'Stage Name or ID',
name: 'stageId',
type: 'options',
default: '',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
typeOptions: {
loadOptionsDependsOn: ['pipelineId'],
loadOptionsMethod: 'getPipelineStages',
},
routing: {
send: {
type: 'body',
property: 'stageId',
},
},
},
{
displayName: 'Status',
name: 'status',
type: 'options',
options: [
{
name: 'Open',
value: 'open',
},
{
name: 'Won',
value: 'won',
},
{
name: 'Lost',
value: 'lost',
},
{
name: 'Abandoned',
value: 'abandoned',
},
],
default: 'open',
routing: {
send: {
type: 'body',
property: 'status',
},
},
},
{
displayName: 'Title',
name: 'title',
type: 'string',
default: '',
routing: {
send: {
type: 'body',
property: 'title',
},
},
},
{
displayName: 'Tags',
name: 'tags',
type: 'string',
hint: 'Comma separated list of tags, array of strings can be set in expression',
default: '',
routing: {
send: {
type: 'body',
property: 'tags',
},
},
},
],
},
];
export const opportunityFields: INodeProperties[] = [
pipelineId,
...createProperties,
...updateProperties,
...deleteProperties,
...getProperties,
...getAllProperties,
];
@@ -0,0 +1,475 @@
import { INodeProperties } from 'n8n-workflow';
import { dueDatePreSendAction, taskPostReceiceAction, taskUpdatePreSendAction } from '../GenericFunctions';
export const taskOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['task'],
},
},
options: [
{
name: 'Create',
value: 'create',
routing: {
request: {
method: 'POST',
url: '=/contacts/{{$parameter.contactId}}/tasks',
},
output: {
postReceive: [taskPostReceiceAction],
},
},
action: 'Create a task',
},
{
name: 'Delete',
value: 'delete',
routing: {
request: {
method: 'DELETE',
url: '=/contacts/{{$parameter.contactId}}/tasks/{{$parameter.taskId}}',
},
output: {
postReceive: [
{
type: 'set',
properties: {
value: '={{ { "success": true } }}',
},
},
],
},
},
action: 'Delete a task',
},
{
name: 'Get',
value: 'get',
routing: {
request: {
method: 'GET',
url: '=/contacts/{{$parameter.contactId}}/tasks/{{$parameter.taskId}}',
},
output: {
postReceive: [taskPostReceiceAction],
},
},
action: 'Get a task',
},
{
name: 'Get All',
value: 'getAll',
routing: {
request: {
method: 'GET',
url: '=/contacts/{{$parameter.contactId}}/tasks',
},
output: {
postReceive: [
{
type: 'rootProperty',
properties: {
property: 'tasks',
},
},
taskPostReceiceAction,
],
},
},
action: 'Get all tasks',
},
{
name: 'Update',
value: 'update',
routing: {
request: {
method: 'PUT',
url: '=/contacts/{{$parameter.contactId}}/tasks/{{$parameter.taskId}}',
},
send: {
preSend: [taskUpdatePreSendAction],
},
output: {
postReceive: [taskPostReceiceAction],
},
},
action: 'Update a task',
},
],
default: 'create',
},
];
const createProperties: INodeProperties[] = [
{
displayName: 'Contact ID',
name: 'contactId',
type: 'string',
displayOptions: {
show: {
resource: ['task'],
operation: ['create'],
},
},
default: '',
required: true,
description: 'Contact the task belongs to',
},
{
displayName: 'Title',
name: 'title',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['task'],
operation: ['create'],
},
},
routing: {
send: {
type: 'body',
property: 'title',
},
},
},
{
displayName: 'Due Date',
name: 'dueDate',
type: 'dateTime',
required: true,
default: '',
displayOptions: {
show: {
resource: ['task'],
operation: ['create'],
},
},
routing: {
send: {
type: 'body',
property: 'dueDate',
preSend: [dueDatePreSendAction],
},
},
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['task'],
operation: ['create'],
},
},
options: [
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Assigned To',
name: 'assignedTo',
type: 'options',
default: '',
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',
},
routing: {
send: {
type: 'body',
property: 'assignedTo',
},
},
},
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
routing: {
send: {
type: 'body',
property: 'description',
},
},
},
{
displayName: 'Status',
name: 'status',
type: 'options',
options: [
{
name: 'Incompleted',
value: 'incompleted',
},
{
name: 'Completed',
value: 'completed',
},
],
default: 'incompleted',
routing: {
send: {
type: 'body',
property: 'status',
},
},
},
],
},
];
const deleteProperties: INodeProperties[] = [
{
displayName: 'Contact ID',
name: 'contactId',
type: 'string',
displayOptions: {
show: {
resource: ['task'],
operation: ['delete'],
},
},
default: '',
required: true,
description: 'Contact the task belongs to',
},
{
displayName: 'Task ID',
name: 'taskId',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['task'],
operation: ['delete'],
},
},
default: '',
},
];
const getProperties: INodeProperties[] = [
{
displayName: 'Contact ID',
name: 'contactId',
type: 'string',
displayOptions: {
show: {
resource: ['task'],
operation: ['get'],
},
},
default: '',
required: true,
description: 'Contact the task belongs to',
},
{
displayName: 'Task ID',
name: 'taskId',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['task'],
operation: ['get'],
},
},
default: '',
},
];
const getAllProperties: INodeProperties[] = [
{
displayName: 'Contact ID',
name: 'contactId',
type: 'string',
displayOptions: {
show: {
resource: ['task'],
operation: ['getAll'],
},
},
default: '',
required: true,
description: 'Contact the task belongs to',
},
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
resource: ['task'],
operation: ['getAll'],
},
},
default: false,
description: 'Whether to return all results or only up to a given limit',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
resource: ['task'],
operation: ['getAll'],
returnAll: [false],
},
},
typeOptions: {
minValue: 1,
maxValue: 100,
},
default: 20,
routing: {
send: {
type: 'query',
property: 'limit',
},
},
description: 'Max number of results to return',
},
];
const updateProperties: INodeProperties[] = [
{
displayName: 'Contact ID',
name: 'contactId',
type: 'string',
displayOptions: {
show: {
resource: ['task'],
operation: ['update'],
},
},
default: '',
required: true,
description: 'Contact the task belongs to',
},
{
displayName: 'Task ID',
name: 'taskId',
type: 'string',
displayOptions: {
show: {
resource: ['task'],
operation: ['update'],
},
},
default: '',
required: true,
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['task'],
operation: ['update'],
},
},
options: [
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Assigned To',
name: 'assignedTo',
type: 'options',
default: '',
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',
},
routing: {
send: {
type: 'body',
property: 'assignedTo',
},
},
},
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
routing: {
send: {
type: 'body',
property: 'description',
},
},
},
{
displayName: 'Due Date',
name: 'dueDate',
type: 'dateTime',
default: '',
routing: {
send: {
type: 'body',
property: 'dueDate',
preSend: [dueDatePreSendAction],
},
},
},
{
displayName: 'Status',
name: 'status',
type: 'options',
options: [
{
name: 'Incompleted',
value: 'incompleted',
},
{
name: 'Completed',
value: 'completed',
},
],
default: 'incompleted',
routing: {
send: {
type: 'body',
property: 'status',
},
},
},
{
displayName: 'Title',
name: 'title',
type: 'string',
default: '',
routing: {
send: {
type: 'body',
property: 'title',
},
},
},
],
},
];
export const taskFields: INodeProperties[] = [
...createProperties,
...updateProperties,
...deleteProperties,
...getProperties,
...getAllProperties,
];
@@ -0,0 +1 @@
<svg id="svg" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="400" height="400" viewBox="0, 0, 400,400"><g id="svgg"><path id="path0" d="M42.102 52.191 C 16.992 77.309,1.219 92.800,0.753 92.800 C 0.141 92.800,0.000 93.100,0.000 94.400 L 0.000 96.000 26.414 96.000 C 50.056 96.000,52.932 96.068,53.814 96.646 L 54.800 97.292 54.800 231.217 L 54.800 365.142 55.854 365.971 C 57.141 366.984,108.058 367.303,110.233 366.312 L 111.303 365.825 111.159 232.212 C 111.080 158.726,111.145 98.240,111.303 97.799 C 112.028 95.782,111.498 95.817,139.335 95.933 C 157.780 96.009,165.423 95.913,165.800 95.600 C 166.901 94.686,171.339 99.321,118.037 45.717 C 99.742 27.319,84.439 12.243,83.820 12.007 C 82.715 11.587,82.119 12.161,42.102 52.191 " stroke="none" fill="#d5b718" fill-rule="evenodd"></path><path id="path1" d="M197.800 141.540 C 196.883 141.838,195.891 142.804,165.596 172.884 C 153.253 185.141,136.639 201.623,128.677 209.511 C 112.398 225.639,112.968 225.025,113.907 225.386 C 114.276 225.527,126.552 225.629,141.189 225.612 C 164.826 225.585,167.901 225.652,168.700 226.213 L 169.600 226.845 169.600 295.804 C 169.600 347.283,169.718 365.021,170.064 365.781 L 170.528 366.800 198.055 366.800 L 225.582 366.800 226.257 365.769 C 226.887 364.808,226.914 360.169,226.664 297.028 C 226.517 259.788,226.511 228.744,226.652 228.042 C 227.158 225.511,226.383 225.576,255.603 225.611 C 270.125 225.629,282.188 225.531,282.409 225.394 C 283.324 224.829,280.075 221.448,249.622 191.285 C 213.380 155.390,216.261 158.259,207.616 149.447 C 201.800 143.518,199.194 141.108,198.738 141.240 C 198.662 141.262,198.240 141.397,197.800 141.540 " stroke="none" fill="#1988e9" fill-rule="evenodd"></path><path id="path2" d="M312.279 12.444 C 311.481 12.908,301.065 23.377,282.200 42.678 C 275.380 49.655,268.560 56.542,267.044 57.982 C 264.748 60.163,251.720 73.289,236.455 88.800 C 231.890 93.439,230.642 95.051,231.290 95.470 C 231.570 95.652,243.455 95.862,257.699 95.939 L 283.598 96.077 284.798 97.198 L 285.997 98.318 285.998 231.584 C 285.998 320.948,286.132 365.099,286.404 365.607 C 286.627 366.024,287.393 366.473,288.105 366.604 C 290.853 367.110,339.750 366.629,340.700 366.086 L 341.600 365.572 341.609 231.886 C 341.618 100.674,341.632 98.181,342.386 97.200 L 343.154 96.200 369.557 96.000 C 389.454 95.849,396.080 95.681,396.444 95.316 C 396.937 94.823,316.158 13.511,314.126 12.455 C 313.091 11.916,313.185 11.916,312.279 12.444 " stroke="none" fill="#34c734" fill-rule="evenodd"></path><path id="path3" d="M0.000 45.600 C 0.000 88.598,0.040 91.200,0.693 91.200 C 1.080 91.200,19.380 73.213,42.053 50.547 C 80.812 11.801,82.773 9.906,83.860 10.171 C 84.883 10.420,93.972 19.287,104.960 30.756 C 106.478 32.340,108.110 33.943,108.586 34.318 C 109.062 34.693,109.789 35.515,110.201 36.144 C 110.990 37.350,113.117 39.600,113.468 39.600 C 113.919 39.600,115.823 41.320,116.480 42.322 C 117.052 43.194,137.821 64.256,140.273 66.450 C 141.118 67.206,154.503 80.845,159.856 86.403 C 161.867 88.492,164.612 91.215,165.956 92.455 C 168.836 95.113,169.355 97.037,167.300 97.431 C 166.695 97.547,154.268 97.678,139.685 97.721 C 116.610 97.790,113.122 97.878,112.791 98.400 C 112.381 99.049,112.236 221.548,112.644 223.068 C 112.843 223.810,118.322 218.518,150.138 186.858 C 200.576 136.667,197.688 139.361,199.830 140.499 C 200.254 140.724,212.120 152.371,226.200 166.382 C 249.504 189.572,257.055 196.963,262.507 201.922 C 263.548 202.869,264.400 203.797,264.400 203.983 C 264.400 204.605,280.893 220.855,281.921 221.246 C 282.658 221.526,283.023 221.491,283.261 221.116 C 283.841 220.201,283.682 98.900,283.100 98.524 C 282.825 98.346,270.594 98.110,255.920 98.000 C 238.930 97.873,229.097 97.655,228.848 97.400 C 226.798 95.305,224.868 97.473,260.767 61.537 C 276.515 45.772,294.170 28.059,300.000 22.176 C 305.830 16.292,311.145 10.970,311.811 10.349 L 313.021 9.220 314.211 9.982 C 314.865 10.401,334.197 29.567,357.172 52.572 C 380.146 75.577,399.181 94.400,399.472 94.400 C 399.906 94.400,400.000 86.049,400.000 47.200 L 400.000 0.000 200.000 0.000 L 0.000 0.000 0.000 45.600 M372.000 97.893 C 352.501 97.965,345.160 98.117,344.500 98.463 L 343.600 98.935 343.568 232.168 L 343.536 365.400 342.664 367.000 L 341.793 368.600 313.640 368.600 L 285.486 368.600 284.643 367.471 L 283.800 366.341 283.600 296.804 C 283.490 258.558,283.250 227.117,283.067 226.933 C 282.701 226.568,229.405 226.461,229.041 226.825 C 228.918 226.949,228.693 258.583,228.542 297.123 C 228.274 365.778,228.252 367.210,227.492 367.898 C 226.188 369.078,170.784 369.184,169.608 368.008 C 168.804 367.204,168.800 366.891,168.800 298.226 C 168.800 229.341,168.767 227.536,167.475 226.714 C 167.214 226.548,154.826 226.409,139.947 226.406 L 112.893 226.400 112.652 227.300 C 112.519 227.795,112.408 259.223,112.405 297.140 C 112.401 359.746,112.341 366.204,111.754 367.440 L 111.109 368.800 83.408 368.800 C 55.990 368.800,55.697 368.792,54.654 367.971 L 53.600 367.142 53.600 232.985Line truncated

After

Width:  |  Height:  |  Size: 9.8 KiB

+4
View File
@@ -138,6 +138,7 @@
"dist/credentials/HarvestApi.credentials.js",
"dist/credentials/HarvestOAuth2Api.credentials.js",
"dist/credentials/HelpScoutOAuth2Api.credentials.js",
"dist/credentials/HighLevelApi.credentials.js",
"dist/credentials/HomeAssistantApi.credentials.js",
"dist/credentials/HttpBasicAuth.credentials.js",
"dist/credentials/HttpDigestAuth.credentials.js",
@@ -476,6 +477,7 @@
"dist/nodes/Harvest/Harvest.node.js",
"dist/nodes/HelpScout/HelpScout.node.js",
"dist/nodes/HelpScout/HelpScoutTrigger.node.js",
"dist/nodes/HighLevel/HighLevel.node.js",
"dist/nodes/HomeAssistant/HomeAssistant.node.js",
"dist/nodes/HtmlExtract/HtmlExtract.node.js",
"dist/nodes/HttpRequest/HttpRequest.node.js",
@@ -808,3 +810,5 @@
]
}
}