2023-01-27 03:22:44 -08:00
|
|
|
import type {
|
2023-03-09 09:13:15 -08:00
|
|
|
IExecuteFunctions,
|
2021-07-30 07:12:30 -07:00
|
|
|
IDataObject,
|
|
|
|
ILoadOptionsFunctions,
|
|
|
|
INodeExecutionData,
|
|
|
|
INodeType,
|
|
|
|
INodeTypeDescription,
|
|
|
|
} from 'n8n-workflow';
|
|
|
|
|
2022-08-01 13:47:55 -07:00
|
|
|
import { tz } from 'moment-timezone';
|
2021-07-30 07:12:30 -07:00
|
|
|
import {
|
|
|
|
adjustAccounts,
|
|
|
|
adjustAttendees,
|
|
|
|
freshworksCrmApiRequest,
|
|
|
|
getAllItemsViewId,
|
|
|
|
handleListing,
|
|
|
|
loadResource,
|
|
|
|
throwOnEmptyUpdate,
|
|
|
|
} from './GenericFunctions';
|
|
|
|
|
|
|
|
import {
|
|
|
|
accountFields,
|
|
|
|
accountOperations,
|
|
|
|
appointmentFields,
|
|
|
|
appointmentOperations,
|
|
|
|
contactFields,
|
|
|
|
contactOperations,
|
|
|
|
dealFields,
|
|
|
|
dealOperations,
|
|
|
|
noteFields,
|
|
|
|
noteOperations,
|
|
|
|
salesActivityFields,
|
|
|
|
salesActivityOperations,
|
2022-07-10 01:37:41 -07:00
|
|
|
searchFields,
|
|
|
|
searchOperations,
|
2021-07-30 07:12:30 -07:00
|
|
|
taskFields,
|
|
|
|
taskOperations,
|
|
|
|
} from './descriptions';
|
|
|
|
|
2023-01-27 03:22:44 -08:00
|
|
|
import type { FreshworksConfigResponse, LoadedCurrency, LoadedUser, LoadOption } from './types';
|
2021-07-30 07:12:30 -07:00
|
|
|
|
|
|
|
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',
|
|
|
|
},
|
|
|
|
inputs: ['main'],
|
|
|
|
outputs: ['main'],
|
|
|
|
credentials: [
|
|
|
|
{
|
|
|
|
name: 'freshworksCrmApi',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
properties: [
|
|
|
|
{
|
|
|
|
displayName: 'Resource',
|
|
|
|
name: 'resource',
|
|
|
|
type: 'options',
|
2022-05-20 14:47:24 -07:00
|
|
|
noDataExpression: true,
|
2021-07-30 07:12:30 -07:00
|
|
|
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',
|
|
|
|
},
|
2022-07-10 01:37:41 -07:00
|
|
|
{
|
|
|
|
name: 'Search',
|
|
|
|
value: 'search',
|
|
|
|
},
|
2021-07-30 07:12:30 -07:00
|
|
|
{
|
|
|
|
name: 'Task',
|
|
|
|
value: 'task',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
default: 'account',
|
|
|
|
},
|
|
|
|
...accountOperations,
|
|
|
|
...accountFields,
|
|
|
|
...appointmentOperations,
|
|
|
|
...appointmentFields,
|
|
|
|
...contactOperations,
|
|
|
|
...contactFields,
|
|
|
|
...dealOperations,
|
|
|
|
...dealFields,
|
|
|
|
...noteOperations,
|
|
|
|
...noteFields,
|
|
|
|
...salesActivityOperations,
|
|
|
|
...salesActivityFields,
|
2022-07-10 01:37:41 -07:00
|
|
|
...searchOperations,
|
|
|
|
...searchFields,
|
2021-07-30 07:12:30 -07:00
|
|
|
...taskOperations,
|
|
|
|
...taskFields,
|
|
|
|
],
|
|
|
|
};
|
|
|
|
|
|
|
|
methods = {
|
|
|
|
loadOptions: {
|
|
|
|
async getAccounts(this: ILoadOptionsFunctions) {
|
|
|
|
const viewId = await getAllItemsViewId.call(this, { fromLoadOptions: true });
|
2022-08-01 13:47:55 -07:00
|
|
|
const responseData = await handleListing.call(
|
|
|
|
this,
|
|
|
|
'GET',
|
|
|
|
`/sales_accounts/view/${viewId}`,
|
|
|
|
);
|
2021-07-30 07:12:30 -07:00
|
|
|
|
|
|
|
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) {
|
2024-01-17 07:08:50 -08:00
|
|
|
return await loadResource.call(this, 'business_types');
|
2021-07-30 07:12:30 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
async getCampaigns(this: ILoadOptionsFunctions) {
|
2024-01-17 07:08:50 -08:00
|
|
|
return await loadResource.call(this, 'campaigns');
|
2021-07-30 07:12:30 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
async getContactStatuses(this: ILoadOptionsFunctions) {
|
2024-01-17 07:08:50 -08:00
|
|
|
return await loadResource.call(this, 'contact_statuses');
|
2021-07-30 07:12:30 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
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) {
|
2022-08-01 13:47:55 -07:00
|
|
|
const response = (await freshworksCrmApiRequest.call(
|
|
|
|
this,
|
|
|
|
'GET',
|
|
|
|
'/selector/currencies',
|
|
|
|
)) as FreshworksConfigResponse<LoadedCurrency>;
|
2021-07-30 07:12:30 -07:00
|
|
|
|
|
|
|
const key = Object.keys(response)[0];
|
|
|
|
|
|
|
|
return response[key].map(({ currency_code, id }) => ({ name: currency_code, value: id }));
|
|
|
|
},
|
|
|
|
|
|
|
|
async getDealPaymentStatuses(this: ILoadOptionsFunctions) {
|
2024-01-17 07:08:50 -08:00
|
|
|
return await loadResource.call(this, 'deal_payment_statuses');
|
2021-07-30 07:12:30 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
async getDealPipelines(this: ILoadOptionsFunctions) {
|
2024-01-17 07:08:50 -08:00
|
|
|
return await loadResource.call(this, 'deal_pipelines');
|
2021-07-30 07:12:30 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
async getDealProducts(this: ILoadOptionsFunctions) {
|
2024-01-17 07:08:50 -08:00
|
|
|
return await loadResource.call(this, 'deal_products');
|
2021-07-30 07:12:30 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
async getDealReasons(this: ILoadOptionsFunctions) {
|
2024-01-17 07:08:50 -08:00
|
|
|
return await loadResource.call(this, 'deal_reasons');
|
2021-07-30 07:12:30 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
async getDealStages(this: ILoadOptionsFunctions) {
|
2024-01-17 07:08:50 -08:00
|
|
|
return await loadResource.call(this, 'deal_stages');
|
2021-07-30 07:12:30 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
async getDealTypes(this: ILoadOptionsFunctions) {
|
2024-01-17 07:08:50 -08:00
|
|
|
return await loadResource.call(this, 'deal_types');
|
2021-07-30 07:12:30 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
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) {
|
2024-01-17 07:08:50 -08:00
|
|
|
return await loadResource.call(this, 'industry_types');
|
2021-07-30 07:12:30 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
async getLifecycleStages(this: ILoadOptionsFunctions) {
|
2024-01-17 07:08:50 -08:00
|
|
|
return await loadResource.call(this, 'lifecycle_stages');
|
2021-07-30 07:12:30 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
async getOutcomes(this: ILoadOptionsFunctions) {
|
2024-01-17 07:08:50 -08:00
|
|
|
return await loadResource.call(this, 'sales_activity_outcomes');
|
2021-07-30 07:12:30 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
async getSalesActivityTypes(this: ILoadOptionsFunctions) {
|
2024-01-17 07:08:50 -08:00
|
|
|
return await loadResource.call(this, 'sales_activity_types');
|
2021-07-30 07:12:30 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
async getTerritories(this: ILoadOptionsFunctions) {
|
2024-01-17 07:08:50 -08:00
|
|
|
return await loadResource.call(this, 'territories');
|
2021-07-30 07:12:30 -07:00
|
|
|
},
|
|
|
|
|
2022-08-01 13:47:55 -07:00
|
|
|
async getUsers(this: ILoadOptionsFunctions) {
|
|
|
|
// for attendees, owners, and creators
|
|
|
|
const response = (await freshworksCrmApiRequest.call(
|
|
|
|
this,
|
|
|
|
'GET',
|
2022-12-29 03:20:43 -08:00
|
|
|
'/selector/owners',
|
2022-08-01 13:47:55 -07:00
|
|
|
)) as FreshworksConfigResponse<LoadedUser>;
|
2021-07-30 07:12:30 -07:00
|
|
|
|
|
|
|
const key = Object.keys(response)[0];
|
|
|
|
|
2022-08-01 13:47:55 -07:00
|
|
|
return response[key].map(({ display_name, id }) => ({ name: display_name, value: id }));
|
2021-07-30 07:12:30 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
|
|
|
const items = this.getInputData();
|
2022-08-30 08:55:33 -07:00
|
|
|
const returnData: INodeExecutionData[] = [];
|
2021-07-30 07:12:30 -07:00
|
|
|
|
2022-12-02 03:53:59 -08:00
|
|
|
const resource = this.getNodeParameter('resource', 0);
|
|
|
|
const operation = this.getNodeParameter('operation', 0);
|
2021-07-30 07:12:30 -07:00
|
|
|
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;
|
|
|
|
|
2022-11-18 07:29:44 -08:00
|
|
|
const additionalFields = this.getNodeParameter('additionalFields', i);
|
2021-07-30 07:12:30 -07:00
|
|
|
|
|
|
|
if (Object.keys(additionalFields).length) {
|
|
|
|
Object.assign(body, additionalFields);
|
|
|
|
}
|
|
|
|
|
2022-08-01 13:47:55 -07:00
|
|
|
responseData = await freshworksCrmApiRequest.call(
|
|
|
|
this,
|
|
|
|
'POST',
|
|
|
|
'/sales_accounts',
|
|
|
|
body,
|
|
|
|
);
|
2021-07-30 07:12:30 -07:00
|
|
|
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;
|
2022-11-18 07:29:44 -08:00
|
|
|
const updateFields = this.getNodeParameter('updateFields', i);
|
2021-07-30 07:12:30 -07:00
|
|
|
|
|
|
|
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;
|
2022-08-01 13:47:55 -07:00
|
|
|
const attendees = this.getNodeParameter('attendees.attendee', i, []) as [
|
|
|
|
{ type: string; contactId: string; userId: string },
|
|
|
|
];
|
2021-07-30 07:12:30 -07:00
|
|
|
|
|
|
|
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(),
|
2022-08-01 13:47:55 -07:00
|
|
|
end_date: allDay ? start.format() : end.format(),
|
2021-07-30 07:12:30 -07:00
|
|
|
} as IDataObject;
|
|
|
|
|
|
|
|
Object.assign(body, additionalFields);
|
|
|
|
|
|
|
|
if (attendees.length) {
|
2022-12-02 12:54:28 -08:00
|
|
|
body.appointment_attendees_attributes = adjustAttendees(attendees);
|
2021-07-30 07:12:30 -07:00
|
|
|
}
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
2022-08-01 13:47:55 -07:00
|
|
|
const attendees = this.getNodeParameter('updateFields.attendees.attendee', i, []) as [
|
|
|
|
{ type: string; contactId: string; userId: string },
|
|
|
|
];
|
2021-07-30 07:12:30 -07:00
|
|
|
|
|
|
|
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) {
|
2022-12-02 12:54:28 -08:00
|
|
|
body.appointment_attendees_attributes = adjustAttendees(attendees);
|
2021-07-30 07:12:30 -07:00
|
|
|
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;
|
|
|
|
|
2022-11-18 07:29:44 -08:00
|
|
|
const additionalFields = this.getNodeParameter('additionalFields', i);
|
2021-07-30 07:12:30 -07:00
|
|
|
|
|
|
|
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;
|
2022-11-18 07:29:44 -08:00
|
|
|
const updateFields = this.getNodeParameter('updateFields', i);
|
2021-07-30 07:12:30 -07:00
|
|
|
|
|
|
|
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;
|
|
|
|
|
2022-11-18 07:29:44 -08:00
|
|
|
const additionalFields = this.getNodeParameter('additionalFields', i);
|
2021-07-30 07:12:30 -07:00
|
|
|
|
|
|
|
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;
|
2022-11-18 07:29:44 -08:00
|
|
|
const updateFields = this.getNodeParameter('updateFields', i);
|
2021-07-30 07:12:30 -07:00
|
|
|
|
|
|
|
if (Object.keys(updateFields).length) {
|
|
|
|
Object.assign(body, adjustAccounts(updateFields));
|
|
|
|
} else {
|
|
|
|
throwOnEmptyUpdate.call(this, resource);
|
|
|
|
}
|
|
|
|
|
|
|
|
const dealId = this.getNodeParameter('dealId', i);
|
|
|
|
|
2022-08-01 13:47:55 -07:00
|
|
|
responseData = await freshworksCrmApiRequest.call(
|
|
|
|
this,
|
|
|
|
'PUT',
|
|
|
|
`/deals/${dealId}`,
|
|
|
|
body,
|
|
|
|
);
|
2021-07-30 07:12:30 -07:00
|
|
|
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;
|
2022-11-18 07:29:44 -08:00
|
|
|
const updateFields = this.getNodeParameter('updateFields', i);
|
2021-07-30 07:12:30 -07:00
|
|
|
|
|
|
|
if (Object.keys(updateFields).length) {
|
|
|
|
Object.assign(body, updateFields);
|
|
|
|
} else {
|
|
|
|
throwOnEmptyUpdate.call(this, resource);
|
|
|
|
}
|
|
|
|
|
|
|
|
const noteId = this.getNodeParameter('noteId', i);
|
|
|
|
|
2022-08-01 13:47:55 -07:00
|
|
|
responseData = await freshworksCrmApiRequest.call(
|
|
|
|
this,
|
|
|
|
'PUT',
|
|
|
|
`/notes/${noteId}`,
|
|
|
|
body,
|
|
|
|
);
|
2021-07-30 07:12:30 -07:00
|
|
|
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;
|
|
|
|
|
2022-11-18 07:29:44 -08:00
|
|
|
const additionalFields = this.getNodeParameter('additionalFields', i);
|
2021-07-30 07:12:30 -07:00
|
|
|
|
|
|
|
if (Object.keys(additionalFields).length) {
|
|
|
|
Object.assign(body, additionalFields);
|
|
|
|
}
|
|
|
|
|
2022-08-01 13:47:55 -07:00
|
|
|
responseData = await freshworksCrmApiRequest.call(this, 'POST', '/sales_activities', {
|
|
|
|
sales_activity: body,
|
|
|
|
});
|
2021-07-30 07:12:30 -07:00
|
|
|
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;
|
|
|
|
}
|
2022-07-10 01:37:41 -07:00
|
|
|
} 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;
|
2022-08-01 13:47:55 -07:00
|
|
|
let fieldValue = this.getNodeParameter('fieldValue', i, '') as string;
|
|
|
|
let entities = this.getNodeParameter('options.entities', i) as string;
|
2022-07-10 01:37:41 -07:00
|
|
|
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);
|
|
|
|
}
|
2021-07-30 07:12:30 -07:00
|
|
|
} 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;
|
|
|
|
|
2022-11-18 07:29:44 -08:00
|
|
|
const additionalFields = this.getNodeParameter('additionalFields', i);
|
2021-07-30 07:12:30 -07:00
|
|
|
|
|
|
|
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;
|
2022-11-18 07:29:44 -08:00
|
|
|
const updateFields = this.getNodeParameter('updateFields', i);
|
2021-07-30 07:12:30 -07:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2022-08-01 13:47:55 -07:00
|
|
|
responseData = await freshworksCrmApiRequest.call(
|
|
|
|
this,
|
|
|
|
'PUT',
|
|
|
|
`/tasks/${taskId}`,
|
|
|
|
body,
|
|
|
|
);
|
2021-07-30 07:12:30 -07:00
|
|
|
responseData = responseData.task;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (error) {
|
|
|
|
if (this.continueOnFail()) {
|
2022-08-30 08:55:33 -07:00
|
|
|
const executionErrorData = this.helpers.constructExecutionMetaData(
|
|
|
|
this.helpers.returnJsonArray({ error: error.message }),
|
|
|
|
{ itemData: { item: i } },
|
|
|
|
);
|
|
|
|
returnData.push(...executionErrorData);
|
2021-07-30 07:12:30 -07:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
throw error;
|
|
|
|
}
|
|
|
|
|
2022-08-30 08:55:33 -07:00
|
|
|
const executionData = this.helpers.constructExecutionMetaData(
|
2023-02-27 19:39:43 -08:00
|
|
|
this.helpers.returnJsonArray(responseData as IDataObject),
|
2022-08-30 08:55:33 -07:00
|
|
|
{ itemData: { item: i } },
|
|
|
|
);
|
|
|
|
returnData.push(...executionData);
|
2021-07-30 07:12:30 -07:00
|
|
|
}
|
|
|
|
|
2023-09-05 03:59:02 -07:00
|
|
|
return [returnData];
|
2021-07-30 07:12:30 -07:00
|
|
|
}
|
|
|
|
}
|