mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
✨ Add Campaign resource to the mailchimp node
This commit is contained in:
parent
49914559f5
commit
de4c0546cd
|
@ -254,6 +254,16 @@ export class Mailchimp implements INodeType {
|
||||||
value: 'getAll',
|
value: 'getAll',
|
||||||
description: 'Get all the campaigns'
|
description: 'Get all the campaigns'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'Replicate',
|
||||||
|
value: 'replicate',
|
||||||
|
description: 'Replicate a campaign'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Resend',
|
||||||
|
value: 'resend',
|
||||||
|
description: 'Creates a Resend to Non-Openers version of this campaign'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'Send',
|
name: 'Send',
|
||||||
value: 'send',
|
value: 'send',
|
||||||
|
@ -1700,7 +1710,9 @@ export class Mailchimp implements INodeType {
|
||||||
operation: [
|
operation: [
|
||||||
'send',
|
'send',
|
||||||
'get',
|
'get',
|
||||||
'delete'
|
'delete',
|
||||||
|
'replicate',
|
||||||
|
'resend'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -2109,6 +2121,7 @@ export class Mailchimp implements INodeType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (resource === 'campaign') {
|
if (resource === 'campaign') {
|
||||||
|
//https://mailchimp.com/developer/api/marketing/campaigns/list-campaigns/
|
||||||
if (operation === 'getAll') {
|
if (operation === 'getAll') {
|
||||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||||
const options = this.getNodeParameter('options', i) as IDataObject;
|
const options = this.getNodeParameter('options', i) as IDataObject;
|
||||||
|
@ -2148,22 +2161,33 @@ export class Mailchimp implements INodeType {
|
||||||
responseData = responseData.campaigns
|
responseData = responseData.campaigns
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//https://mailchimp.com/developer/api/marketing/campaigns/send-campaign/
|
||||||
if (operation === 'send') {
|
if (operation === 'send') {
|
||||||
const campaignId = this.getNodeParameter('campaignId', i) as string;
|
const campaignId = this.getNodeParameter('campaignId', i) as string;
|
||||||
responseData = await mailchimpApiRequest.call(this, `/campaigns/${campaignId}/actions/send`, 'POST', {})
|
responseData = await mailchimpApiRequest.call(this, `/campaigns/${campaignId}/actions/send`, 'POST', {})
|
||||||
}
|
}
|
||||||
|
//https://mailchimp.com/developer/api/marketing/campaigns/get-campaign-info/
|
||||||
if (operation === 'get') {
|
if (operation === 'get') {
|
||||||
const campaignId = this.getNodeParameter('campaignId', i) as string;
|
const campaignId = this.getNodeParameter('campaignId', i) as string;
|
||||||
if(!campaignId){
|
if(!campaignId){
|
||||||
// TODO
|
|
||||||
// Display error message.
|
|
||||||
throw new Error("Campaign ID is required");
|
throw new Error("Campaign ID is required");
|
||||||
}
|
}
|
||||||
responseData = await mailchimpApiRequest.call(this, `/campaigns/${campaignId}`, 'GET', {})
|
responseData = await mailchimpApiRequest.call(this, `/campaigns/${campaignId}`, 'GET', {})
|
||||||
}
|
}
|
||||||
|
//https://mailchimp.com/developer/api/marketing/campaigns/delete-campaign/
|
||||||
if (operation === 'delete') {
|
if (operation === 'delete') {
|
||||||
const campaignId = this.getNodeParameter('campaignId', i) as string;
|
const campaignId = this.getNodeParameter('campaignId', i) as string;
|
||||||
responseData = await mailchimpApiRequest.call(this, `/campaigns/${campaignId}`, 'Delete', {})
|
responseData = await mailchimpApiRequest.call(this, `/campaigns/${campaignId}`, 'DELETE', {})
|
||||||
|
}
|
||||||
|
//https://mailchimp.com/developer/api/marketing/campaigns/replicate-campaign/
|
||||||
|
if (operation === 'replicate') {
|
||||||
|
const campaignId = this.getNodeParameter('campaignId', i) as string;
|
||||||
|
responseData = await mailchimpApiRequest.call(this, `/campaigns/${campaignId}/actions/replicate`, 'POST', {})
|
||||||
|
}
|
||||||
|
//https://mailchimp.com/developer/api/marketing/campaigns/resend-campaign/
|
||||||
|
if (operation === 'resend') {
|
||||||
|
const campaignId = this.getNodeParameter('campaignId', i) as string;
|
||||||
|
responseData = await mailchimpApiRequest.call(this, `/campaigns/${campaignId}/actions/create-resend`, 'POST', {})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue