n8n/packages/nodes-base/nodes/HighLevel/HighLevel.node.ts
Marcus c2e97a89f9
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>
2022-08-30 11:25:06 +02:00

89 lines
1.8 KiB
TypeScript

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,
},
};
}