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,19 @@
{
"node": "n8n-nodes-base.freshworksCrm",
"nodeVersion": "1.0",
"codexVersion": "1.0",
"categories": ["Marketing", "Sales"],
"resources": {
"credentialDocumentation": [
{
"url": "https://docs.n8n.io/integrations/builtin/credentials/freshworkscrm/"
}
],
"primaryDocumentation": [
{
"url": "https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.freshworkscrm/"
}
]
},
"alias": ["Freshdesk"]
}
@@ -0,0 +1,998 @@
import { tz } from 'moment-timezone';
import {
type IExecuteFunctions,
type IDataObject,
type ILoadOptionsFunctions,
type INodeExecutionData,
type INodeType,
type INodeTypeDescription,
NodeConnectionTypes,
} from 'n8n-workflow';
import {
accountFields,
accountOperations,
appointmentFields,
appointmentOperations,
contactFields,
contactOperations,
dealFields,
dealOperations,
noteFields,
noteOperations,
salesActivityFields,
salesActivityOperations,
searchFields,
searchOperations,
taskFields,
taskOperations,
} from './descriptions';
import {
adjustAccounts,
adjustAttendees,
freshworksCrmApiRequest,
getAllItemsViewId,
handleListing,
loadResource,
throwOnEmptyUpdate,
} from './GenericFunctions';
import type { FreshworksConfigResponse, LoadedCurrency, LoadedUser, LoadOption } from './types';
export class FreshworksCrm implements INodeType {
description: INodeTypeDescription = {
displayName: 'Freshworks CRM',
name: 'freshworksCrm',
icon: 'file:freshworksCrm.svg',
group: ['transform'],
version: 1,
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
description: 'Consume the Freshworks CRM API',
defaults: {
name: 'Freshworks CRM',
},
usableAsTool: true,
inputs: [NodeConnectionTypes.Main],
outputs: [NodeConnectionTypes.Main],
credentials: [
{
name: 'freshworksCrmApi',
required: true,
},
],
properties: [
{
displayName: 'Resource',
name: 'resource',
type: 'options',
noDataExpression: true,
options: [
{
name: 'Account',
value: 'account',
},
{
name: 'Appointment',
value: 'appointment',
},
{
name: 'Contact',
value: 'contact',
},
{
name: 'Deal',
value: 'deal',
},
{
name: 'Note',
value: 'note',
},
{
name: 'Sales Activity',
value: 'salesActivity',
},
{
name: 'Search',
value: 'search',
},
{
name: 'Task',
value: 'task',
},
],
default: 'account',
},
...accountOperations,
...accountFields,
...appointmentOperations,
...appointmentFields,
...contactOperations,
...contactFields,
...dealOperations,
...dealFields,
...noteOperations,
...noteFields,
...salesActivityOperations,
...salesActivityFields,
...searchOperations,
...searchFields,
...taskOperations,
...taskFields,
],
};
methods = {
loadOptions: {
async getAccounts(this: ILoadOptionsFunctions) {
const viewId = await getAllItemsViewId.call(this, { fromLoadOptions: true });
const responseData = await handleListing.call(
this,
'GET',
`/sales_accounts/view/${viewId}`,
);
return responseData.map(({ name, id }) => ({ name, value: id })) as LoadOption[];
},
async getAccountViews(this: ILoadOptionsFunctions) {
const responseData = await handleListing.call(this, 'GET', '/sales_accounts/filters');
return responseData.map(({ name, id }) => ({ name, value: id })) as LoadOption[];
},
async getBusinessTypes(this: ILoadOptionsFunctions) {
return await loadResource.call(this, 'business_types');
},
async getCampaigns(this: ILoadOptionsFunctions) {
return await loadResource.call(this, 'campaigns');
},
async getContactStatuses(this: ILoadOptionsFunctions) {
return await loadResource.call(this, 'contact_statuses');
},
async getContactViews(this: ILoadOptionsFunctions) {
const responseData = await handleListing.call(this, 'GET', '/contacts/filters');
return responseData.map(({ name, id }) => ({ name, value: id })) as LoadOption[];
},
async getCurrencies(this: ILoadOptionsFunctions) {
const response = (await freshworksCrmApiRequest.call(
this,
'GET',
'/selector/currencies',
)) as FreshworksConfigResponse<LoadedCurrency>;
const key = Object.keys(response)[0];
return response[key].map(({ currency_code, id }) => ({ name: currency_code, value: id }));
},
async getDealPaymentStatuses(this: ILoadOptionsFunctions) {
return await loadResource.call(this, 'deal_payment_statuses');
},
async getDealPipelines(this: ILoadOptionsFunctions) {
return await loadResource.call(this, 'deal_pipelines');
},
async getDealProducts(this: ILoadOptionsFunctions) {
return await loadResource.call(this, 'deal_products');
},
async getDealReasons(this: ILoadOptionsFunctions) {
return await loadResource.call(this, 'deal_reasons');
},
async getDealStages(this: ILoadOptionsFunctions) {
return await loadResource.call(this, 'deal_stages');
},
async getDealTypes(this: ILoadOptionsFunctions) {
return await loadResource.call(this, 'deal_types');
},
async getDealViews(this: ILoadOptionsFunctions) {
const responseData = await handleListing.call(this, 'GET', '/deals/filters');
return responseData.map(({ name, id }) => ({ name, value: id })) as LoadOption[];
},
async getIndustryTypes(this: ILoadOptionsFunctions) {
return await loadResource.call(this, 'industry_types');
},
async getLifecycleStages(this: ILoadOptionsFunctions) {
return await loadResource.call(this, 'lifecycle_stages');
},
async getOutcomes(this: ILoadOptionsFunctions) {
return await loadResource.call(this, 'sales_activity_outcomes');
},
async getSalesActivityTypes(this: ILoadOptionsFunctions) {
return await loadResource.call(this, 'sales_activity_types');
},
async getTerritories(this: ILoadOptionsFunctions) {
return await loadResource.call(this, 'territories');
},
async getUsers(this: ILoadOptionsFunctions) {
// for attendees, owners, and creators
const response = (await freshworksCrmApiRequest.call(
this,
'GET',
'/selector/owners',
)) as FreshworksConfigResponse<LoadedUser>;
const key = Object.keys(response)[0];
return response[key].map(({ display_name, id }) => ({ name: display_name, value: id }));
},
},
};
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
const items = this.getInputData();
const returnData: INodeExecutionData[] = [];
const resource = this.getNodeParameter('resource', 0);
const operation = this.getNodeParameter('operation', 0);
const defaultTimezone = this.getTimezone();
let responseData;
for (let i = 0; i < items.length; i++) {
try {
if (resource === 'account') {
// **********************************************************************
// account
// **********************************************************************
// https://developers.freshworks.com/crm/api/#accounts
if (operation === 'create') {
// ----------------------------------------
// account: create
// ----------------------------------------
// https://developers.freshworks.com/crm/api/#create_account
const body = {
name: this.getNodeParameter('name', i),
} as IDataObject;
const additionalFields = this.getNodeParameter('additionalFields', i);
if (Object.keys(additionalFields).length) {
Object.assign(body, additionalFields);
}
responseData = await freshworksCrmApiRequest.call(
this,
'POST',
'/sales_accounts',
body,
);
responseData = responseData.sales_account;
} else if (operation === 'delete') {
// ----------------------------------------
// account: delete
// ----------------------------------------
// https://developers.freshworks.com/crm/api/#delete_account
const accountId = this.getNodeParameter('accountId', i);
const endpoint = `/sales_accounts/${accountId}`;
await freshworksCrmApiRequest.call(this, 'DELETE', endpoint);
responseData = { success: true };
} else if (operation === 'get') {
// ----------------------------------------
// account: get
// ----------------------------------------
// https://developers.freshworks.com/crm/api/#view_account
const accountId = this.getNodeParameter('accountId', i);
const endpoint = `/sales_accounts/${accountId}`;
responseData = await freshworksCrmApiRequest.call(this, 'GET', endpoint);
responseData = responseData.sales_account;
} else if (operation === 'getAll') {
// ----------------------------------------
// account: getAll
// ----------------------------------------
// https://developers.freshworks.com/crm/api/#list_all_accounts
const view = this.getNodeParameter('view', i) as string;
responseData = await handleListing.call(this, 'GET', `/sales_accounts/view/${view}`);
} else if (operation === 'update') {
// ----------------------------------------
// account: update
// ----------------------------------------
// https://developers.freshworks.com/crm/api/#update_a_account
const body = {} as IDataObject;
const updateFields = this.getNodeParameter('updateFields', i);
if (Object.keys(updateFields).length) {
Object.assign(body, updateFields);
} else {
throwOnEmptyUpdate.call(this, resource);
}
const accountId = this.getNodeParameter('accountId', i);
const endpoint = `/sales_accounts/${accountId}`;
responseData = await freshworksCrmApiRequest.call(this, 'PUT', endpoint, body);
responseData = responseData.sales_account;
}
} else if (resource === 'appointment') {
// **********************************************************************
// appointment
// **********************************************************************
// https://developers.freshworks.com/crm/api/#appointments
if (operation === 'create') {
// ----------------------------------------
// appointment: create
// ----------------------------------------
// https://developers.freshworks.com/crm/api/#create_appointment
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject & {
time_zone: string;
is_allday: boolean;
};
const startDate = this.getNodeParameter('fromDate', i) as string;
const endDate = this.getNodeParameter('endDate', i) as string;
const attendees = this.getNodeParameter('attendees.attendee', i, []) as [
{ type: string; contactId: string; userId: string },
];
const timezone = additionalFields.time_zone ?? defaultTimezone;
let allDay = false;
if (additionalFields.is_allday) {
allDay = additionalFields.is_allday as boolean;
}
const start = tz(startDate, timezone);
const end = tz(endDate, timezone);
const body = {
title: this.getNodeParameter('title', i),
from_date: start.format(),
end_date: allDay ? start.format() : end.format(),
} as IDataObject;
Object.assign(body, additionalFields);
if (attendees.length) {
body.appointment_attendees_attributes = adjustAttendees(attendees);
}
responseData = await freshworksCrmApiRequest.call(this, 'POST', '/appointments', body);
responseData = responseData.appointment;
} else if (operation === 'delete') {
// ----------------------------------------
// appointment: delete
// ----------------------------------------
// https://developers.freshworks.com/crm/api/#delete_a_appointment
const appointmentId = this.getNodeParameter('appointmentId', i);
const endpoint = `/appointments/${appointmentId}`;
await freshworksCrmApiRequest.call(this, 'DELETE', endpoint);
responseData = { success: true };
} else if (operation === 'get') {
// ----------------------------------------
// appointment: get
// ----------------------------------------
// https://developers.freshworks.com/crm/api/#view_a_appointment
const appointmentId = this.getNodeParameter('appointmentId', i);
const endpoint = `/appointments/${appointmentId}`;
responseData = await freshworksCrmApiRequest.call(this, 'GET', endpoint);
responseData = responseData.appointment;
} else if (operation === 'getAll') {
// ----------------------------------------
// appointment: getAll
// ----------------------------------------
// https://developers.freshworks.com/crm/api/#list_all_appointments
const { filter, include } = this.getNodeParameter('filters', i) as {
filter: string;
include: string[];
};
const qs: IDataObject = {};
if (filter) {
qs.filter = filter;
}
if (include) {
qs.include = include;
}
responseData = await handleListing.call(this, 'GET', '/appointments', {}, qs);
} else if (operation === 'update') {
// ----------------------------------------
// appointment: update
// ----------------------------------------
// https://developers.freshworks.com/crm/api/#update_a_appointment
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject & {
from_date: string;
end_date: string;
time_zone: string;
};
const attendees = this.getNodeParameter('updateFields.attendees.attendee', i, []) as [
{ type: string; contactId: string; userId: string },
];
if (!Object.keys(updateFields).length) {
throwOnEmptyUpdate.call(this, resource);
}
const body = {} as IDataObject;
const { from_date, end_date, ...rest } = updateFields;
const timezone = rest.time_zone ?? defaultTimezone;
if (from_date) {
body.from_date = tz(from_date, timezone).format();
}
if (end_date) {
body.end_date = tz(end_date, timezone).format();
}
Object.assign(body, rest);
if (attendees.length) {
body.appointment_attendees_attributes = adjustAttendees(attendees);
delete body.attendees;
}
const appointmentId = this.getNodeParameter('appointmentId', i);
const endpoint = `/appointments/${appointmentId}`;
responseData = await freshworksCrmApiRequest.call(this, 'PUT', endpoint, body);
responseData = responseData.appointment;
}
} else if (resource === 'contact') {
// **********************************************************************
// contact
// **********************************************************************
// https://developers.freshworks.com/crm/api/#contacts
if (operation === 'create') {
// ----------------------------------------
// contact: create
// ----------------------------------------
// https://developers.freshworks.com/crm/api/#create_contact
const body = {
first_name: this.getNodeParameter('firstName', i),
last_name: this.getNodeParameter('lastName', i),
emails: this.getNodeParameter('emails', i),
} as IDataObject;
const additionalFields = this.getNodeParameter('additionalFields', i);
if (Object.keys(additionalFields).length) {
Object.assign(body, adjustAccounts(additionalFields));
}
responseData = await freshworksCrmApiRequest.call(this, 'POST', '/contacts', body);
responseData = responseData.contact;
} else if (operation === 'delete') {
// ----------------------------------------
// contact: delete
// ----------------------------------------
// https://developers.freshworks.com/crm/api/#delete_a_contact
const contactId = this.getNodeParameter('contactId', i);
const endpoint = `/contacts/${contactId}`;
await freshworksCrmApiRequest.call(this, 'DELETE', endpoint);
responseData = { success: true };
} else if (operation === 'get') {
// ----------------------------------------
// contact: get
// ----------------------------------------
// https://developers.freshworks.com/crm/api/#view_a_contact
const contactId = this.getNodeParameter('contactId', i);
const endpoint = `/contacts/${contactId}`;
responseData = await freshworksCrmApiRequest.call(this, 'GET', endpoint);
responseData = responseData.contact;
} else if (operation === 'getAll') {
// ----------------------------------------
// contact: getAll
// ----------------------------------------
// https://developers.freshworks.com/crm/api/#list_all_contacts
const view = this.getNodeParameter('view', i) as string;
responseData = await handleListing.call(this, 'GET', `/contacts/view/${view}`);
} else if (operation === 'update') {
// ----------------------------------------
// contact: update
// ----------------------------------------
// https://developers.freshworks.com/crm/api/#update_a_contact
const body = {} as IDataObject;
const updateFields = this.getNodeParameter('updateFields', i);
if (Object.keys(updateFields).length) {
Object.assign(body, adjustAccounts(updateFields));
} else {
throwOnEmptyUpdate.call(this, resource);
}
const contactId = this.getNodeParameter('contactId', i);
const endpoint = `/contacts/${contactId}`;
responseData = await freshworksCrmApiRequest.call(this, 'PUT', endpoint, body);
responseData = responseData.contact;
}
} else if (resource === 'deal') {
// **********************************************************************
// deal
// **********************************************************************
// https://developers.freshworks.com/crm/api/#deals
if (operation === 'create') {
// ----------------------------------------
// deal: create
// ----------------------------------------
// https://developers.freshworks.com/crm/api/#create_deal
const body = {
name: this.getNodeParameter('name', i),
amount: this.getNodeParameter('amount', i),
} as IDataObject;
const additionalFields = this.getNodeParameter('additionalFields', i);
if (Object.keys(additionalFields).length) {
Object.assign(body, adjustAccounts(additionalFields));
}
responseData = await freshworksCrmApiRequest.call(this, 'POST', '/deals', body);
responseData = responseData.deal;
} else if (operation === 'delete') {
// ----------------------------------------
// deal: delete
// ----------------------------------------
// https://developers.freshworks.com/crm/api/#delete_a_deal
const dealId = this.getNodeParameter('dealId', i);
await freshworksCrmApiRequest.call(this, 'DELETE', `/deals/${dealId}`);
responseData = { success: true };
} else if (operation === 'get') {
// ----------------------------------------
// deal: get
// ----------------------------------------
// https://developers.freshworks.com/crm/api/#view_a_deal
const dealId = this.getNodeParameter('dealId', i);
responseData = await freshworksCrmApiRequest.call(this, 'GET', `/deals/${dealId}`);
responseData = responseData.deal;
} else if (operation === 'getAll') {
// ----------------------------------------
// deal: getAll
// ----------------------------------------
// https://developers.freshworks.com/crm/api/#list_all_deals
const view = this.getNodeParameter('view', i) as string;
responseData = await handleListing.call(this, 'GET', `/deals/view/${view}`);
} else if (operation === 'update') {
// ----------------------------------------
// deal: update
// ----------------------------------------
// https://developers.freshworks.com/crm/api/#update_a_deal
const body = {} as IDataObject;
const updateFields = this.getNodeParameter('updateFields', i);
if (Object.keys(updateFields).length) {
Object.assign(body, adjustAccounts(updateFields));
} else {
throwOnEmptyUpdate.call(this, resource);
}
const dealId = this.getNodeParameter('dealId', i);
responseData = await freshworksCrmApiRequest.call(
this,
'PUT',
`/deals/${dealId}`,
body,
);
responseData = responseData.deal;
}
} else if (resource === 'note') {
// **********************************************************************
// note
// **********************************************************************
// https://developers.freshworks.com/crm/api/#notes
if (operation === 'create') {
// ----------------------------------------
// note: create
// ----------------------------------------
// https://developers.freshworks.com/crm/api/#create_note
const body = {
description: this.getNodeParameter('description', i),
targetable_id: this.getNodeParameter('targetable_id', i),
targetable_type: this.getNodeParameter('targetableType', i),
} as IDataObject;
responseData = await freshworksCrmApiRequest.call(this, 'POST', '/notes', body);
responseData = responseData.note;
} else if (operation === 'delete') {
// ----------------------------------------
// note: delete
// ----------------------------------------
// https://developers.freshworks.com/crm/api/#delete_a_note
const noteId = this.getNodeParameter('noteId', i);
await freshworksCrmApiRequest.call(this, 'DELETE', `/notes/${noteId}`);
responseData = { success: true };
} else if (operation === 'update') {
// ----------------------------------------
// note: update
// ----------------------------------------
// https://developers.freshworks.com/crm/api/#update_a_note
const body = {} as IDataObject;
const updateFields = this.getNodeParameter('updateFields', i);
if (Object.keys(updateFields).length) {
Object.assign(body, updateFields);
} else {
throwOnEmptyUpdate.call(this, resource);
}
const noteId = this.getNodeParameter('noteId', i);
responseData = await freshworksCrmApiRequest.call(
this,
'PUT',
`/notes/${noteId}`,
body,
);
responseData = responseData.note;
}
} else if (resource === 'salesActivity') {
// **********************************************************************
// salesActivity
// **********************************************************************
// https://developers.freshworks.com/crm/api/#sales-activities
if (operation === 'create') {
// ----------------------------------------
// salesActivity: create
// ----------------------------------------
// https://developers.freshworks.com/crm/api/#create_sales_activity
const startDate = this.getNodeParameter('from_date', i) as string;
const endDate = this.getNodeParameter('end_date', i) as string;
const body = {
sales_activity_type_id: this.getNodeParameter('sales_activity_type_id', i),
title: this.getNodeParameter('title', i),
owner_id: this.getNodeParameter('ownerId', i),
start_date: tz(startDate, defaultTimezone).format(),
end_date: tz(endDate, defaultTimezone).format(),
targetable_type: this.getNodeParameter('targetableType', i),
targetable_id: this.getNodeParameter('targetable_id', i),
} as IDataObject;
const additionalFields = this.getNodeParameter('additionalFields', i);
if (Object.keys(additionalFields).length) {
Object.assign(body, additionalFields);
}
responseData = await freshworksCrmApiRequest.call(this, 'POST', '/sales_activities', {
sales_activity: body,
});
responseData = responseData.sales_activity;
} else if (operation === 'delete') {
// ----------------------------------------
// salesActivity: delete
// ----------------------------------------
// https://developers.freshworks.com/crm/api/#delete_a_sales_activity
const salesActivityId = this.getNodeParameter('salesActivityId', i);
const endpoint = `/sales_activities/${salesActivityId}`;
await freshworksCrmApiRequest.call(this, 'DELETE', endpoint);
responseData = { success: true };
} else if (operation === 'get') {
// ----------------------------------------
// salesActivity: get
// ----------------------------------------
// https://developers.freshworks.com/crm/api/#view_a_sales_activity
const salesActivityId = this.getNodeParameter('salesActivityId', i);
const endpoint = `/sales_activities/${salesActivityId}`;
responseData = await freshworksCrmApiRequest.call(this, 'GET', endpoint);
responseData = responseData.sales_activity;
} else if (operation === 'getAll') {
// ----------------------------------------
// salesActivity: getAll
// ----------------------------------------
// https://developers.freshworks.com/crm/api/#list_all_sales_activities
responseData = await handleListing.call(this, 'GET', '/sales_activities');
} else if (operation === 'update') {
// ----------------------------------------
// salesActivity: update
// ----------------------------------------
// https://developers.freshworks.com/crm/api/#update_a_sales_activity
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject & {
from_date: string;
end_date: string;
time_zone: string;
};
if (!Object.keys(updateFields).length) {
throwOnEmptyUpdate.call(this, resource);
}
const body = {} as IDataObject;
const { from_date, end_date, ...rest } = updateFields;
if (from_date) {
body.from_date = tz(from_date, defaultTimezone).format();
}
if (end_date) {
body.end_date = tz(end_date, defaultTimezone).format();
}
if (Object.keys(rest).length) {
Object.assign(body, rest);
}
const salesActivityId = this.getNodeParameter('salesActivityId', i);
const endpoint = `/sales_activities/${salesActivityId}`;
responseData = await freshworksCrmApiRequest.call(this, 'PUT', endpoint, body);
responseData = responseData.sales_activity;
}
} else if (resource === 'search') {
// **********************************************************************
// search
// **********************************************************************
if (operation === 'query') {
// https://developers.freshworks.com/crm/api/#search
const query = this.getNodeParameter('query', i) as string;
let entities = this.getNodeParameter('entities', i);
const returnAll = this.getNodeParameter('returnAll', 0, false);
if (Array.isArray(entities)) {
entities = entities.join(',');
}
const qs: IDataObject = {
q: query,
include: entities,
per_page: 100,
};
responseData = await freshworksCrmApiRequest.call(this, 'GET', '/search', {}, qs);
if (!returnAll) {
const limit = this.getNodeParameter('limit', 0);
responseData = responseData.slice(0, limit);
}
}
if (operation === 'lookup') {
// https://developers.freshworks.com/crm/api/#lookup_search
let searchField = this.getNodeParameter('searchField', i) as string;
let fieldValue = this.getNodeParameter('fieldValue', i, '') as string;
let entities = this.getNodeParameter('options.entities', i) as string;
if (Array.isArray(entities)) {
entities = entities.join(',');
}
if (searchField === 'customField') {
searchField = this.getNodeParameter('customFieldName', i) as string;
fieldValue = this.getNodeParameter('customFieldValue', i) as string;
}
const qs: IDataObject = {
q: fieldValue,
f: searchField,
entities,
};
responseData = await freshworksCrmApiRequest.call(this, 'GET', '/lookup', {}, qs);
}
} else if (resource === 'task') {
// **********************************************************************
// task
// **********************************************************************
// https://developers.freshworks.com/crm/api/#tasks
if (operation === 'create') {
// ----------------------------------------
// task: create
// ----------------------------------------
// https://developers.freshworks.com/crm/api/#create_task
const dueDate = this.getNodeParameter('dueDate', i);
const body = {
title: this.getNodeParameter('title', i),
owner_id: this.getNodeParameter('ownerId', i),
due_date: tz(dueDate, defaultTimezone).format(),
targetable_type: this.getNodeParameter('targetableType', i),
targetable_id: this.getNodeParameter('targetable_id', i),
} as IDataObject;
const additionalFields = this.getNodeParameter('additionalFields', i);
if (Object.keys(additionalFields).length) {
Object.assign(body, additionalFields);
}
responseData = await freshworksCrmApiRequest.call(this, 'POST', '/tasks', body);
responseData = responseData.task;
} else if (operation === 'delete') {
// ----------------------------------------
// task: delete
// ----------------------------------------
// https://developers.freshworks.com/crm/api/#delete_a_task
const taskId = this.getNodeParameter('taskId', i);
await freshworksCrmApiRequest.call(this, 'DELETE', `/tasks/${taskId}`);
responseData = { success: true };
} else if (operation === 'get') {
// ----------------------------------------
// task: get
// ----------------------------------------
// https://developers.freshworks.com/crm/api/#view_a_task
const taskId = this.getNodeParameter('taskId', i);
responseData = await freshworksCrmApiRequest.call(this, 'GET', `/tasks/${taskId}`);
responseData = responseData.task;
} else if (operation === 'getAll') {
// ----------------------------------------
// task: getAll
// ----------------------------------------
// https://developers.freshworks.com/crm/api/#list_all_tasks
const { filter, include } = this.getNodeParameter('filters', i) as {
filter: string;
include: string;
};
const qs: IDataObject = {
filter: 'open',
};
if (filter) {
qs.filter = filter;
}
if (include) {
qs.include = include;
}
responseData = await handleListing.call(this, 'GET', '/tasks', {}, qs);
} else if (operation === 'update') {
// ----------------------------------------
// task: update
// ----------------------------------------
// https://developers.freshworks.com/crm/api/#update_a_task
const body = {} as IDataObject;
const updateFields = this.getNodeParameter('updateFields', i);
if (!Object.keys(updateFields).length) {
throwOnEmptyUpdate.call(this, resource);
}
const { dueDate, ...rest } = updateFields;
if (dueDate) {
body.due_date = tz(dueDate, defaultTimezone).format();
}
if (Object.keys(rest).length) {
Object.assign(body, rest);
}
const taskId = this.getNodeParameter('taskId', i);
responseData = await freshworksCrmApiRequest.call(
this,
'PUT',
`/tasks/${taskId}`,
body,
);
responseData = responseData.task;
}
}
} catch (error) {
if (this.continueOnFail()) {
const executionErrorData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray({ error: error.message }),
{ itemData: { item: i } },
);
returnData.push(...executionErrorData);
continue;
}
throw error;
}
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData as IDataObject),
{ itemData: { item: i } },
);
returnData.push(...executionData);
}
return [returnData];
}
}
@@ -0,0 +1,198 @@
import omit from 'lodash/omit';
import type {
IExecuteFunctions,
IDataObject,
ILoadOptionsFunctions,
JsonObject,
IHttpRequestMethods,
IRequestOptions,
} from 'n8n-workflow';
import { NodeApiError, NodeOperationError } from 'n8n-workflow';
import type {
FreshworksConfigResponse,
FreshworksCrmApiCredentials,
LoadedResource,
SalesAccounts,
ViewsResponse,
} from './types';
export async function freshworksCrmApiRequest(
this: IExecuteFunctions | ILoadOptionsFunctions,
method: IHttpRequestMethods,
endpoint: string,
body: IDataObject = {},
qs: IDataObject = {},
) {
const { domain } = await this.getCredentials<FreshworksCrmApiCredentials>('freshworksCrmApi');
const options: IRequestOptions = {
method,
body,
qs,
uri: `https://${domain}.myfreshworks.com/crm/sales/api${endpoint}`,
json: true,
};
if (!Object.keys(body).length) {
delete options.body;
}
if (!Object.keys(qs).length) {
delete options.qs;
}
try {
const credentialsType = 'freshworksCrmApi';
return await this.helpers.requestWithAuthentication.call(this, credentialsType, options);
} catch (error) {
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}
export async function getAllItemsViewId(
this: IExecuteFunctions | ILoadOptionsFunctions,
{ fromLoadOptions } = { fromLoadOptions: false },
) {
let resource = this.getNodeParameter('resource', 0);
let keyword = 'All';
if (resource === 'account' || fromLoadOptions) {
resource = 'sales_account'; // adjust resource to endpoint
}
if (resource === 'deal') {
keyword = 'My Deals'; // no 'All Deals' available
}
const response = (await freshworksCrmApiRequest.call(
this,
'GET',
`/${resource}s/filters`,
)) as ViewsResponse;
const view = response.filters.find((v) => v.name.includes(keyword));
if (!view) {
throw new NodeOperationError(this.getNode(), 'Failed to get all items view');
}
return view.id.toString();
}
export async function freshworksCrmApiRequestAllItems(
this: IExecuteFunctions | ILoadOptionsFunctions,
method: IHttpRequestMethods,
endpoint: string,
body: IDataObject = {},
qs: IDataObject = {},
) {
const returnData: IDataObject[] = [];
let response: any;
qs.page = 1;
do {
response = await freshworksCrmApiRequest.call(this, method, endpoint, body, qs);
const key = Object.keys(response as IDataObject)[0];
returnData.push(...(response[key] as IDataObject[]));
qs.page++;
} while (response.meta.total_pages && qs.page <= response.meta.total_pages);
return returnData;
}
export async function handleListing(
this: IExecuteFunctions | ILoadOptionsFunctions,
method: IHttpRequestMethods,
endpoint: string,
body: IDataObject = {},
qs: IDataObject = {},
) {
const returnAll = this.getNodeParameter('returnAll', 0);
if (returnAll) {
return await freshworksCrmApiRequestAllItems.call(this, method, endpoint, body, qs);
}
const responseData = await freshworksCrmApiRequestAllItems.call(this, method, endpoint, body, qs);
const limit = this.getNodeParameter('limit', 0) as number;
if (limit) return responseData.slice(0, limit);
return responseData;
}
/**
* Load resources for options, except users.
*
* See: https://developers.freshworks.com/crm/api/#admin_configuration
*/
export async function loadResource(this: ILoadOptionsFunctions, resource: string) {
const response = (await freshworksCrmApiRequest.call(
this,
'GET',
`/selector/${resource}`,
)) as FreshworksConfigResponse<LoadedResource>;
const key = Object.keys(response)[0];
return response[key].map(({ name, id }) => ({ name, value: id }));
}
export function adjustAttendees(attendees: [{ type: string; contactId: string; userId: string }]) {
return attendees.map((attendee) => {
if (attendee.type === 'contact') {
return {
attendee_type: 'Contact',
attendee_id: attendee.contactId.toString(),
};
} else if (attendee.type === 'user') {
return {
attendee_type: 'FdMultitenant::User',
attendee_id: attendee.userId.toString(),
};
}
});
}
// /**
// * Adjust attendee data from n8n UI to the format expected by Freshworks CRM API.
// */
// export function adjustAttendees(additionalFields: IDataObject & Attendees) {
// if (!additionalFields?.appointment_attendees_attributes) return additionalFields;
// return {
// ...omit(additionalFields, ['appointment_attendees_attributes']),
// appointment_attendees_attributes: additionalFields.appointment_attendees_attributes.map(attendeeId => {
// return { type: 'user', id: attendeeId };
// }),
// };
// }
/**
* Adjust account data from n8n UI to the format expected by Freshworks CRM API.
*/
export function adjustAccounts(additionalFields: IDataObject & SalesAccounts) {
if (!additionalFields?.sales_accounts) return additionalFields;
const adjusted = additionalFields.sales_accounts.map((accountId) => {
return { id: accountId, is_primary: false };
});
adjusted[0].is_primary = true;
return {
...omit(additionalFields, ['sales_accounts']),
sales_accounts: adjusted,
};
}
export function throwOnEmptyUpdate(this: IExecuteFunctions, resource: string) {
throw new NodeOperationError(
this.getNode(),
`Please enter at least one field to update for the ${resource}.`,
);
}
export function throwOnEmptyFilter(this: IExecuteFunctions) {
throw new NodeOperationError(this.getNode(), 'Please select at least one filter.');
}
@@ -0,0 +1,38 @@
{
"type": "object",
"properties": {
"email": {
"type": "string"
},
"id": {
"type": "string"
},
"mcr_id": {
"type": "integer"
},
"name": {
"type": "string"
},
"owner": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
}
}
},
"stage_name": {
"type": "string"
},
"type": {
"type": "string"
},
"updated_at": {
"type": "string"
}
},
"version": 2
}
@@ -0,0 +1,481 @@
import type { INodeProperties } from 'n8n-workflow';
export const accountOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['account'],
},
},
options: [
{
name: 'Create',
value: 'create',
description: 'Create an account',
action: 'Create an account',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete an account',
action: 'Delete an account',
},
{
name: 'Get',
value: 'get',
description: 'Retrieve an account',
action: 'Get an account',
},
{
name: 'Get Many',
value: 'getAll',
description: 'Retrieve many accounts',
action: 'Get many accounts',
},
{
name: 'Update',
value: 'update',
description: 'Update an account',
action: 'Update an account',
},
],
default: 'create',
},
];
export const accountFields: INodeProperties[] = [
// ----------------------------------------
// account: create
// ----------------------------------------
{
displayName: 'Name',
name: 'name',
description: 'Name of the account',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['account'],
operation: ['create'],
},
},
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['account'],
operation: ['create'],
},
},
options: [
{
displayName: 'Address',
name: 'address',
type: 'string',
default: '',
description: 'Address of the account',
},
{
displayName: 'Annual Revenue',
name: 'annual_revenue',
type: 'number',
default: 0,
description: 'Annual revenue of the account',
},
{
displayName: 'Business Type Name or ID',
name: 'business_type_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getBusinessTypes',
},
description:
'ID of the business that the account belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'City',
name: 'city',
type: 'string',
default: '',
description: 'City that the account belongs to',
},
{
displayName: 'Country',
name: 'country',
type: 'string',
default: '',
description: 'Country that the account belongs to',
},
{
displayName: 'Facebook',
name: 'facebook',
type: 'string',
default: '',
description: 'Facebook username of the account',
},
{
displayName: 'Industry Type Name or ID',
name: 'industry_type_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getIndustryTypes',
},
description:
'ID of the industry that the account belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'LinkedIn',
name: 'linkedin',
type: 'string',
default: '',
description: 'LinkedIn account of the account',
},
{
displayName: 'Number of Employees',
name: 'number_of_employees',
type: 'number',
default: 0,
description: 'Number of employees in the account',
},
{
displayName: 'Owner Name or ID',
name: 'owner_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
description:
'ID of the user to whom the account is assigned. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Parent Sales Account ID',
name: 'parent_sales_account_id',
type: 'string',
default: '',
description: 'Parent account ID of the account',
},
{
displayName: 'Phone',
name: 'phone',
type: 'string',
default: '',
description: 'Phone number of the account',
},
{
displayName: 'State',
name: 'state',
type: 'string',
default: '',
description: 'State that the account belongs to',
},
{
displayName: 'Territory Name or ID',
name: 'territory_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getTerritories',
},
description:
'ID of the territory that the account belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Twitter',
name: 'twitter',
type: 'string',
default: '',
description: 'Twitter username of the account',
},
{
displayName: 'Website',
name: 'website',
type: 'string',
default: '',
description: 'Website of the account',
},
{
displayName: 'Zipcode',
name: 'zipcode',
type: 'string',
default: '',
description: 'Zipcode of the region that the account belongs to',
},
],
},
// ----------------------------------------
// account: delete
// ----------------------------------------
{
displayName: 'Account ID',
name: 'accountId',
description: 'ID of the account to delete',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['account'],
operation: ['delete'],
},
},
},
// ----------------------------------------
// account: get
// ----------------------------------------
{
displayName: 'Account ID',
name: 'accountId',
description: 'ID of the account to retrieve',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['account'],
operation: ['get'],
},
},
},
// ----------------------------------------
// account: getAll
// ----------------------------------------
{
displayName: 'View Name or ID',
name: 'view',
type: 'options',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
required: true,
typeOptions: {
loadOptionsMethod: 'getAccountViews',
},
displayOptions: {
show: {
resource: ['account'],
operation: ['getAll'],
},
},
default: '',
},
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
default: false,
description: 'Whether to return all results or only up to a given limit',
displayOptions: {
show: {
resource: ['account'],
operation: ['getAll'],
},
},
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 50,
description: 'Max number of results to return',
typeOptions: {
minValue: 1,
},
displayOptions: {
show: {
resource: ['account'],
operation: ['getAll'],
returnAll: [false],
},
},
},
// ----------------------------------------
// account: update
// ----------------------------------------
{
displayName: 'Account ID',
name: 'accountId',
description: 'ID of the account to update',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['account'],
operation: ['update'],
},
},
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['account'],
operation: ['update'],
},
},
options: [
{
displayName: 'Address',
name: 'address',
type: 'string',
default: '',
description: 'Address of the account',
},
{
displayName: 'Annual Revenue',
name: 'annual_revenue',
type: 'number',
default: 0,
description: 'Annual revenue of the account',
},
{
displayName: 'Business Type Name or ID',
name: 'business_type_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getBusinessTypes',
},
description:
'ID of the business that the account belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'City',
name: 'city',
type: 'string',
default: '',
description: 'City that the account belongs to',
},
{
displayName: 'Country',
name: 'country',
type: 'string',
default: '',
description: 'Country that the account belongs to',
},
{
displayName: 'Facebook',
name: 'facebook',
type: 'string',
default: '',
description: 'Facebook username of the account',
},
{
displayName: 'Industry Type Name or ID',
name: 'industry_type_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getIndustryTypes',
},
description:
'ID of the industry that the account belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'LinkedIn',
name: 'linkedin',
type: 'string',
default: '',
description: 'LinkedIn account of the account',
},
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
description: 'Name of the account',
},
{
displayName: 'Number of Employees',
name: 'number_of_employees',
type: 'number',
default: 0,
description: 'Number of employees in the account',
},
{
displayName: 'Owner Name or ID',
name: 'owner_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
description:
'ID of the user to whom the account is assigned. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Parent Sales Account ID',
name: 'parent_sales_account_id',
type: 'string',
default: '',
description: 'Parent account ID of the account',
},
{
displayName: 'Phone',
name: 'phone',
type: 'string',
default: '',
description: 'Phone number of the account',
},
{
displayName: 'State',
name: 'state',
type: 'string',
default: '',
description: 'State that the account belongs to',
},
{
displayName: 'Territory Name or ID',
name: 'territory_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getTerritories',
},
description:
'ID of the territory that the account belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Twitter',
name: 'twitter',
type: 'string',
default: '',
description: 'Twitter username of the account',
},
{
displayName: 'Website',
name: 'website',
type: 'string',
default: '',
description: 'Website of the account',
},
{
displayName: 'Zipcode',
name: 'zipcode',
type: 'string',
default: '',
description: 'Zipcode of the region that the account belongs to',
},
],
},
];
@@ -0,0 +1,589 @@
import { tz } from 'moment-timezone';
import type { INodeProperties } from 'n8n-workflow';
export const appointmentOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['appointment'],
},
},
options: [
{
name: 'Create',
value: 'create',
description: 'Create an appointment',
action: 'Create an appointment',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete an appointment',
action: 'Delete an appointment',
},
{
name: 'Get',
value: 'get',
description: 'Retrieve an appointment',
action: 'Get an appointment',
},
{
name: 'Get Many',
value: 'getAll',
description: 'Retrieve many appointments',
action: 'Get many appointments',
},
{
name: 'Update',
value: 'update',
description: 'Update an appointment',
action: 'Update an appointment',
},
],
default: 'create',
},
];
export const appointmentFields: INodeProperties[] = [
// ----------------------------------------
// appointment: create
// ----------------------------------------
{
displayName: 'Title',
name: 'title',
description: 'Title of the appointment',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['appointment'],
operation: ['create'],
},
},
},
{
displayName: 'Start Date',
name: 'fromDate',
description:
'Timestamp that denotes the start of appointment. Start date if this is an all-day appointment.',
type: 'dateTime',
required: true,
default: '',
displayOptions: {
show: {
resource: ['appointment'],
operation: ['create'],
},
},
},
{
displayName: 'End Date',
name: 'endDate',
description:
'Timestamp that denotes the end of appointment. End date if this is an all-day appointment.',
type: 'dateTime',
required: true,
default: '',
displayOptions: {
show: {
resource: ['appointment'],
operation: ['create'],
},
},
},
{
displayName: 'Attendees',
name: 'attendees',
type: 'fixedCollection',
typeOptions: {
multipleValues: true,
},
displayOptions: {
show: {
resource: ['appointment'],
operation: ['create'],
},
},
placeholder: 'Add Attendee',
default: {},
options: [
{
name: 'attendee',
displayName: 'Attendee',
values: [
{
displayName: 'Type',
name: 'type',
type: 'options',
options: [
{
name: 'Contact',
value: 'contact',
},
{
name: 'User',
value: 'user',
},
],
default: 'contact',
},
{
displayName: 'User Name or ID',
name: 'userId',
type: 'options',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
displayOptions: {
show: {
type: ['user'],
},
},
typeOptions: {
loadOptionsMethod: 'getUsers',
},
default: '',
},
{
displayName: 'Contact ID',
name: 'contactId',
displayOptions: {
show: {
type: ['contact'],
},
},
type: 'string',
default: '',
},
],
},
],
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['appointment'],
operation: ['create'],
},
},
options: [
{
displayName: 'Creator Name or ID',
name: 'creater_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
description:
'ID of the user who created the appointment. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Is All-Day',
name: 'is_allday',
type: 'boolean',
default: false,
description: 'Whether it is an all-day appointment or not',
},
{
displayName: 'Latitude',
name: 'latitude',
type: 'string',
default: '',
description: 'Latitude of the location when you check in for an appointment',
},
{
displayName: 'Location',
name: 'location',
type: 'string',
default: '',
description: 'Location of the appointment',
},
{
displayName: 'Longitude',
name: 'longitude',
type: 'string',
default: '',
description: 'Longitude of the location when you check in for an appointment',
},
{
displayName: 'Outcome Name or ID',
name: 'outcome_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getOutcomes',
},
description:
'ID of outcome of Appointment sales activity type. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Target ID',
name: 'targetable_id',
type: 'string',
default: '',
description: 'ID of contact/account against whom appointment is created',
},
{
displayName: 'Target Type',
name: 'targetable_type',
type: 'options',
default: 'Contact',
options: [
{
name: 'Contact',
value: 'Contact',
},
{
name: 'Deal',
value: 'Deal',
},
{
name: 'SalesAccount',
value: 'SalesAccount',
},
],
},
{
displayName: 'Time Zone',
name: 'time_zone',
type: 'options',
default: '',
description: 'Timezone that the appointment is scheduled in',
options: tz.names().map((timeZone) => ({ name: timeZone, value: timeZone })),
},
],
},
// ----------------------------------------
// appointment: delete
// ----------------------------------------
{
displayName: 'Appointment ID',
name: 'appointmentId',
description: 'ID of the appointment to delete',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['appointment'],
operation: ['delete'],
},
},
},
// ----------------------------------------
// appointment: get
// ----------------------------------------
{
displayName: 'Appointment ID',
name: 'appointmentId',
description: 'ID of the appointment to retrieve',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['appointment'],
operation: ['get'],
},
},
},
// ----------------------------------------
// appointment: getAll
// ----------------------------------------
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
default: false,
description: 'Whether to return all results or only up to a given limit',
displayOptions: {
show: {
resource: ['appointment'],
operation: ['getAll'],
},
},
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 50,
description: 'Max number of results to return',
typeOptions: {
minValue: 1,
},
displayOptions: {
show: {
resource: ['appointment'],
operation: ['getAll'],
returnAll: [false],
},
},
},
{
displayName: 'Filters',
name: 'filters',
type: 'collection',
default: {},
placeholder: 'Add Filter',
displayOptions: {
show: {
resource: ['appointment'],
operation: ['getAll'],
},
},
options: [
{
displayName: 'Include',
name: 'include',
type: 'options',
default: 'creater',
options: [
{
name: 'Appointment Attendees',
value: 'appointment_attendees',
},
{
name: 'Creator',
value: 'creater',
},
{
name: 'Target',
value: 'targetable',
},
],
},
{
displayName: 'Time',
name: 'filter',
type: 'options',
default: 'upcoming',
options: [
{
name: 'Past',
value: 'past',
},
{
name: 'Upcoming',
value: 'upcoming',
},
],
},
],
},
// ----------------------------------------
// appointment: update
// ----------------------------------------
{
displayName: 'Appointment ID',
name: 'appointmentId',
description: 'ID of the appointment to update',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['appointment'],
operation: ['update'],
},
},
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['appointment'],
operation: ['update'],
},
},
options: [
{
displayName: 'Attendees',
name: 'attendees',
type: 'fixedCollection',
typeOptions: {
multipleValues: true,
},
placeholder: 'Add Attendee',
default: {},
options: [
{
name: 'attendee',
displayName: 'Attendee',
values: [
{
displayName: 'Type',
name: 'type',
type: 'options',
options: [
{
name: 'Contact',
value: 'contact',
},
{
name: 'User',
value: 'user',
},
],
default: 'contact',
},
{
displayName: 'User Name or ID',
name: 'userId',
type: 'options',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
displayOptions: {
show: {
type: ['user'],
},
},
typeOptions: {
loadOptionsMethod: 'getUsers',
},
default: '',
},
{
displayName: 'Contact ID',
name: 'contactId',
displayOptions: {
show: {
type: ['contact'],
},
},
type: 'string',
default: '',
},
],
},
],
},
{
displayName: 'Creator Name or ID',
name: 'creater_id',
type: 'options',
default: [],
typeOptions: {
loadOptionsMethod: 'getUsers',
},
description:
'ID of the user who created the appointment. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'End Date',
name: 'endDate',
description:
'Timestamp that denotes the end of appointment. End date if this is an all-day appointment.',
type: 'dateTime',
default: '',
},
{
displayName: 'Is All-Day',
name: 'is_allday',
type: 'boolean',
default: false,
description: 'Whether it is an all-day appointment or not',
},
{
displayName: 'Latitude',
name: 'latitude',
type: 'string',
default: '',
description: 'Latitude of the location when you check in for an appointment',
},
{
displayName: 'Location',
name: 'location',
type: 'string',
default: '',
description: 'Location of the appointment',
},
{
displayName: 'Longitude',
name: 'longitude',
type: 'string',
default: '',
description: 'Longitude of the location when you check in for an appointment',
},
{
displayName: 'Outcome Name or ID',
name: 'outcome_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getOutcomes',
},
description:
'ID of outcome of Appointment sales activity type. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Start Date',
name: 'fromDate',
description:
'Timestamp that denotes the start of appointment. Start date if this is an all-day appointment.',
type: 'dateTime',
default: '',
},
{
displayName: 'Target ID',
name: 'targetable_id',
type: 'string',
default: '',
description: 'ID of contact/account against whom appointment is created',
},
{
displayName: 'Target Type',
name: 'targetable_type',
type: 'options',
default: 'Contact',
options: [
{
name: 'Contact',
value: 'Contact',
},
{
name: 'Deal',
value: 'Deal',
},
{
name: 'SalesAccount',
value: 'SalesAccount',
},
],
},
{
displayName: 'Time Zone',
name: 'time_zone',
type: 'options',
default: '',
description: 'Timezone that the appointment is scheduled in',
options: tz.names().map((timeZone) => ({ name: timeZone, value: timeZone })),
},
{
displayName: 'Title',
name: 'title',
type: 'string',
default: '',
description: 'Title of the appointment',
},
],
},
];
@@ -0,0 +1,632 @@
import type { INodeProperties } from 'n8n-workflow';
export const contactOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['contact'],
},
},
options: [
{
name: 'Create',
value: 'create',
description: 'Create a contact',
action: 'Create a contact',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a contact',
action: 'Delete a contact',
},
{
name: 'Get',
value: 'get',
description: 'Retrieve a contact',
action: 'Get a contact',
},
{
name: 'Get Many',
value: 'getAll',
description: 'Retrieve many contacts',
action: 'Get many contacts',
},
{
name: 'Update',
value: 'update',
description: 'Update a contact',
action: 'Update a contact',
},
],
default: 'create',
},
];
export const contactFields: INodeProperties[] = [
// ----------------------------------------
// contact: create
// ----------------------------------------
{
displayName: 'First Name',
name: 'firstName',
description: 'First name of the contact',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['contact'],
operation: ['create'],
},
},
},
{
displayName: 'Last Name',
name: 'lastName',
description: 'Last name of the contact',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['contact'],
operation: ['create'],
},
},
},
{
displayName: 'Email Address',
name: 'emails',
type: 'string',
default: '',
description: 'Email addresses of the contact',
required: true,
displayOptions: {
show: {
resource: ['contact'],
operation: ['create'],
},
},
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['contact'],
operation: ['create'],
},
},
options: [
{
displayName: 'Address',
name: 'address',
type: 'string',
default: '',
description: 'Address of the contact',
},
{
displayName: 'Campaign Name or ID',
name: 'campaign_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getCampaigns',
},
description:
'ID of the campaign that led your contact to your webapp. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'City',
name: 'city',
type: 'string',
default: '',
description: 'City that the contact belongs to',
},
{
displayName: 'Contact Status Name or ID',
name: 'contact_status_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getContactStatuses',
},
description:
'ID of the contact status that the contact belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Country',
name: 'country',
type: 'string',
default: '',
description: 'Country that the contact belongs to',
},
{
displayName: 'External ID',
name: 'external_id',
type: 'string',
default: '',
description: 'External ID of the contact',
},
{
displayName: 'Facebook',
name: 'facebook',
type: 'string',
default: '',
description: 'Facebook username of the contact',
},
{
displayName: 'Job Title',
name: 'job_title',
type: 'string',
default: '',
description: 'Designation of the contact in the account they belong to',
},
{
displayName: 'Keywords',
name: 'keyword',
type: 'string',
default: '',
description: 'Keywords that the contact used to reach your website/web app',
},
{
displayName: 'Lead Source ID',
name: 'lead_source_id',
type: 'string', // not obtainable from API
default: '',
description: 'ID of the source where contact came from',
},
{
displayName: 'Lifecycle Stage Name or ID',
name: 'lifecycle_stage_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getLifecycleStages',
},
description:
'ID of the lifecycle stage that the contact belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'LinkedIn',
name: 'linkedin',
type: 'string',
default: '',
description: 'LinkedIn account of the contact',
},
{
displayName: 'Medium',
name: 'medium',
type: 'string',
default: '',
description: 'Medium that led your contact to your website/webapp',
},
{
displayName: 'Mobile Number',
name: 'mobile_number',
type: 'string',
default: '',
description: 'Mobile phone number of the contact',
},
{
displayName: 'Owner Name or ID',
name: 'owner_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
description:
'ID of the user to whom the contact is assigned. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Sales Account Names or IDs',
name: 'sales_accounts',
type: 'multiOptions',
default: [],
typeOptions: {
loadOptionsMethod: 'getAccounts',
},
description:
'Accounts which contact belongs to. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'State',
name: 'state',
type: 'string',
default: '',
description: 'State that the contact belongs to',
},
{
displayName: 'Subscription Status',
name: 'subscription_status',
type: 'string', // not obtainable from API
default: '',
description: 'Status of subscription that the contact is in',
},
{
displayName: 'Subscription Types',
name: 'subscription_types',
type: 'string', // not obtainable from API
default: '',
description: 'Type of subscription that the contact is in',
},
{
displayName: 'Territory Name or ID',
name: 'territory_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getTerritories',
},
description:
'ID of the territory that the contact belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Time Zone',
name: 'time_zone',
type: 'string',
default: '',
description: 'Timezone that the contact belongs to',
},
{
displayName: 'Twitter',
name: 'twitter',
type: 'string',
default: '',
description: 'Twitter username of the contact',
},
{
displayName: 'Work Number',
name: 'work_number',
type: 'string',
default: '',
description: 'Work phone number of the contact',
},
{
displayName: 'Zipcode',
name: 'zipcode',
type: 'string',
default: '',
description: 'Zipcode of the region that the contact belongs to',
},
],
},
// ----------------------------------------
// contact: delete
// ----------------------------------------
{
displayName: 'Contact ID',
name: 'contactId',
description: 'ID of the contact to delete',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['contact'],
operation: ['delete'],
},
},
},
// ----------------------------------------
// contact: get
// ----------------------------------------
{
displayName: 'Contact ID',
name: 'contactId',
description: 'ID of the contact to retrieve',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['contact'],
operation: ['get'],
},
},
},
// ----------------------------------------
// contact: getAll
// ----------------------------------------
{
displayName: 'View Name or ID',
name: 'view',
type: 'options',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
displayOptions: {
show: {
resource: ['contact'],
operation: ['getAll'],
},
},
typeOptions: {
loadOptionsMethod: 'getContactViews',
},
default: '',
},
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
default: false,
description: 'Whether to return all results or only up to a given limit',
displayOptions: {
show: {
resource: ['contact'],
operation: ['getAll'],
},
},
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 50,
description: 'Max number of results to return',
typeOptions: {
minValue: 1,
},
displayOptions: {
show: {
resource: ['contact'],
operation: ['getAll'],
returnAll: [false],
},
},
},
// ----------------------------------------
// contact: update
// ----------------------------------------
{
displayName: 'Contact ID',
name: 'contactId',
description: 'ID of the contact to update',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['contact'],
operation: ['update'],
},
},
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['contact'],
operation: ['update'],
},
},
options: [
{
displayName: 'Address',
name: 'address',
type: 'string',
default: '',
description: 'Address of the contact',
},
{
displayName: 'Campaign Name or ID',
name: 'campaign_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getCampaigns',
},
description:
'ID of the campaign that led your contact to your webapp. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'City',
name: 'city',
type: 'string',
default: '',
description: 'City that the contact belongs to',
},
{
displayName: 'Contact Status Name or ID',
name: 'contact_status_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getContactStatuses',
},
description:
'ID of the contact status that the contact belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Country',
name: 'country',
type: 'string',
default: '',
description: 'Country that the contact belongs to',
},
{
displayName: 'External ID',
name: 'external_id',
type: 'string',
default: '',
description: 'External ID of the contact',
},
{
displayName: 'Facebook',
name: 'facebook',
type: 'string',
default: '',
description: 'Facebook username of the contact',
},
{
displayName: 'First Name',
name: 'first_name',
type: 'string',
default: '',
description: 'First name of the contact',
},
{
displayName: 'Job Title',
name: 'job_title',
type: 'string',
default: '',
description: 'Designation of the contact in the account they belong to',
},
{
displayName: 'Keywords',
name: 'keyword',
type: 'string',
default: '',
description: 'Keywords that the contact used to reach your website/web app',
},
{
displayName: 'Last Name',
name: 'last_name',
type: 'string',
default: '',
description: 'Last name of the contact',
},
{
displayName: 'Lead Source Name or ID',
name: 'lead_source_id',
type: 'options',
default: '',
description:
'ID of the source where contact came from. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Lifecycle Stage Name or ID',
name: 'lifecycle_stage_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getLifecycleStages',
},
description:
'ID of the lifecycle stage that the contact belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'LinkedIn',
name: 'linkedin',
type: 'string',
default: '',
description: 'LinkedIn account of the contact',
},
{
displayName: 'Medium',
name: 'medium',
type: 'string',
default: '',
description: 'Medium that led your contact to your website/webapp',
},
{
displayName: 'Mobile Number',
name: 'mobile_number',
type: 'string',
default: '',
description: 'Mobile phone number of the contact',
},
{
displayName: 'Owner Name or ID',
name: 'owner_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
description:
'ID of the user to whom the contact is assigned. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Sales Account Names or IDs',
name: 'sales_accounts',
type: 'multiOptions',
default: [],
typeOptions: {
loadOptionsMethod: 'getAccounts',
},
description:
'Accounts which contact belongs to. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'State',
name: 'state',
type: 'string',
default: '',
description: 'State that the contact belongs to',
},
{
displayName: 'Subscription Status Name or ID',
name: 'subscription_status',
type: 'options',
default: '',
description:
'Status of subscription that the contact is in. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Subscription Types Name or ID',
name: 'subscription_types',
type: 'options',
default: '',
description:
'Type of subscription that the contact is in. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Territory Name or ID',
name: 'territory_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getTerritories',
},
description:
'ID of the territory that the contact belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Time Zone',
name: 'time_zone',
type: 'string',
default: '',
description: 'Timezone that the contact belongs to',
},
{
displayName: 'Twitter',
name: 'twitter',
type: 'string',
default: '',
description: 'Twitter username of the contact',
},
{
displayName: 'Work Number',
name: 'work_number',
type: 'string',
default: '',
description: 'Work phone number of the contact',
},
{
displayName: 'Zipcode',
name: 'zipcode',
type: 'string',
default: '',
description: 'Zipcode of the region that the contact belongs to',
},
],
},
];
@@ -0,0 +1,529 @@
import type { INodeProperties } from 'n8n-workflow';
export const dealOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['deal'],
},
},
options: [
{
name: 'Create',
value: 'create',
description: 'Create a deal',
action: 'Create a deal',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a deal',
action: 'Delete a deal',
},
{
name: 'Get',
value: 'get',
description: 'Retrieve a deal',
action: 'Get a deal',
},
{
name: 'Get Many',
value: 'getAll',
description: 'Retrieve many deals',
action: 'Get many deals',
},
{
name: 'Update',
value: 'update',
description: 'Update a deal',
action: 'Update a deal',
},
],
default: 'create',
},
];
export const dealFields: INodeProperties[] = [
// ----------------------------------------
// deal: create
// ----------------------------------------
{
displayName: 'Amount',
name: 'amount',
description: 'Value of the deal',
type: 'number',
required: true,
default: 0,
displayOptions: {
show: {
resource: ['deal'],
operation: ['create'],
},
},
},
{
displayName: 'Name',
name: 'name',
description: 'Name of the deal',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['deal'],
operation: ['create'],
},
},
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['deal'],
operation: ['create'],
},
},
options: [
{
displayName: 'Base Currency Amount',
name: 'base_currency_amount',
type: 'number',
default: 0,
description: 'Value of the deal in base currency',
},
{
displayName: 'Campaign Name or ID',
name: 'campaign_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getCampaigns',
},
description:
'ID of the campaign that landed this deal. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Currency Name or ID',
name: 'currency_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getCurrencies',
},
description:
'ID of the currency that the deal belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Deal Payment Status Name or ID',
name: 'deal_payment_status_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getDealPaymentStatuses',
},
description:
'ID of the mode of payment for the deal. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Deal Pipeline Name or ID',
name: 'deal_pipeline_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getDealPipelines',
},
description:
'ID of the deal pipeline that it belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Deal Product Name or ID',
name: 'deal_product_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getDealProducts',
},
description:
'ID of the product that the deal belongs to (in a multi-product company). Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Deal Reason Name or ID',
name: 'deal_reason_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getDealReasons',
},
description:
'ID of the reason for losing the deal. Can only be set if the deal is in \'Lost\' stage. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Deal Stage Name or ID',
name: 'deal_stage_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getDealStages',
},
description:
'ID of the deal stage that the deal belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Deal Type Name or ID',
name: 'deal_type_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getDealTypes',
},
description:
'ID of the deal type that the deal belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Lead Source ID',
name: 'lead_source_id',
type: 'string', // not obtainable from API
default: '',
description: 'ID of the source where deal came from',
},
{
displayName: 'Owner Name or ID',
name: 'owner_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
description:
'ID of the user to whom the deal is assigned. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Probability',
name: 'probability',
type: 'number',
default: 0,
typeOptions: {
minValue: 0,
maxValue: 100,
},
description: 'Probability of winning the deal as a number between 0 and 100',
},
{
displayName: 'Sales Account Name or ID',
name: 'sales_account_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getAccounts',
},
description:
'ID of the account that the deal belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Territory Name or ID',
name: 'territory_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getTerritories',
},
description:
'ID of the territory that the deal belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
],
},
// ----------------------------------------
// deal: delete
// ----------------------------------------
{
displayName: 'Deal ID',
name: 'dealId',
description: 'ID of the deal to delete',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['deal'],
operation: ['delete'],
},
},
},
// ----------------------------------------
// deal: get
// ----------------------------------------
{
displayName: 'Deal ID',
name: 'dealId',
description: 'ID of the deal to retrieve',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['deal'],
operation: ['get'],
},
},
},
// ----------------------------------------
// deal: getAll
// ----------------------------------------
{
displayName: 'View Name or ID',
name: 'view',
type: 'options',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
displayOptions: {
show: {
resource: ['deal'],
operation: ['getAll'],
},
},
typeOptions: {
loadOptionsMethod: 'getDealViews',
},
default: '',
},
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
default: false,
description: 'Whether to return all results or only up to a given limit',
displayOptions: {
show: {
resource: ['deal'],
operation: ['getAll'],
},
},
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 50,
description: 'Max number of results to return',
typeOptions: {
minValue: 1,
},
displayOptions: {
show: {
resource: ['deal'],
operation: ['getAll'],
returnAll: [false],
},
},
},
// ----------------------------------------
// deal: update
// ----------------------------------------
{
displayName: 'Deal ID',
name: 'dealId',
description: 'ID of the deal to update',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['deal'],
operation: ['update'],
},
},
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['deal'],
operation: ['update'],
},
},
options: [
{
displayName: 'Amount',
name: 'amount',
type: 'number',
default: 0,
typeOptions: {
minValue: 0,
},
description: 'Value of the deal',
},
{
displayName: 'Base Currency Amount',
name: 'base_currency_amount',
type: 'number',
default: 0,
typeOptions: {
minValue: 0,
},
description: 'Value of the deal in base currency',
},
{
displayName: 'Campaign Name or ID',
name: 'campaign_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getCampaigns',
},
description:
'ID of the campaign that landed this deal. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Currency Name or ID',
name: 'currency_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getCurrencies',
},
description:
'ID of the currency that the deal belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Deal Payment Status Name or ID',
name: 'deal_payment_status_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getDealPaymentStatuses',
},
description:
'ID of the mode of payment for the deal. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Deal Pipeline Name or ID',
name: 'deal_pipeline_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getDealPipelines',
},
description:
'ID of the deal pipeline that it belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Deal Product Name or ID',
name: 'deal_product_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getDealProducts',
},
description:
'ID of the product that the deal belongs to (in a multi-product company). Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Deal Reason Name or ID',
name: 'deal_reason_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getDealReasons',
},
description:
'ID of the reason for losing the deal. Can only be set if the deal is in \'Lost\' stage. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Deal Stage Name or ID',
name: 'deal_stage_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getDealStages',
},
description:
'ID of the deal stage that the deal belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Deal Type Name or ID',
name: 'deal_type_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getDealTypes',
},
description:
'ID of the deal type that the deal belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Lead Source ID',
name: 'lead_source_id',
type: 'string', // not obtainable from API
default: '',
description: 'ID of the source where deal came from',
},
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
description: 'Name of the deal',
},
{
displayName: 'Owner Name or ID',
name: 'owner_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
description:
'ID of the user to whom the deal is assigned. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Probability',
name: 'probability',
type: 'number',
default: 0,
typeOptions: {
minValue: 0,
maxValue: 100,
},
description: 'Probability of winning the deal as a number between 0 and 100',
},
{
displayName: 'Sales Account Name or ID',
name: 'sales_account_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getAccounts',
},
description:
'ID of the account that the deal belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Territory Name or ID',
name: 'territory_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getTerritories',
},
description:
'ID of the territory that the deal belongs to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
],
},
];
@@ -0,0 +1,191 @@
import type { INodeProperties } from 'n8n-workflow';
export const noteOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['note'],
},
},
options: [
{
name: 'Create',
value: 'create',
description: 'Create a note',
action: 'Create a note',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a note',
action: 'Delete a note',
},
{
name: 'Update',
value: 'update',
description: 'Update a note',
action: 'Update a note',
},
],
default: 'create',
},
];
export const noteFields: INodeProperties[] = [
// ----------------------------------------
// note: create
// ----------------------------------------
{
displayName: 'Content',
name: 'description',
description: 'Content of the note',
type: 'string',
required: true,
typeOptions: {
rows: 5,
},
default: '',
displayOptions: {
show: {
resource: ['note'],
operation: ['create'],
},
},
},
{
displayName: 'Target Type',
name: 'targetableType',
description: 'Type of the entity for which the note is created',
type: 'options',
required: true,
default: 'Contact',
options: [
{
name: 'Contact',
value: 'Contact',
},
{
name: 'Deal',
value: 'Deal',
},
{
name: 'Sales Account',
value: 'SalesAccount',
},
],
displayOptions: {
show: {
resource: ['note'],
operation: ['create'],
},
},
},
{
displayName: 'Target ID',
name: 'targetable_id',
description:
'ID of the entity for which note is created. The type of entity is selected in "Target Type".',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['note'],
operation: ['create'],
},
},
},
// ----------------------------------------
// note: delete
// ----------------------------------------
{
displayName: 'Note ID',
name: 'noteId',
description: 'ID of the note to delete',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['note'],
operation: ['delete'],
},
},
},
// ----------------------------------------
// note: update
// ----------------------------------------
{
displayName: 'Note ID',
name: 'noteId',
description: 'ID of the note to update',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['note'],
operation: ['update'],
},
},
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['note'],
operation: ['update'],
},
},
options: [
{
displayName: 'Content',
name: 'description',
type: 'string',
typeOptions: {
rows: 5,
},
default: '',
description: 'Content of the note',
},
{
displayName: 'Target ID',
name: 'targetable_id',
type: 'string',
default: '',
description: 'ID of the entity for which the note is updated',
},
{
displayName: 'Target Type',
name: 'targetable_type',
type: 'options',
default: 'Contact',
description: 'Type of the entity for which the note is updated',
options: [
{
name: 'Contact',
value: 'Contact',
},
{
name: 'Deal',
value: 'Deal',
},
{
name: 'Sales Account',
value: 'SalesAccount',
},
],
},
],
},
];
@@ -0,0 +1,461 @@
import type { INodeProperties } from 'n8n-workflow';
export const salesActivityOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['salesActivity'],
},
},
options: [
// {
// name: 'Create',
// value: 'create',
// description: 'Create a sales activity',
// },
// {
// name: 'Delete',
// value: 'delete',
// description: 'Delete a sales activity',
// },
{
name: 'Get',
value: 'get',
description: 'Retrieve a sales activity',
action: 'Get a sales activity',
},
{
name: 'Get Many',
value: 'getAll',
description: 'Retrieve many sales activities',
action: 'Get many sales activities',
},
// {
// name: 'Update',
// value: 'update',
// description: 'Update a sales activity',
// },
],
default: 'get',
},
];
export const salesActivityFields: INodeProperties[] = [
// ----------------------------------------
// salesActivity: create
// ----------------------------------------
{
displayName: 'Sales Activity Type Name or ID',
name: 'sales_activity_type_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getSalesActivityTypes',
},
description:
'ID of a sales activity type for which the sales activity is created. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
displayOptions: {
show: {
resource: ['salesActivity'],
operation: ['create'],
},
},
},
{
displayName: 'Title',
name: 'title',
description: 'Title of the sales activity to create',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['salesActivity'],
operation: ['create'],
},
},
},
{
displayName: 'Owner Name or ID',
name: 'ownerId',
description:
'ID of the user who owns the sales activity. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
required: true,
displayOptions: {
show: {
resource: ['salesActivity'],
operation: ['create'],
},
},
},
{
displayName: 'Start Date',
name: 'from_date',
description: 'Timestamp that denotes the end of sales activity',
type: 'dateTime',
required: true,
default: '',
displayOptions: {
show: {
resource: ['salesActivity'],
operation: ['create'],
},
},
},
{
displayName: 'End Date',
name: 'end_date',
description: 'Timestamp that denotes the end of sales activity',
type: 'dateTime',
required: true,
default: '',
displayOptions: {
show: {
resource: ['salesActivity'],
operation: ['create'],
},
},
},
{
displayName: 'Target Type',
name: 'targetableType',
description: 'Type of the entity for which the sales activity is created',
type: 'options',
required: true,
default: 'Contact',
options: [
{
name: 'Contact',
value: 'Contact',
},
{
name: 'Deal',
value: 'Deal',
},
{
name: 'Sales Account',
value: 'SalesAccount',
},
],
displayOptions: {
show: {
resource: ['salesActivity'],
operation: ['create'],
},
},
},
{
displayName: 'Target ID',
name: 'targetable_id',
description:
'ID of the entity for which the sales activity is created. The type of entity is selected in "Target Type".',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['salesActivity'],
operation: ['create'],
},
},
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['salesActivity'],
operation: ['create'],
},
},
options: [
{
displayName: 'Creator Name or ID',
name: 'creater_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
description:
'ID of the user who created the sales activity. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Latitude',
name: 'latitude',
type: 'string',
default: '',
description: 'Latitude of the location when you check in on a sales activity',
},
{
displayName: 'Location',
name: 'location',
type: 'string',
default: '',
description: 'Location of the sales activity',
},
{
displayName: 'Longitude',
name: 'longitude',
type: 'string',
default: '',
description: 'Longitude of the location when you check in for a sales activity',
},
{
displayName: 'Notes',
name: 'notes',
type: 'string',
default: '',
description: 'Description about the sales activity',
},
{
displayName: 'Sales Activity Outcome Name or ID',
name: 'sales_activity_outcome_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getOutcomes',
},
description:
'ID of a sales activity\'s outcome. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
],
},
// ----------------------------------------
// salesActivity: delete
// ----------------------------------------
{
displayName: 'Sales Activity ID',
name: 'salesActivityId',
description: 'ID of the salesActivity to delete',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['salesActivity'],
operation: ['delete'],
},
},
},
// ----------------------------------------
// salesActivity: get
// ----------------------------------------
{
displayName: 'Sales Activity ID',
name: 'salesActivityId',
description: 'ID of the salesActivity to retrieve',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['salesActivity'],
operation: ['get'],
},
},
},
// ----------------------------------------
// salesActivity: getAll
// ----------------------------------------
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
default: false,
description: 'Whether to return all results or only up to a given limit',
displayOptions: {
show: {
resource: ['salesActivity'],
operation: ['getAll'],
},
},
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 50,
description: 'Max number of results to return',
typeOptions: {
minValue: 1,
},
displayOptions: {
show: {
resource: ['salesActivity'],
operation: ['getAll'],
returnAll: [false],
},
},
},
// ----------------------------------------
// salesActivity: update
// ----------------------------------------
{
displayName: 'Sales Activity ID',
name: 'salesActivityId',
description: 'ID of the salesActivity to update',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['salesActivity'],
operation: ['update'],
},
},
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['salesActivity'],
operation: ['update'],
},
},
options: [
{
displayName: 'Creator Name or ID',
name: 'creater_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
description:
'ID of the user who created the sales activity. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Start Date',
name: 'end_date',
description: 'Timestamp that denotes the start of the sales activity',
type: 'dateTime',
default: '',
},
{
displayName: 'Latitude',
name: 'latitude',
type: 'string',
default: '',
description: 'Latitude of the location when you check in on a sales activity',
},
{
displayName: 'Location',
name: 'location',
type: 'string',
default: '',
description: 'Location of the sales activity',
},
{
displayName: 'Longitude',
name: 'longitude',
type: 'string',
default: '',
description: 'Longitude of the location when you check in for a sales activity',
},
{
displayName: 'Notes',
name: 'notes',
type: 'string',
default: '',
description: 'Description about the sales activity',
},
{
displayName: 'Owner Name or ID',
name: 'owner_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
description:
'ID of the user who owns the sales activity. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Sales Activity Outcome Name or ID',
name: 'sales_activity_outcome_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getOutcomes',
},
description:
'ID of a sales activity\'s outcome. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Sales Activity Type Name or ID',
name: 'sales_activity_type_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getSalesActivityTypes',
},
description:
'ID of a sales activity type for which the sales activity is updated. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Start Date',
name: 'from_date',
description: 'Timestamp that denotes the start of the sales activity',
type: 'dateTime',
default: '',
},
{
displayName: 'Target ID',
name: 'targetable_id',
type: 'string',
default: '',
description:
'ID of the entity for which the sales activity is updated. The type of entity is selected in "Target Type".',
},
{
displayName: 'Target Type',
name: 'targetable_type',
type: 'options',
default: 'Contact',
description: 'Type of the entity for which the sales activity is updated',
options: [
{
name: 'Contact',
value: 'Contact',
},
{
name: 'Deal',
value: 'Deal',
},
{
name: 'SalesAccount',
value: 'SalesAccount',
},
],
},
{
displayName: 'Title',
name: 'title',
type: 'string',
default: '',
description: 'Title of the sales activity to update',
},
],
},
];
@@ -0,0 +1,225 @@
import type { INodeProperties } from 'n8n-workflow';
export const searchOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['search'],
},
},
options: [
{
name: 'Query',
value: 'query',
description: 'Search for records by entering search queries of your choice',
action: 'Query a search',
},
{
name: 'Lookup',
value: 'lookup',
description: 'Search for the name or email address of records',
action: 'Lookup a search',
},
],
default: 'query',
},
];
export const searchFields: INodeProperties[] = [
// ----------------------------------------
// Search: query
// ----------------------------------------
{
displayName: 'Search Term',
name: 'query',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['search'],
operation: ['query'],
},
},
description: 'Enter a term that will be used for searching entities',
},
{
displayName: 'Search on Entities',
name: 'entities',
type: 'multiOptions',
options: [
{
name: 'Contact',
value: 'contact',
},
{
name: 'Deal',
value: 'deal',
},
{
name: 'Sales Account',
value: 'sales_account',
},
{
name: 'User',
value: 'user',
},
],
required: true,
default: [],
displayOptions: {
show: {
resource: ['search'],
operation: ['query'],
},
},
description: 'Enter a term that will be used for searching entities',
},
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
default: false,
displayOptions: {
show: {
resource: ['search'],
operation: ['query'],
},
},
description: 'Whether to return all results or only up to a given limit',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
typeOptions: {
minValue: 1,
},
default: 25,
displayOptions: {
show: {
resource: ['search'],
operation: ['query'],
returnAll: [false],
},
},
description: 'Max number of results to return',
},
// ----------------------------------------
// Search: lookup
// ----------------------------------------
{
displayName: 'Search Field',
name: 'searchField',
type: 'options',
options: [
{
name: 'Email',
value: 'email',
},
{
name: 'Name',
value: 'name',
},
{
name: 'Custom Field',
value: 'customField',
description:
'Only allowed custom fields of type "Text field", "Number", "Dropdown" or "Radio button"',
},
],
required: true,
default: '',
displayOptions: {
show: {
resource: ['search'],
operation: ['lookup'],
},
},
description: 'Field against which the entities have to be searched',
},
{
displayName: 'Custom Field Name',
name: 'customFieldName',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['search'],
operation: ['lookup'],
searchField: ['customField'],
},
},
},
{
displayName: 'Custom Field Value',
name: 'customFieldValue',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['search'],
operation: ['lookup'],
searchField: ['customField'],
},
},
},
{
displayName: 'Field Value',
name: 'fieldValue',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['search'],
operation: ['lookup'],
searchField: ['email', 'name'],
},
},
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add option',
default: {},
displayOptions: {
show: {
resource: ['search'],
operation: ['lookup'],
},
},
options: [
{
displayName: 'Entities',
name: 'entities',
type: 'multiOptions',
default: [],
options: [
{
name: 'Contact',
value: 'contact',
},
{
name: 'Deal',
value: 'deal',
},
{
name: 'Sales Account',
value: 'sales_account',
},
],
description:
"Use 'entities' to query against related entities. You can include multiple entities at once, provided the field is available in both entities or else you'd receive an error response.",
},
],
},
];
@@ -0,0 +1,436 @@
import type { INodeProperties } from 'n8n-workflow';
export const taskOperations: INodeProperties[] = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['task'],
},
},
options: [
{
name: 'Create',
value: 'create',
description: 'Create a task',
action: 'Create a task',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a task',
action: 'Delete a task',
},
{
name: 'Get',
value: 'get',
description: 'Retrieve a task',
action: 'Get a task',
},
{
name: 'Get Many',
value: 'getAll',
description: 'Retrieve many tasks',
action: 'Get many tasks',
},
{
name: 'Update',
value: 'update',
description: 'Update a task',
action: 'Update a task',
},
],
default: 'create',
},
];
export const taskFields: INodeProperties[] = [
// ----------------------------------------
// task: create
// ----------------------------------------
{
displayName: 'Title',
name: 'title',
description: 'Title of the task',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['task'],
operation: ['create'],
},
},
},
{
displayName: 'Due Date',
name: 'dueDate',
description: 'Timestamp that denotes when the task is due to be completed',
type: 'dateTime',
required: true,
default: '',
displayOptions: {
show: {
resource: ['task'],
operation: ['create'],
},
},
},
{
displayName: 'Owner Name or ID',
name: 'ownerId',
description:
'ID of the user to whom the task is assigned. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
required: true,
displayOptions: {
show: {
resource: ['task'],
operation: ['create'],
},
},
},
{
displayName: 'Target Type',
name: 'targetableType',
description: 'Type of the entity for which the task is updated',
type: 'options',
required: true,
default: 'Contact',
options: [
{
name: 'Contact',
value: 'Contact',
},
{
name: 'Deal',
value: 'Deal',
},
{
name: 'SalesAccount',
value: 'SalesAccount',
},
],
displayOptions: {
show: {
resource: ['task'],
operation: ['create'],
},
},
},
{
displayName: 'Target ID',
name: 'targetable_id',
description:
'ID of the entity for which the task is created. The type of entity is selected in "Target Type".',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
resource: ['task'],
operation: ['create'],
},
},
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['task'],
operation: ['create'],
},
},
options: [
{
displayName: 'Creator Name or ID',
name: 'creater_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
description:
'ID of the user who created the task. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Outcome Name or ID',
name: 'outcome_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getOutcomes',
},
description:
'ID of the outcome of the task. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Task Type ID',
name: 'task_type_id',
type: 'string', // not obtainable from API
default: '',
description: 'ID of the type of task',
},
],
},
// ----------------------------------------
// task: delete
// ----------------------------------------
{
displayName: 'Task ID',
name: 'taskId',
description: 'ID of the task to delete',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['task'],
operation: ['delete'],
},
},
},
// ----------------------------------------
// task: get
// ----------------------------------------
{
displayName: 'Task ID',
name: 'taskId',
description: 'ID of the task to retrieve',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['task'],
operation: ['get'],
},
},
},
// ----------------------------------------
// task: getAll
// ----------------------------------------
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
default: false,
description: 'Whether to return all results or only up to a given limit',
displayOptions: {
show: {
resource: ['task'],
operation: ['getAll'],
},
},
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
default: 50,
description: 'Max number of results to return',
typeOptions: {
minValue: 1,
},
displayOptions: {
show: {
resource: ['task'],
operation: ['getAll'],
returnAll: [false],
},
},
},
{
displayName: 'Filters',
name: 'filters',
type: 'collection',
default: {},
placeholder: 'Add Filter',
displayOptions: {
show: {
resource: ['task'],
operation: ['getAll'],
},
},
options: [
{
displayName: 'Include',
name: 'include',
type: 'options',
default: 'owner',
options: [
{
name: 'Owner',
value: 'owner',
},
{
name: 'Target',
value: 'targetable',
},
{
name: 'Users',
value: 'users',
},
],
},
{
displayName: 'Status',
name: 'filter',
type: 'options',
default: 'open',
options: [
{
name: 'Completed',
value: 'completed',
},
{
name: 'Due Today',
value: 'due_today',
},
{
name: 'Due Tomorrow',
value: 'due_tomorrow',
},
{
name: 'Open',
value: 'open',
},
{
name: 'Overdue',
value: 'overdue',
},
],
},
],
},
// ----------------------------------------
// task: update
// ----------------------------------------
{
displayName: 'Task ID',
name: 'taskId',
description: 'ID of the task to update',
type: 'string',
required: true,
default: '',
displayOptions: {
show: {
resource: ['task'],
operation: ['update'],
},
},
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
resource: ['task'],
operation: ['update'],
},
},
options: [
{
displayName: 'Creator Name or ID',
name: 'creater_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
description:
'ID of the user who created the sales activity. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Due Date',
name: 'dueDate',
description: 'Timestamp that denotes when the task is due to be completed',
type: 'dateTime',
default: '',
},
{
displayName: 'Outcome Name or ID',
name: 'outcome_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getOutcomes',
},
description:
'ID of the outcome of the task. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Owner Name or ID',
name: 'owner_id',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
description:
'ID of the user to whom the task is assigned. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
},
{
displayName: 'Target ID',
name: 'targetable_id',
type: 'string',
default: '',
description:
'ID of the entity for which the task is updated. The type of entity is selected in "Target Type".',
},
{
displayName: 'Target Type',
name: 'targetable_type',
description: 'Type of the entity for which the task is updated',
type: 'options',
default: 'Contact',
options: [
{
name: 'Contact',
value: 'Contact',
},
{
name: 'Deal',
value: 'Deal',
},
{
name: 'SalesAccount',
value: 'SalesAccount',
},
],
},
{
displayName: 'Task Type ID',
name: 'task_type_id',
type: 'string', // not obtainable from API
default: '',
description: 'ID of the type of task',
},
{
displayName: 'Title',
name: 'title',
type: 'string',
default: '',
description: 'Title of the task',
},
],
},
];
@@ -0,0 +1,8 @@
export * from './AccountDescription';
export * from './AppointmentDescription';
export * from './ContactDescription';
export * from './DealDescription';
export * from './NoteDescription';
export * from './SalesActivityDescription';
export * from './SearchDescription';
export * from './TaskDescription';
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" id="layer" width="102.6" height="102.6" version="1.1"><style id="style108" type="text/css">.st1{fill:#9b65c3}.st14{fill:#8bdf55}</style><g id="g168" transform="translate(-21.6 -279.3)"><path id="path130" d="M22.2 338.2c1.7 11.1 6.9 21.1 14.4 28.6l17.5-17.5c0-17.7 9.2-34.9 25.6-44.4z" class="st1"/><path id="path132" d="M54.1 349.3c-8.7 0-17.5-2.2-25.6-6.9-2.2-1.3-4.3-2.7-6.3-4.3 1.7 11.1 6.9 21.1 14.4 28.6z" class="st1"/><path id="path134" d="m54.1 349.3-17.5 17.5c7.6 7.6 17.5 12.8 28.6 14.4l33.2-57.5c-9.4 16.4-26.6 25.6-44.3 25.6" style="fill:#be63c5"/><path id="path136" d="M61 375c-4.7-8.1-6.9-16.9-6.9-25.6l-17.5 17.5c7.6 7.6 17.5 12.8 28.6 14.4q-2.25-3-4.2-6.3" style="fill:#bf63c6"/><path id="path138" d="M119.3 282.1 79.8 305c-16.4 9.5-35.9 8.8-51.2 0-4.4 7.5-6.9 16.3-6.9 25.6 0 2.6.2 5.1.6 7.6 2 1.6 4.1 3 6.3 4.3 8.1 4.7 16.9 6.9 25.6 6.9l66.2-66.2c-.4-.4-.7-.8-1.1-1.1" style="fill:#3278b1"/><path id="path140" d="M28.5 342.5c8.1 4.7 16.9 6.9 25.6 6.9 0-17.7 9.2-34.9 25.6-44.4l-57.6 33.2c2.1 1.5 4.2 3 6.4 4.3" style="fill:#3278b2"/><path id="path142" d="M28.5 305c-4.4 7.5-6.9 16.3-6.9 25.6 0 2.6.2 5.1.6 7.6L79.8 305c-16.5 9.4-36 8.8-51.3 0" style="fill:#45a4ec"/><path id="path144" d="M120.4 283.1c-.3-.3-.7-.7-1.1-1-.5-.4-1-.8-1.6-1.1-1.9-1.1-4.1-1.7-6.4-1.7H72.9c-19 0-35.5 10.3-44.4 25.6 15.3 8.8 34.8 9.5 51.2 0-16.4 9.5-25.6 26.7-25.6 44.4 17.7 0 34.9-9.2 44.4-25.6l22.8-39.5c-.3-.4-.6-.8-.9-1.1" style="fill:#19bb7d"/><path id="path146" d="m79.8 305 39.5-22.8c-.5-.4-1-.8-1.6-1.1L28.5 305c15.3 8.8 34.8 9.4 51.3 0" style="fill:#08c7fb"/><path id="path148" d="M111.3 279.3H72.9c-19 0-35.5 10.3-44.4 25.6l89.2-23.9c-1.9-1-4-1.7-6.4-1.7" style="fill:#59f2f6"/><path id="path152" d="m98.5 323.7 22.8-39.5c-.3-.4-.6-.7-1-1.1l-66.2 66.2c0 8.7 2.2 17.5 6.9 25.6 1.3 2.2 2.7 4.3 4.3 6.3 2.5.4 5 .6 7.6.6 9.3 0 18.1-2.5 25.6-6.9-8.8-15.3-9.5-34.8 0-51.2" style="fill:#da3757"/><path id="path154" d="M54.1 349.3c0 8.7 2.2 17.5 6.9 25.6 1.3 2.2 2.7 4.3 4.3 6.3l33.2-57.5c-9.5 16.4-26.7 25.6-44.4 25.6" style="fill:#d33c4e"/><path id="path156" d="m98.5 323.7-33.2 57.6c2.5.4 5 .6 7.6.6 9.3 0 18.1-2.5 25.6-6.9-8.8-15.4-9.5-34.9 0-51.3" style="fill:#ee5a24"/><path id="path158" d="M122.4 285.8c-.3-.6-.7-1.1-1.1-1.6-.3-.4-.6-.7-1-1.1-.3-.3-.7-.7-1.1-1L79.8 305c-16.4 9.5-25.6 26.7-25.6 44.4 17.7 0 34.9-9.2 44.4-25.6-9.5 16.4-8.8 35.9 0 51.2 15.3-8.9 25.6-25.4 25.6-44.4v-38.4c-.1-2.4-.7-4.6-1.8-6.4" class="st14"/><path id="path160" d="M119.3 282.1 79.8 305c-16.4 9.5-25.6 26.7-25.6 44.4l66.2-66.2c-.4-.4-.7-.8-1.1-1.1" style="fill:#25c16f"/><path id="path162" d="M54.1 349.3c17.7 0 34.9-9.2 44.4-25.6l22.8-39.5c-.3-.4-.6-.7-1-1.1z" class="st14"/><path id="path164" d="m121.3 284.2-22.8 39.5c-9.5 16.4-8.8 35.9 0 51.2l23.9-89.2c-.3-.5-.7-1-1.1-1.5" style="fill:#fb0"/><path id="path166" d="M98.5 375c15.3-8.9 25.6-25.4 25.6-44.4v-38.4c0-2.3-.6-4.5-1.7-6.4z" style="fill:#ffa800"/></g></svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

@@ -0,0 +1,48 @@
export type FreshworksCrmApiCredentials = {
apiKey: string;
domain: string;
};
export type FreshworksConfigResponse<T> = {
[key: string]: T[];
};
export type LoadedResource = {
id: string;
name: string;
};
export type LoadOption = {
name: string;
value: string;
};
export type LoadedCurrency = {
currency_code: string;
id: string;
};
export type LoadedUser = {
id: string;
display_name: string;
};
export type SalesAccounts = {
sales_accounts?: number[];
};
export type ViewsResponse = {
filters: View[];
meta: object;
};
export type View = {
id: number;
name: string;
model_class_name: string;
user_id: number;
is_default: boolean;
updated_at: string;
user_name: string;
current_user_permissions: string[];
};