first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled

This commit is contained in:
2026-03-17 16:22:57 +03:30
commit 3d5eaf9445
15349 changed files with 2847338 additions and 0 deletions
@@ -0,0 +1,387 @@
import type { INodeProperties } from 'n8n-workflow';
export const calendarOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
displayOptions: {
show: {
resource: ['calendar'],
},
},
options: [
{
name: 'Book Appointment',
value: 'bookAppointment',
action: 'Book appointment in a calendar',
routing: {
request: {
method: 'POST',
url: '=/calendars/events/appointments',
},
},
},
{
name: 'Get Free Slots',
value: 'getFreeSlots',
action: 'Get free slots of a calendar',
routing: {
request: {
method: 'GET',
url: '=/calendars/{{$parameter.calendarId}}/free-slots',
},
},
},
],
default: 'bookAppointment',
noDataExpression: true,
},
];
const bookAppointmentProperties: INodeProperties[] = [
{
displayName: 'Calendar ID',
name: 'calendarId',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['calendar'],
operation: ['bookAppointment'],
},
},
default: '',
routing: {
send: {
type: 'body',
property: 'calendarId',
},
},
},
{
displayName: 'Location ID',
name: 'locationId',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['calendar'],
operation: ['bookAppointment'],
},
},
default: '',
routing: {
send: {
type: 'body',
property: 'locationId',
},
},
},
{
displayName: 'Contact ID',
name: 'contactId',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['calendar'],
operation: ['bookAppointment'],
},
},
default: '',
routing: {
send: {
type: 'body',
property: 'contactId',
},
},
},
{
displayName: 'Start Time',
name: 'startTime',
type: 'string',
required: true,
description: 'Example: 2021-06-23T03:30:00+05:30',
displayOptions: {
show: {
resource: ['calendar'],
operation: ['bookAppointment'],
},
},
default: '',
routing: {
send: {
type: 'body',
property: 'startTime',
},
},
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['calendar'],
operation: ['bookAppointment'],
},
},
options: [
{
displayName: 'End Time',
name: 'endTime',
type: 'string',
description: 'Example: 2021-06-23T04:30:00+05:30',
default: '',
routing: {
send: {
type: 'body',
property: 'endTime',
},
},
},
{
displayName: 'Title',
name: 'title',
type: 'string',
default: '',
routing: {
send: {
type: 'body',
property: 'title',
},
},
},
{
displayName: 'Appointment Status',
name: 'appointmentStatus',
type: 'options',
default: 'new',
description:
'The status of the appointment. Allowed values: new, confirmed, cancelled, showed, noshow, invalid.',
options: [
{
name: 'Cancelled',
value: 'cancelled',
},
{
name: 'Confirmed',
value: 'confirmed',
},
{
name: 'Invalid',
value: 'invalid',
},
{
name: 'New',
value: 'new',
},
{
name: 'No Show',
value: 'noshow',
},
{
name: 'Showed',
value: 'showed',
},
],
routing: {
send: {
type: 'body',
property: 'appointmentStatus',
},
},
},
{
displayName: 'Assigned User ID',
name: 'assignedUserId',
type: 'string',
default: '',
routing: {
send: {
type: 'body',
property: 'assignedUserId',
},
},
},
{
displayName: 'Address',
name: 'address',
type: 'string',
default: '',
routing: {
send: {
type: 'body',
property: 'address',
},
},
},
{
displayName: 'Ignore Date Range',
name: 'ignoreDateRange',
type: 'boolean',
default: false,
routing: {
send: {
type: 'body',
property: 'ignoreDateRange',
},
},
},
{
displayName: 'Notify',
name: 'toNotify',
type: 'boolean',
default: true,
routing: {
send: {
type: 'body',
property: 'toNotify',
},
},
},
],
},
];
const getFreeSlotsProperties: INodeProperties[] = [
{
displayName: 'Calendar ID',
name: 'calendarId',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['calendar'],
operation: ['getFreeSlots'],
},
},
default: '',
},
{
displayName: 'Start Date',
name: 'startDate',
type: 'number',
//type: 'dateTime' TODO
default: '',
required: true,
description: 'The start date for fetching free calendar slots. Example: 1548898600000.',
displayOptions: {
show: {
resource: ['calendar'],
operation: ['getFreeSlots'],
},
},
routing: {
send: {
type: 'query',
property: 'startDate',
},
},
},
{
displayName: 'End Date',
name: 'endDate',
type: 'number',
//type: 'dateTime' TODO
default: '',
required: true,
description: 'The end date for fetching free calendar slots. Example: 1601490599999.',
displayOptions: {
show: {
resource: ['calendar'],
operation: ['getFreeSlots'],
},
},
routing: {
send: {
type: 'query',
property: 'endDate',
},
},
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['calendar'],
operation: ['getFreeSlots'],
},
},
options: [
{
displayName: 'Timezone',
name: 'timezone',
type: 'string',
default: '',
description: 'The timezone to use for the returned slots. Example: America/Chihuahua.',
routing: {
send: {
type: 'query',
property: 'timezone',
},
},
},
{
displayName: 'User ID',
name: 'userId',
type: 'string',
default: '',
description: 'User ID to filter the slots (optional)',
routing: {
send: {
type: 'query',
property: 'userId',
},
},
},
{
displayName: 'User IDs',
name: 'userIds',
type: 'collection',
default: {},
options: [
{
displayName: 'User IDs',
name: 'userIds',
type: 'string',
default: '',
description: 'Comma-separated list of user IDs to filter the slots',
routing: {
send: {
type: 'query',
property: 'userIds',
},
},
},
],
},
{
displayName: 'Apply Look Busy',
name: 'enableLookBusy',
type: 'boolean',
default: false,
// eslint-disable-next-line n8n-nodes-base/node-param-description-boolean-without-whether
description: 'Apply Look Busy to the slots',
routing: {
send: {
type: 'query',
property: 'enableLookBusy',
},
},
},
],
},
];
export const calendarFields: INodeProperties[] = [
...bookAppointmentProperties,
...getFreeSlotsProperties,
];
@@ -0,0 +1,871 @@
import type { INodeProperties } from 'n8n-workflow';
import {
addCustomFieldsPreSendAction,
addLocationIdPreSendAction,
addNotePostReceiveAction,
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/upsert/',
},
send: {
preSend: [
validEmailAndPhonePreSendAction,
splitTagsPreSendAction,
addLocationIdPreSendAction,
addCustomFieldsPreSendAction,
],
},
output: {
postReceive: [
{
type: 'rootProperty',
properties: {
property: 'contact',
},
},
addNotePostReceiveAction,
],
},
},
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 Many',
value: 'getAll',
routing: {
request: {
method: 'GET',
url: '=/contacts/',
},
send: {
preSend: [addLocationIdPreSendAction],
paginate: true,
},
},
action: 'Get many contacts',
},
{
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',
required: true,
type: 'resourceLocator',
default: '',
description: 'Choose from the list, or specify an ID using an expression',
modes: [
{
displayName: 'List',
name: 'list',
type: 'list',
typeOptions: {
searchListMethod: 'searchCustomFields',
searchable: true,
},
},
{
displayName: 'ID',
name: 'id',
type: 'string',
placeholder: 'Enter Custom Field ID',
},
],
},
{
displayName: 'Field Value',
name: 'fieldValue',
type: 'string',
default: '',
routing: {
send: {
type: 'body',
property: 'customFields',
value:
'={{ $parent.values.map(field => ({ fieldId: { id: field.fieldId.id }, field_value: field.fieldValue })) }}',
},
},
},
],
},
],
routing: {
send: {
type: 'body',
property: 'customFields',
},
},
};
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: 'Note',
name: 'notes',
type: 'string',
default: '',
},
{
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',
},
},
},
{
displayName: 'Timezone',
name: 'timezone',
placeholder: 'Select Timezone',
type: 'resourceLocator',
default: '',
description: 'Choose from the list, or specify a timezone using an expression',
modes: [
{
displayName: 'List',
name: 'list',
type: 'list',
typeOptions: {
searchListMethod: 'searchTimezones',
searchable: true,
},
},
{
displayName: 'ID',
name: 'id',
type: 'string',
placeholder: 'Enter Timezone ID',
},
],
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',
},
},
},
{
displayName: 'Timezone',
name: 'timezone',
placeholder: 'Select Timezone',
type: 'resourceLocator',
default: '',
description: 'Choose from the list, or specify a timezone using an expression',
modes: [
{
displayName: 'List',
name: 'list',
type: 'list',
typeOptions: {
searchListMethod: 'searchTimezones',
searchable: true,
},
},
{
displayName: 'ID',
name: 'id',
type: 'string',
placeholder: 'Enter Timezone ID',
},
],
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',
required: true,
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,
},
default: 50,
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,669 @@
import type { INodeProperties } from 'n8n-workflow';
import {
addLocationIdPreSendAction,
dateTimeToEpochPreSendAction,
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, addLocationIdPreSendAction],
},
request: {
method: 'POST',
url: '/opportunities/',
},
},
action: 'Create an opportunity',
},
{
name: 'Delete',
value: 'delete',
routing: {
request: {
method: 'DELETE',
url: '=/opportunities/{{$parameter.opportunityId}}',
},
output: {
postReceive: [
{
type: 'set',
properties: {
value: '={{ { "success": true } }}',
},
},
],
},
},
action: 'Delete an opportunity',
},
{
name: 'Get',
value: 'get',
routing: {
request: {
method: 'GET',
url: '=/opportunities/{{$parameter.opportunityId}}',
},
},
action: 'Get an opportunity',
},
{
name: 'Get Many',
value: 'getAll',
routing: {
request: {
method: 'GET',
url: '/opportunities/search',
},
send: {
preSend: [addLocationIdPreSendAction],
paginate: true,
},
},
action: 'Get many opportunities',
},
{
name: 'Update',
value: 'update',
routing: {
request: {
method: 'PUT',
url: '=/opportunities/{{$parameter.opportunityId}}',
},
},
action: 'Update an opportunity',
},
],
default: 'create',
},
];
const pipelineId: INodeProperties = {
displayName: 'Pipeline Name or ID',
name: 'pipelineId',
type: 'options',
displayOptions: {
show: {
resource: ['opportunity'],
operation: ['create'],
},
},
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
typeOptions: {
loadOptionsMethod: 'getPipelines',
},
routing: {
send: {
type: 'body',
property: 'pipelineId',
},
},
default: '',
};
const createProperties: INodeProperties[] = [
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Contact Email or ID',
name: 'contactId',
required: true,
type: 'options',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
hint: 'There can only be one opportunity for each contact',
displayOptions: {
show: {
resource: ['opportunity'],
operation: ['create'],
},
},
typeOptions: {
loadOptionsMethod: 'getContacts',
},
default: '',
routing: {
send: {
type: 'body',
property: 'contactId',
},
},
},
{
displayName: 'Name',
name: 'name',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['opportunity'],
operation: ['create'],
},
},
default: '',
routing: {
send: {
type: 'body',
property: 'name',
},
},
},
{
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: '',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/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: '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',
},
},
},
{
displayName: 'Stage Name or ID',
name: 'stageId',
type: 'options',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
default: '',
typeOptions: {
loadOptionsDependsOn: ['/pipelineId'],
loadOptionsMethod: 'getPipelineStages',
},
routing: {
send: {
type: 'body',
property: 'pipelineStageId',
},
},
},
],
},
];
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: '',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
routing: {
send: {
type: 'query',
property: 'assigned_to',
},
},
},
{
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],
},
},
},
{
displayName: 'Pipeline Name or ID',
name: 'pipelineId',
type: 'options',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
typeOptions: {
loadOptionsMethod: 'getPipelines',
},
routing: {
send: {
type: 'query',
property: 'pipeline_id',
},
},
default: '',
},
{
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/expressions/">expression</a>',
hint: "Select 'Pipeline Name or ID' first to see stages",
typeOptions: {
loadOptionsDependsOn: ['pipelineId'],
loadOptionsMethod: 'getPipelineStages',
},
routing: {
send: {
type: 'query',
property: 'pipeline_stage_id',
},
},
},
{
displayName: 'Start Date',
name: 'startDate',
type: 'dateTime',
default: '',
routing: {
send: {
type: 'query',
property: 'date',
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: 'q',
},
},
},
],
},
];
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: '',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
routing: {
send: {
type: 'body',
property: 'assignedTo',
},
},
},
{
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: 'Pipeline Name or ID',
name: 'pipelineId',
type: 'options',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
typeOptions: {
loadOptionsMethod: 'getPipelines',
},
routing: {
send: {
type: 'body',
property: 'pipelineId',
},
},
default: '',
},
{
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/expressions/">expression</a>',
hint: "Select 'Pipeline Name or ID' first to see stages",
typeOptions: {
loadOptionsDependsOn: ['pipelineId'],
loadOptionsMethod: 'getPipelineStages',
},
routing: {
send: {
type: 'body',
property: 'pipelineStageId',
},
},
},
{
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',
},
},
},
],
},
];
export const opportunityFields: INodeProperties[] = [
pipelineId,
...createProperties,
...updateProperties,
...deleteProperties,
...getProperties,
...getAllProperties,
];
@@ -0,0 +1,491 @@
import type { 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 Many',
value: 'getAll',
routing: {
request: {
method: 'GET',
url: '=/contacts/{{$parameter.contactId}}/tasks/',
},
output: {
postReceive: [
{
type: 'rootProperty',
properties: {
property: 'tasks',
},
},
taskPostReceiceAction,
],
},
},
action: 'Get many 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[] = [
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Contact Email or ID',
name: 'contactId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getContacts',
},
displayOptions: {
show: {
resource: ['task'],
operation: ['create'],
},
},
default: '',
required: true,
description:
'Contact the task belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
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: 'Completed',
name: 'completed',
type: 'boolean',
required: true,
default: false,
displayOptions: {
show: {
resource: ['task'],
operation: ['create'],
},
},
routing: {
send: {
type: 'body',
property: 'completed',
},
},
},
{
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/expressions/">expression</a>',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
routing: {
send: {
type: 'body',
property: 'assignedTo',
},
},
},
{
displayName: 'Body',
name: 'body',
type: 'string',
default: '',
routing: {
send: {
type: 'body',
property: 'body',
},
},
},
],
},
];
const deleteProperties: INodeProperties[] = [
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Contact Email or ID',
name: 'contactId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getContacts',
},
displayOptions: {
show: {
resource: ['task'],
operation: ['delete'],
},
},
default: '',
required: true,
description:
'Contact the task belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Task ID',
name: 'taskId',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['task'],
operation: ['delete'],
},
},
default: '',
},
];
const getProperties: INodeProperties[] = [
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Contact Email or ID',
name: 'contactId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getContacts',
},
displayOptions: {
show: {
resource: ['task'],
operation: ['get'],
},
},
default: '',
required: true,
description:
'Contact the task belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Task ID',
name: 'taskId',
type: 'string',
required: true,
displayOptions: {
show: {
resource: ['task'],
operation: ['get'],
},
},
default: '',
},
];
const getAllProperties: INodeProperties[] = [
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Contact Email or ID',
name: 'contactId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getContacts',
},
displayOptions: {
show: {
resource: ['task'],
operation: ['getAll'],
},
},
default: '',
required: true,
description:
'Contact the task belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
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[] = [
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-options
displayName: 'Contact Email or ID',
name: 'contactId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getContacts',
},
displayOptions: {
show: {
resource: ['task'],
operation: ['update'],
},
},
default: '',
required: true,
description:
'Contact the task belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
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/expressions/">expression</a>',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
routing: {
send: {
type: 'body',
property: 'assignedTo',
},
},
},
{
displayName: 'Completed',
name: 'completed',
type: 'boolean',
default: false,
routing: {
send: {
type: 'body',
property: 'completed',
},
},
},
{
displayName: 'Body',
name: 'body',
type: 'string',
default: '',
routing: {
send: {
type: 'body',
property: 'body',
},
},
},
{
displayName: 'Due Date',
name: 'dueDate',
type: 'dateTime',
default: '',
routing: {
send: {
type: 'body',
property: 'dueDate',
preSend: [dueDatePreSendAction],
},
},
},
{
displayName: 'Title',
name: 'title',
type: 'string',
default: '',
routing: {
send: {
type: 'body',
property: 'title',
},
},
},
],
},
];
export const taskFields: INodeProperties[] = [
...createProperties,
...updateProperties,
...deleteProperties,
...getProperties,
...getAllProperties,
];