Add Customer.io-Node (#833)

* 🚧 Descriptions, node function, generic function changes

*  Finished functionality, added icon

*  Added new campaign operations, acommodated for 2 different authentications

*  Fixed number defaults not being numbers but empty strings
This commit is contained in:
Rupenieks
2020-09-02 12:25:11 +02:00
committed by GitHub
parent 0e1a4e5309
commit e5a5e1ed11
10 changed files with 1301 additions and 12 deletions

View File

@@ -11,7 +11,7 @@ import {
} from 'n8n-workflow';
import {
apiRequest,
customerIoApiRequest,
eventExists,
} from './GenericFunctions';
@@ -34,7 +34,7 @@ export class CustomerIoTrigger implements INodeType {
description: 'Starts the workflow on a Customer.io update. (Beta)',
defaults: {
name: 'Customer.io Trigger',
color: '#7131ff',
color: '#ffcd00',
},
inputs: [],
outputs: ['main'],
@@ -237,7 +237,7 @@ export class CustomerIoTrigger implements INodeType {
const endpoint = '/reporting_webhooks';
let { reporting_webhooks: webhooks } = await apiRequest.call(this, 'GET', endpoint, {});
let { reporting_webhooks: webhooks } = await customerIoApiRequest.call(this, 'GET', endpoint, {}, 'beta');
if (webhooks === null) {
webhooks = [];
@@ -295,7 +295,7 @@ export class CustomerIoTrigger implements INodeType {
events: data,
};
webhook = await apiRequest.call(this, 'POST', endpoint, body);
webhook = await customerIoApiRequest.call(this, 'POST', endpoint, body, 'beta');
const webhookData = this.getWorkflowStaticData('node');
webhookData.webhookId = webhook.id as string;
@@ -307,7 +307,7 @@ export class CustomerIoTrigger implements INodeType {
if (webhookData.webhookId !== undefined) {
const endpoint = `/reporting_webhooks/${webhookData.webhookId}`;
try {
await apiRequest.call(this, 'DELETE', endpoint, {});
await customerIoApiRequest.call(this, 'DELETE', endpoint, {}, 'beta');
} catch (e) {
return false;
}