mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-10 06:34:05 -08:00
⚡ Fixes to CustomerIo-Node
This commit is contained in:
parent
c1b8811772
commit
5aec61bb18
|
@ -9,7 +9,7 @@ export class CustomerIoApi implements ICredentialType {
|
||||||
displayName = 'Customer.io API';
|
displayName = 'Customer.io API';
|
||||||
properties = [
|
properties = [
|
||||||
{
|
{
|
||||||
displayName: 'API Key',
|
displayName: 'App API Key',
|
||||||
name: 'apiKey',
|
name: 'apiKey',
|
||||||
type: 'string' as NodePropertyTypes,
|
type: 'string' as NodePropertyTypes,
|
||||||
default: '',
|
default: '',
|
||||||
|
|
|
@ -15,7 +15,7 @@ import {
|
||||||
eventExists,
|
eventExists,
|
||||||
} from './GenericFunctions';
|
} from './GenericFunctions';
|
||||||
|
|
||||||
interface IEvent{
|
interface IEvent {
|
||||||
customer?: IDataObject;
|
customer?: IDataObject;
|
||||||
email?: IDataObject;
|
email?: IDataObject;
|
||||||
push?: IDataObject;
|
push?: IDataObject;
|
||||||
|
@ -27,14 +27,14 @@ interface IEvent{
|
||||||
export class CustomerIoTrigger implements INodeType {
|
export class CustomerIoTrigger implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
displayName: 'Customer.io Trigger',
|
displayName: 'Customer.io Trigger',
|
||||||
name: 'customerIo',
|
name: 'customerIoTrigger',
|
||||||
group: ['trigger'],
|
group: ['trigger'],
|
||||||
icon: 'file:customer.Io.png',
|
icon: 'file:customerio.png',
|
||||||
version: 1,
|
version: 1,
|
||||||
description: 'Starts the workflow on a Customer.io update. (Beta)',
|
description: 'Starts the workflow on a Customer.io update. (Beta)',
|
||||||
defaults: {
|
defaults: {
|
||||||
name: 'Customer.io Trigger',
|
name: 'Customer.io Trigger',
|
||||||
color: '#00FF00',
|
color: '#7131ff',
|
||||||
},
|
},
|
||||||
inputs: [],
|
inputs: [],
|
||||||
outputs: ['main'],
|
outputs: ['main'],
|
||||||
|
@ -57,6 +57,7 @@ export class CustomerIoTrigger implements INodeType {
|
||||||
displayName: 'Events',
|
displayName: 'Events',
|
||||||
name: 'events',
|
name: 'events',
|
||||||
type: 'multiOptions',
|
type: 'multiOptions',
|
||||||
|
required: true,
|
||||||
default: [],
|
default: [],
|
||||||
description: 'The events that can trigger the webhook and whether they are enabled.',
|
description: 'The events that can trigger the webhook and whether they are enabled.',
|
||||||
options: [
|
options: [
|
||||||
|
@ -245,8 +246,8 @@ export class CustomerIoTrigger implements INodeType {
|
||||||
for (const webhook of webhooks) {
|
for (const webhook of webhooks) {
|
||||||
if (webhook.endpoint === webhookUrl &&
|
if (webhook.endpoint === webhookUrl &&
|
||||||
eventExists(currentEvents, webhook.events)) {
|
eventExists(currentEvents, webhook.events)) {
|
||||||
webhookData.webhookId = webhook.id;
|
webhookData.webhookId = webhook.id;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,9 +55,9 @@ export async function apiRequest(this: IHookFunctions | IExecuteFunctions | ILoa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function eventExists (currentEvents : string[], webhookEvents: IDataObject) {
|
export function eventExists(currentEvents: string[], webhookEvents: IDataObject) {
|
||||||
for (const currentEvent of currentEvents) {
|
for (const currentEvent of currentEvents) {
|
||||||
if (get(webhookEvents, `${currentEvent.split('.')[0]}.${currentEvent.split('.')[1]}`) !== true) {
|
if (get(webhookEvents, `${currentEvent.split('.')[0]}.${currentEvent.split('.')[1]}`) !== true) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.7 KiB |
Loading…
Reference in a new issue