Renamed to Keap.

This commit is contained in:
ricardo 2020-04-02 19:37:40 -04:00
parent e8a8d31a97
commit 3a71e2c978
21 changed files with 84 additions and 84 deletions

View file

@ -7,12 +7,12 @@ const scopes = [
'full',
];
export class InfusionsoftOAuth2Api implements ICredentialType {
name = 'infusionsoftOAuth2Api';
export class KeapOAuth2Api implements ICredentialType {
name = 'keapOAuth2Api';
extends = [
'oAuth2Api',
];
displayName = 'Infusionsoft OAuth2 API';
displayName = 'Keap OAuth2 API';
properties = [
{
displayName: 'Authorization URL',

View file

@ -17,7 +17,7 @@ export const contactOperations = [
options: [
{
name: 'Create/Update',
value: 'create/update',
value: 'upsert',
description: 'Create/update a contact',
},
{
@ -36,7 +36,7 @@ export const contactOperations = [
description: 'Retrieve all contacts',
},
],
default: 'create/update',
default: 'upsert',
description: 'The operation to perform.',
},
] as INodeProperties[];
@ -44,7 +44,7 @@ export const contactOperations = [
export const contactFields = [
/* -------------------------------------------------------------------------- */
/* contact:create/update */
/* contact:upsert */
/* -------------------------------------------------------------------------- */
{
displayName: 'Duplicate Option',
@ -64,7 +64,7 @@ export const contactFields = [
displayOptions: {
show: {
operation: [
'create/update',
'upsert',
],
resource: [
'contact',
@ -84,7 +84,7 @@ export const contactFields = [
displayOptions: {
show: {
operation: [
'create/update',
'upsert',
],
resource: [
'contact',
@ -250,7 +250,7 @@ export const contactFields = [
'contact',
],
operation: [
'create/update',
'upsert',
],
},
},
@ -349,7 +349,7 @@ export const contactFields = [
'contact',
],
operation: [
'create/update',
'upsert',
],
},
},
@ -403,7 +403,7 @@ export const contactFields = [
'contact',
],
operation: [
'create/update',
'upsert',
],
},
},
@ -453,7 +453,7 @@ export const contactFields = [
'contact',
],
operation: [
'create/update',
'upsert',
],
},
},
@ -515,7 +515,7 @@ export const contactFields = [
'contact',
],
operation: [
'create/update',
'upsert',
],
},
},

View file

@ -17,7 +17,7 @@ import {
snakeCase,
} from 'change-case';
export async function infusionsoftApiRequest(this: IWebhookFunctions | IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, headers: IDataObject = {}, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
export async function keapApiRequest(this: IWebhookFunctions | IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, headers: IDataObject = {}, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
let options: OptionsWithUri = {
headers: {
'Content-Type': 'application/json',
@ -37,7 +37,7 @@ export async function infusionsoftApiRequest(this: IWebhookFunctions | IHookFunc
delete options.body;
}
//@ts-ignore
return await this.helpers.requestOAuth.call(this, 'infusionsoftOAuth2Api', options);
return await this.helpers.requestOAuth.call(this, 'keapOAuth2Api', options);
} catch (error) {
if (error.response && error.response.body && error.response.body.message) {
// Try to return the error prettier
@ -47,7 +47,7 @@ export async function infusionsoftApiRequest(this: IWebhookFunctions | IHookFunc
}
}
export async function infusionsoftApiRequestAllItems(this: IHookFunctions| IExecuteFunctions | ILoadOptionsFunctions, propertyName: string, method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
export async function keapApiRequestAllItems(this: IHookFunctions| IExecuteFunctions | ILoadOptionsFunctions, propertyName: string, method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
const returnData: IDataObject[] = [];
@ -56,7 +56,7 @@ export async function infusionsoftApiRequestAllItems(this: IHookFunctions| IExec
query.limit = 50;
do {
responseData = await infusionsoftApiRequest.call(this, method, endpoint, body, query, uri);
responseData = await keapApiRequest.call(this, method, endpoint, body, query, uri);
uri = responseData.next;
returnData.push.apply(returnData, responseData[propertyName]);
} while (

View file

@ -13,8 +13,8 @@ import {
} from 'n8n-workflow';
import {
infusionsoftApiRequest,
infusionsoftApiRequestAllItems,
keapApiRequest,
keapApiRequestAllItems,
keysToSnakeCase,
} from './GenericFunctions';
@ -101,24 +101,24 @@ import {
import * as moment from 'moment-timezone';
export class Infusionsoft implements INodeType {
export class Keap implements INodeType {
description: INodeTypeDescription = {
displayName: 'Infusionsoft',
name: ' infusionsoft',
icon: 'file:infusionsoft.png',
displayName: 'Keap',
name: ' keap',
icon: 'file:keap.png',
group: ['input'],
version: 1,
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
description: 'Consume Infusionsoft API.',
description: 'Consume Keap API.',
defaults: {
name: 'Infusionsoft',
name: 'Keap',
color: '#79af53',
},
inputs: ['main'],
outputs: ['main'],
credentials: [
{
name: 'infusionsoftOAuth2Api',
name: 'keapOAuth2Api',
required: true,
},
],
@ -197,7 +197,7 @@ export class Infusionsoft implements INodeType {
// select them easily
async getTags(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
const returnData: INodePropertyOptions[] = [];
const tags = await infusionsoftApiRequestAllItems.call(this, 'tags', 'GET', '/tags');
const tags = await keapApiRequestAllItems.call(this, 'tags', 'GET', '/tags');
for (const tag of tags) {
const tagName = tag.name;
const tagId = tag.id;
@ -212,7 +212,7 @@ export class Infusionsoft implements INodeType {
// select them easily
async getUsers(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
const returnData: INodePropertyOptions[] = [];
const users = await infusionsoftApiRequestAllItems.call(this, 'users', 'GET', '/users');
const users = await keapApiRequestAllItems.call(this, 'users', 'GET', '/users');
for (const user of users) {
const userName = user.given_name;
const userId = user.id;
@ -227,7 +227,7 @@ export class Infusionsoft implements INodeType {
// select them easily
async getCountries(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
const returnData: INodePropertyOptions[] = [];
const { countries } = await infusionsoftApiRequest.call(this, 'GET', '/locales/countries');
const { countries } = await keapApiRequest.call(this, 'GET', '/locales/countries');
for (const key of Object.keys(countries)) {
const countryName = countries[key];
const countryId = key;
@ -243,7 +243,7 @@ export class Infusionsoft implements INodeType {
async getProvinces(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
const countryCode = this.getCurrentNodeParameter('countryCode') as string;
const returnData: INodePropertyOptions[] = [];
const { provinces } = await infusionsoftApiRequest.call(this, 'GET', `/locales/countries/${countryCode}/provinces`);
const { provinces } = await keapApiRequest.call(this, 'GET', `/locales/countries/${countryCode}/provinces`);
for (const key of Object.keys(provinces)) {
const provinceName = provinces[key];
const provinceId = key;
@ -258,7 +258,7 @@ export class Infusionsoft implements INodeType {
// select them easily
async getContactTypes(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
const returnData: INodePropertyOptions[] = [];
const types = await infusionsoftApiRequest.call(this, 'GET', '/setting/contact/optionTypes');
const types = await keapApiRequest.call(this, 'GET', '/setting/contact/optionTypes');
for (const type of types.value.split(',')) {
const typeName = type;
const typeId = type;
@ -296,7 +296,7 @@ export class Infusionsoft implements INodeType {
const operation = this.getNodeParameter('operation', 0) as string;
for (let i = 0; i < length; i++) {
if (resource === 'company') {
//https://developer.infusionsoft.com/docs/rest/#!/Company/createCompanyUsingPOST
//https://developer.keap.com/docs/rest/#!/Company/createCompanyUsingPOST
if (operation === 'create') {
const addresses = (this.getNodeParameter('addressesUi', i) as IDataObject).addressesValues as IDataObject[];
const faxes = (this.getNodeParameter('faxesUi', i) as IDataObject).faxesValues as IDataObject[];
@ -317,7 +317,7 @@ export class Infusionsoft implements INodeType {
if (phones) {
body.phone_number = phones[0];
}
responseData = await infusionsoftApiRequest.call(this, 'POST', '/companies', body);
responseData = await keapApiRequest.call(this, 'POST', '/companies', body);
}
//https://developer.infusionsoft.com/docs/rest/#!/Company/listCompaniesUsingGET
if (operation === 'getAll') {
@ -330,17 +330,17 @@ export class Infusionsoft implements INodeType {
delete qs.fields;
}
if (returnAll) {
responseData = await infusionsoftApiRequestAllItems.call(this, 'companies', 'GET', '/companies', {}, qs);
responseData = await keapApiRequestAllItems.call(this, 'companies', 'GET', '/companies', {}, qs);
} else {
qs.limit = this.getNodeParameter('limit', i) as number;
responseData = await infusionsoftApiRequest.call(this, 'GET', '/companies', {}, qs);
responseData = await keapApiRequest.call(this, 'GET', '/companies', {}, qs);
responseData = responseData.companies;
}
}
}
if (resource === 'contact') {
//https://developer.infusionsoft.com/docs/rest/#!/Contact/createOrUpdateContactUsingPUT
if (operation === 'create/update') {
if (operation === 'upsert') {
const duplicateOption = this.getNodeParameter('duplicateOption', i) as string;
const addresses = (this.getNodeParameter('addressesUi', i) as IDataObject).addressesValues as IDataObject[];
const emails = (this.getNodeParameter('emailsUi', i) as IDataObject).emailsValues as IDataObject[];
@ -421,12 +421,12 @@ export class Infusionsoft implements INodeType {
if (phones) {
body.phone_numbers = phones as IPhone[];
}
responseData = await infusionsoftApiRequest.call(this, 'PUT', '/contacts', body);
responseData = await keapApiRequest.call(this, 'PUT', '/contacts', body);
}
//https://developer.infusionsoft.com/docs/rest/#!/Contact/deleteContactUsingDELETE
if (operation === 'delete') {
const contactId = parseInt(this.getNodeParameter('contactId', i) as string, 10);
responseData = await infusionsoftApiRequest.call(this, 'DELETE', `/contacts/${contactId}`);
responseData = await keapApiRequest.call(this, 'DELETE', `/contacts/${contactId}`);
responseData = { success: true };
}
//https://developer.infusionsoft.com/docs/rest/#!/Contact/getContactUsingGET
@ -436,7 +436,7 @@ export class Infusionsoft implements INodeType {
if (options.fields) {
qs.optional_properties = options.fields as string;
}
responseData = await infusionsoftApiRequest.call(this, 'GET', `/contacts/${contactId}`, {}, qs);
responseData = await keapApiRequest.call(this, 'GET', `/contacts/${contactId}`, {}, qs);
}
//https://developer.infusionsoft.com/docs/rest/#!/Contact/listContactsUsingGET
if (operation === 'getAll') {
@ -464,10 +464,10 @@ export class Infusionsoft implements INodeType {
qs.until = options.until as string;
}
if (returnAll) {
responseData = await infusionsoftApiRequestAllItems.call(this, 'contacts', 'GET', '/contacts', {}, qs);
responseData = await keapApiRequestAllItems.call(this, 'contacts', 'GET', '/contacts', {}, qs);
} else {
qs.limit = this.getNodeParameter('limit', i) as number;
responseData = await infusionsoftApiRequest.call(this, 'GET', '/contacts', {}, qs);
responseData = await keapApiRequest.call(this, 'GET', '/contacts', {}, qs);
responseData = responseData.contacts;
}
}
@ -487,18 +487,18 @@ export class Infusionsoft implements INodeType {
additionalFields.type = pascalCase(additionalFields.type as string);
}
Object.assign(body, additionalFields);
responseData = await infusionsoftApiRequest.call(this, 'POST', '/notes', body);
responseData = await keapApiRequest.call(this, 'POST', '/notes', body);
}
//https://developer.infusionsoft.com/docs/rest/#!/Note/deleteNoteUsingDELETE
if (operation === 'delete') {
const noteId = this.getNodeParameter('noteId', i) as string;
responseData = await infusionsoftApiRequest.call(this, 'DELETE', `/notes/${noteId}`);
responseData = await keapApiRequest.call(this, 'DELETE', `/notes/${noteId}`);
responseData = { success: true };
}
//https://developer.infusionsoft.com/docs/rest/#!/Note/getNoteUsingGET
if (operation === 'get') {
const noteId = this.getNodeParameter('noteId', i) as string;
responseData = await infusionsoftApiRequest.call(this, 'GET', `/notes/${noteId}`);
responseData = await keapApiRequest.call(this, 'GET', `/notes/${noteId}`);
}
//https://developer.infusionsoft.com/docs/rest/#!/Note/listNotesUsingGET
if (operation === 'getAll') {
@ -507,10 +507,10 @@ export class Infusionsoft implements INodeType {
keysToSnakeCase(filters);
Object.assign(qs, filters);
if (returnAll) {
responseData = await infusionsoftApiRequestAllItems.call(this, 'notes', 'GET', '/notes', {}, qs);
responseData = await keapApiRequestAllItems.call(this, 'notes', 'GET', '/notes', {}, qs);
} else {
qs.limit = this.getNodeParameter('limit', i) as number;
responseData = await infusionsoftApiRequest.call(this, 'GET', '/notes', {}, qs);
responseData = await keapApiRequest.call(this, 'GET', '/notes', {}, qs);
responseData = responseData.notes;
}
}
@ -524,7 +524,7 @@ export class Infusionsoft implements INodeType {
additionalFields.type = pascalCase(additionalFields.type as string);
}
Object.assign(body, additionalFields);
responseData = await infusionsoftApiRequest.call(this, 'PATCH', `/notes/${noteId}`, body);
responseData = await keapApiRequest.call(this, 'PATCH', `/notes/${noteId}`, body);
}
}
if (resource === 'contactTag') {
@ -535,14 +535,14 @@ export class Infusionsoft implements INodeType {
const body: IDataObject = {
tagIds,
};
responseData = await infusionsoftApiRequest.call(this, 'POST', `/contacts/${contactId}/tags`, body);
responseData = await keapApiRequest.call(this, 'POST', `/contacts/${contactId}/tags`, body);
}
//https://developer.infusionsoft.com/docs/rest/#!/Contact/removeTagsFromContactUsingDELETE_1
if (operation === 'delete') {
const contactId = parseInt(this.getNodeParameter('contactId', i) as string, 10);
const tagIds = this.getNodeParameter('tagIds', i) as string;
qs.ids = tagIds;
responseData = await infusionsoftApiRequest.call(this, 'DELETE', `/contacts/${contactId}/tags`, {}, qs);
responseData = await keapApiRequest.call(this, 'DELETE', `/contacts/${contactId}/tags`, {}, qs);
responseData = { success: true };
}
//https://developer.infusionsoft.com/docs/rest/#!/Contact/listAppliedTagsUsingGET
@ -550,10 +550,10 @@ export class Infusionsoft implements INodeType {
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
const contactId = parseInt(this.getNodeParameter('contactId', i) as string, 10);
if (returnAll) {
responseData = await infusionsoftApiRequestAllItems.call(this, 'tags', 'GET', `/contacts/${contactId}/tags`, {}, qs);
responseData = await keapApiRequestAllItems.call(this, 'tags', 'GET', `/contacts/${contactId}/tags`, {}, qs);
} else {
qs.limit = this.getNodeParameter('limit', i) as number;
responseData = await infusionsoftApiRequest.call(this, 'GET', `/contacts/${contactId}/tags`, {}, qs);
responseData = await keapApiRequest.call(this, 'GET', `/contacts/${contactId}/tags`, {}, qs);
responseData = responseData.tags;
}
}
@ -583,18 +583,18 @@ export class Infusionsoft implements INodeType {
if (shippingAddress) {
body.shipping_address = keysToSnakeCase(shippingAddress)[0] as IShippingAddress;
}
responseData = await infusionsoftApiRequest.call(this, 'POST', '/orders', body);
responseData = await keapApiRequest.call(this, 'POST', '/orders', body);
}
//https://developer.infusionsoft.com/docs/rest/#!/E-Commerce/deleteOrderUsingDELETE
if (operation === 'delete') {
const orderId = parseInt(this.getNodeParameter('orderId', i) as string, 10);
responseData = await infusionsoftApiRequest.call(this, 'DELETE', `/orders/${orderId}`);
responseData = await keapApiRequest.call(this, 'DELETE', `/orders/${orderId}`);
responseData = { success: true };
}
//https://developer.infusionsoft.com/docs/rest/#!/E-Commerce/getOrderUsingGET
if (operation === 'get') {
const orderId = parseInt(this.getNodeParameter('orderId', i) as string, 10);
responseData = await infusionsoftApiRequest.call(this, 'get', `/orders/${orderId}`);
responseData = await keapApiRequest.call(this, 'get', `/orders/${orderId}`);
}
//https://developer.infusionsoft.com/docs/rest/#!/E-Commerce/listOrdersUsingGET
if (operation === 'getAll') {
@ -603,10 +603,10 @@ export class Infusionsoft implements INodeType {
keysToSnakeCase(options);
Object.assign(qs, options);
if (returnAll) {
responseData = await infusionsoftApiRequestAllItems.call(this, 'orders', 'GET', '/orders', {}, qs);
responseData = await keapApiRequestAllItems.call(this, 'orders', 'GET', '/orders', {}, qs);
} else {
qs.limit = this.getNodeParameter('limit', i) as number;
responseData = await infusionsoftApiRequest.call(this, 'GET', '/orders', {}, qs);
responseData = await keapApiRequest.call(this, 'GET', '/orders', {}, qs);
responseData = responseData.orders;
}
}
@ -621,18 +621,18 @@ export class Infusionsoft implements INodeType {
};
keysToSnakeCase(additionalFields);
Object.assign(body, additionalFields);
responseData = await infusionsoftApiRequest.call(this, 'POST', '/products', body);
responseData = await keapApiRequest.call(this, 'POST', '/products', body);
}
//https://developer.infusionsoft.com/docs/rest/#!/Product/deleteProductUsingDELETE
if (operation === 'delete') {
const productId = this.getNodeParameter('productId', i) as string;
responseData = await infusionsoftApiRequest.call(this, 'DELETE', `/products/${productId}`);
responseData = await keapApiRequest.call(this, 'DELETE', `/products/${productId}`);
responseData = { success: true };
}
//https://developer.infusionsoft.com/docs/rest/#!/Product/retrieveProductUsingGET
if (operation === 'get') {
const productId = this.getNodeParameter('productId', i) as string;
responseData = await infusionsoftApiRequest.call(this, 'get', `/products/${productId}`);
responseData = await keapApiRequest.call(this, 'get', `/products/${productId}`);
}
//https://developer.infusionsoft.com/docs/rest/#!/Product/listProductsUsingGET
if (operation === 'getAll') {
@ -641,10 +641,10 @@ export class Infusionsoft implements INodeType {
keysToSnakeCase(filters);
Object.assign(qs, filters);
if (returnAll) {
responseData = await infusionsoftApiRequestAllItems.call(this, 'products', 'GET', '/products', {}, qs);
responseData = await keapApiRequestAllItems.call(this, 'products', 'GET', '/products', {}, qs);
} else {
qs.limit = this.getNodeParameter('limit', i) as number;
responseData = await infusionsoftApiRequest.call(this, 'GET', '/products', {}, qs);
responseData = await keapApiRequest.call(this, 'GET', '/products', {}, qs);
responseData = responseData.products;
}
}
@ -661,12 +661,12 @@ export class Infusionsoft implements INodeType {
};
Object.assign(body, additionalFields);
keysToSnakeCase(body as IDataObject);
responseData = await infusionsoftApiRequest.call(this, 'POST', '/emails', body);
responseData = await keapApiRequest.call(this, 'POST', '/emails', body);
}
//https://developer.infusionsoft.com/docs/rest/#!/Email/deleteEmailUsingDELETE
if (operation === 'deleteRecord') {
const emailRecordId = parseInt(this.getNodeParameter('emailRecordId', i) as string, 10);
responseData = await infusionsoftApiRequest.call(this, 'DELETE', `/emails/${emailRecordId}`);
responseData = await keapApiRequest.call(this, 'DELETE', `/emails/${emailRecordId}`);
responseData = { success: true };
}
//https://developer.infusionsoft.com/docs/rest/#!/Email/listEmailsUsingGET
@ -676,10 +676,10 @@ export class Infusionsoft implements INodeType {
keysToSnakeCase(filters);
Object.assign(qs, filters);
if (returnAll) {
responseData = await infusionsoftApiRequestAllItems.call(this, 'emails', 'GET', '/emails', {}, qs);
responseData = await keapApiRequestAllItems.call(this, 'emails', 'GET', '/emails', {}, qs);
} else {
qs.limit = this.getNodeParameter('limit', i) as number;
responseData = await infusionsoftApiRequest.call(this, 'GET', '/emails', {}, qs);
responseData = await keapApiRequest.call(this, 'GET', '/emails', {}, qs);
responseData = responseData.emails;
}
}
@ -728,7 +728,7 @@ export class Infusionsoft implements INodeType {
body.attachments = attachments;
}
responseData = await infusionsoftApiRequest.call(this, 'POST', '/emails/queue', body);
responseData = await keapApiRequest.call(this, 'POST', '/emails/queue', body);
responseData = { success: true };
}
}
@ -736,7 +736,7 @@ export class Infusionsoft implements INodeType {
//https://developer.infusionsoft.com/docs/rest/#!/File/deleteFileUsingDELETE
if (operation === 'delete') {
const fileId = parseInt(this.getNodeParameter('fileId', i) as string, 10);
responseData = await infusionsoftApiRequest.call(this, 'DELETE', `/files/${fileId}`);
responseData = await keapApiRequest.call(this, 'DELETE', `/files/${fileId}`);
responseData = { success: true };
}
//https://developer.infusionsoft.com/docs/rest/#!/File/listFilesUsingGET
@ -755,10 +755,10 @@ export class Infusionsoft implements INodeType {
qs.viewable = (qs.viewable as string).toUpperCase();
}
if (returnAll) {
responseData = await infusionsoftApiRequestAllItems.call(this, 'files', 'GET', '/files', {}, qs);
responseData = await keapApiRequestAllItems.call(this, 'files', 'GET', '/files', {}, qs);
} else {
qs.limit = this.getNodeParameter('limit', i) as number;
responseData = await infusionsoftApiRequest.call(this, 'GET', '/files', {}, qs);
responseData = await keapApiRequest.call(this, 'GET', '/files', {}, qs);
responseData = responseData.files;
}
}
@ -797,7 +797,7 @@ export class Infusionsoft implements INodeType {
body.file_name = fileName;
body.file_data = fileData;
}
responseData = await infusionsoftApiRequest.call(this, 'POST', '/files', body);
responseData = await keapApiRequest.call(this, 'POST', '/files', body);
}
}
if (Array.isArray(responseData)) {

View file

@ -13,31 +13,31 @@ import {
} from 'n8n-workflow';
import {
infusionsoftApiRequest,
keapApiRequest,
} from './GenericFunctions';
import {
titleCase,
} from 'change-case';
export class InfusionsoftTrigger implements INodeType {
export class KeapTrigger implements INodeType {
description: INodeTypeDescription = {
displayName: 'Infusionsoft Trigger',
name: 'infusionsoftTrigger',
icon: 'file:infusionsoft.png',
displayName: 'Keap Trigger',
name: 'keapTrigger',
icon: 'file:keap.png',
group: ['trigger'],
version: 1,
subtitle: '={{$parameter["eventId"]}}',
description: 'Starts the workflow when Infusionsoft events occure.',
defaults: {
name: 'Infusionsoft Trigger',
name: 'Keap Trigger',
color: '#79af53',
},
inputs: [],
outputs: ['main'],
credentials: [
{
name: 'infusionsoftOAuth2Api',
name: 'keapOAuth2Api',
required: true,
},
],
@ -76,7 +76,7 @@ export class InfusionsoftTrigger implements INodeType {
// select them easily
async getEvents(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
const returnData: INodePropertyOptions[] = [];
const hooks = await infusionsoftApiRequest.call(this, 'GET', '/hooks/event_keys');
const hooks = await keapApiRequest.call(this, 'GET', '/hooks/event_keys');
for (const hook of hooks) {
const hookName = hook;
const hookId = hook;
@ -98,7 +98,7 @@ export class InfusionsoftTrigger implements INodeType {
const webhookUrl = this.getNodeWebhookUrl('default');
const webhookData = this.getWorkflowStaticData('node');
const responseData = await infusionsoftApiRequest.call(this, 'GET', '/hooks', {});
const responseData = await keapApiRequest.call(this, 'GET', '/hooks', {});
for (const existingData of responseData) {
if (existingData.hookUrl === webhookUrl
@ -122,7 +122,7 @@ export class InfusionsoftTrigger implements INodeType {
hookUrl: webhookUrl,
};
const responseData = await infusionsoftApiRequest.call(this, 'POST', '/hooks', body);
const responseData = await keapApiRequest.call(this, 'POST', '/hooks', body);
if (responseData.key === undefined) {
// Required data is missing so was not successful
@ -139,7 +139,7 @@ export class InfusionsoftTrigger implements INodeType {
if (webhookData.webhookId !== undefined) {
try {
await infusionsoftApiRequest.call(this, 'DELETE', `/hooks/${webhookData.webhookId}`);
await keapApiRequest.call(this, 'DELETE', `/hooks/${webhookData.webhookId}`);
} catch (e) {
return false;
}

View file

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View file

@ -50,8 +50,8 @@
"dist/credentials/HubspotApi.credentials.js",
"dist/credentials/Imap.credentials.js",
"dist/credentials/IntercomApi.credentials.js",
"dist/credentials/InfusionsoftOAuth2Api.credentials.js",
"dist/credentials/JiraSoftwareCloudApi.credentials.js",
"dist/credentials/KeapOAuth2Api.credentials.js",
"dist/credentials/LinkFishApi.credentials.js",
"dist/credentials/MailchimpApi.credentials.js",
"dist/credentials/MailgunApi.credentials.js",
@ -129,9 +129,9 @@
"dist/nodes/If.node.js",
"dist/nodes/Interval.node.js",
"dist/nodes/Intercom/Intercom.node.js",
"dist/nodes/Infusionsoft/Infusionsoft.node.js",
"dist/nodes/Infusionsoft/InfusionsoftTrigger.node.js",
"dist/nodes/Jira/JiraSoftwareCloud.node.js",
"dist/nodes/Keap/Keap.node.js",
"dist/nodes/Keap/KeapTrigger.node.js",
"dist/nodes/LinkFish/LinkFish.node.js",
"dist/nodes/Mailchimp/Mailchimp.node.js",
"dist/nodes/Mailchimp/MailchimpTrigger.node.js",