mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-13 16:14:07 -08:00
⚡ Minor improvements to ConvertKit-Node
This commit is contained in:
parent
8da0f6af4a
commit
426f0ae784
|
@ -6,9 +6,9 @@ import {
|
||||||
import {
|
import {
|
||||||
IDataObject,
|
IDataObject,
|
||||||
INodeExecutionData,
|
INodeExecutionData,
|
||||||
|
INodePropertyOptions,
|
||||||
INodeTypeDescription,
|
INodeTypeDescription,
|
||||||
INodeType,
|
INodeType,
|
||||||
INodePropertyOptions,
|
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -16,28 +16,28 @@ import {
|
||||||
} from './GenericFunctions';
|
} from './GenericFunctions';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
customFieldOperations,
|
|
||||||
customFieldFields,
|
customFieldFields,
|
||||||
|
customFieldOperations,
|
||||||
} from './CustomFieldDescription';
|
} from './CustomFieldDescription';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
formOperations,
|
|
||||||
formFields,
|
formFields,
|
||||||
|
formOperations,
|
||||||
} from './FormDescription';
|
} from './FormDescription';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
sequenceOperations,
|
|
||||||
sequenceFields,
|
sequenceFields,
|
||||||
|
sequenceOperations,
|
||||||
} from './SequenceDescription';
|
} from './SequenceDescription';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
tagOperations,
|
|
||||||
tagFields,
|
tagFields,
|
||||||
|
tagOperations,
|
||||||
} from './TagDescription';
|
} from './TagDescription';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
tagSubscriberOperations,
|
|
||||||
tagSubscriberFields,
|
tagSubscriberFields,
|
||||||
|
tagSubscriberOperations,
|
||||||
} from './TagSubscriberDescription';
|
} from './TagSubscriberDescription';
|
||||||
|
|
||||||
export class ConvertKit implements INodeType {
|
export class ConvertKit implements INodeType {
|
||||||
|
@ -88,7 +88,7 @@ export class ConvertKit implements INodeType {
|
||||||
value: 'tagSubscriber',
|
value: 'tagSubscriber',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
default: 'customField',
|
default: 'form',
|
||||||
description: 'The resource to operate on.'
|
description: 'The resource to operate on.'
|
||||||
},
|
},
|
||||||
//--------------------
|
//--------------------
|
||||||
|
@ -470,7 +470,7 @@ export class ConvertKit implements INodeType {
|
||||||
|
|
||||||
const email = this.getNodeParameter('email', i) as string;
|
const email = this.getNodeParameter('email', i) as string;
|
||||||
|
|
||||||
responseData= await convertKitApiRequest.call(this, 'POST', `/tags/${tagId}>/unsubscribe`, { email });
|
responseData = await convertKitApiRequest.call(this, 'POST', `/tags/${tagId}>/unsubscribe`, { email });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,11 +5,11 @@ import {
|
||||||
|
|
||||||
import {
|
import {
|
||||||
IDataObject,
|
IDataObject,
|
||||||
|
ILoadOptionsFunctions,
|
||||||
|
INodePropertyOptions,
|
||||||
INodeTypeDescription,
|
INodeTypeDescription,
|
||||||
INodeType,
|
INodeType,
|
||||||
IWebhookResponseData,
|
IWebhookResponseData,
|
||||||
ILoadOptionsFunctions,
|
|
||||||
INodePropertyOptions,
|
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -266,7 +266,7 @@ export class ConvertKitTrigger implements INodeType {
|
||||||
|
|
||||||
// THe API does not have an endpoint to list all webhooks
|
// THe API does not have an endpoint to list all webhooks
|
||||||
|
|
||||||
if(webhookData.webhookId) {
|
if (webhookData.webhookId) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,11 +282,8 @@ export class ConvertKitTrigger implements INodeType {
|
||||||
const endpoint = '/automations/hooks';
|
const endpoint = '/automations/hooks';
|
||||||
|
|
||||||
if (event === 'purchaseCreate') {
|
if (event === 'purchaseCreate') {
|
||||||
|
|
||||||
event = `purchase.${snakeCase(event)}`;
|
event = `purchase.${snakeCase(event)}`;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
event = `subscriber.${snakeCase(event)}`;
|
event = `subscriber.${snakeCase(event)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,11 +341,8 @@ export class ConvertKitTrigger implements INodeType {
|
||||||
const endpoint = `/automations/hooks/${webhookData.webhookId}`;
|
const endpoint = `/automations/hooks/${webhookData.webhookId}`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
await convertKitApiRequest.call(this, 'DELETE', endpoint);
|
await convertKitApiRequest.call(this, 'DELETE', endpoint);
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,8 @@ import {
|
||||||
|
|
||||||
import {
|
import {
|
||||||
IExecuteFunctions,
|
IExecuteFunctions,
|
||||||
ILoadOptionsFunctions,
|
|
||||||
IExecuteSingleFunctions,
|
IExecuteSingleFunctions,
|
||||||
|
ILoadOptionsFunctions,
|
||||||
} from 'n8n-core';
|
} from 'n8n-core';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -29,7 +29,7 @@ export async function convertKitApiRequest(this: IExecuteFunctions | IExecuteSin
|
||||||
method,
|
method,
|
||||||
qs,
|
qs,
|
||||||
body,
|
body,
|
||||||
uri: uri ||`https://api.convertkit.com/v3${endpoint}`,
|
uri: uri || `https://api.convertkit.com/v3${endpoint}`,
|
||||||
json: true,
|
json: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue