2023-01-27 03:22:44 -08:00
import type { INodeProperties } from 'n8n-workflow' ;
2021-02-20 12:12:55 -08:00
2021-12-03 00:44:16 -08:00
export const campaignOperations : INodeProperties [ ] = [
2021-02-20 12:12:55 -08:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
default : 'get' ,
2022-04-01 01:12:47 -07:00
noDataExpression : true ,
2021-02-20 12:12:55 -08:00
options : [
{
name : 'Add Contact' ,
value : 'addContact' ,
2022-07-10 13:50:51 -07:00
action : 'Add a contact to a campaign' ,
2021-02-20 12:12:55 -08:00
} ,
{
name : 'Create' ,
value : 'create' ,
2022-07-10 13:50:51 -07:00
action : 'Create a campaign' ,
2021-02-20 12:12:55 -08:00
} ,
2022-04-01 01:12:47 -07:00
{
name : 'Duplicate' ,
value : 'duplicate' ,
2022-07-10 13:50:51 -07:00
action : 'Duplicate a campaign' ,
2022-04-01 01:12:47 -07:00
} ,
2021-02-20 12:12:55 -08:00
{
name : 'Get' ,
value : 'get' ,
2022-07-10 13:50:51 -07:00
action : 'Get a campaign' ,
2021-02-20 12:12:55 -08:00
} ,
{
2022-09-07 07:51:14 -07:00
name : 'Get Many' ,
2021-02-20 12:12:55 -08:00
value : 'getAll' ,
2022-09-08 08:10:13 -07:00
action : 'Get many campaigns' ,
2021-02-20 12:12:55 -08:00
} ,
{
name : 'Pause' ,
value : 'pause' ,
2022-07-10 13:50:51 -07:00
action : 'Pause a campaign' ,
2021-02-20 12:12:55 -08:00
} ,
{
name : 'Start' ,
value : 'start' ,
2022-07-10 13:50:51 -07:00
action : 'Start a campaign' ,
2021-02-20 12:12:55 -08:00
} ,
] ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'campaign' ] ,
2021-02-20 12:12:55 -08:00
} ,
} ,
} ,
2021-12-03 00:44:16 -08:00
] ;
2021-02-20 12:12:55 -08:00
2021-12-03 00:44:16 -08:00
export const campaignFields : INodeProperties [ ] = [
2021-02-20 12:12:55 -08:00
// ----------------------------------
// campaign: addContact
// ----------------------------------
{
2022-06-03 10:23:49 -07:00
displayName : 'Campaign Name or ID' ,
2021-02-20 12:12:55 -08:00
name : 'campaignId' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getCampaigns' ,
} ,
default : [ ] ,
required : true ,
2022-08-01 13:47:55 -07:00
description :
2024-09-12 07:53:36 -07:00
'The ID of the campaign to add the contact to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.' ,
2021-02-20 12:12:55 -08:00
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'campaign' ] ,
operation : [ 'addContact' ] ,
2021-02-20 12:12:55 -08:00
} ,
} ,
} ,
{
displayName : 'Contact Email' ,
name : 'contactEmail' ,
type : 'string' ,
required : true ,
default : '' ,
2022-04-01 01:12:47 -07:00
description : 'The email of the contact to add to the campaign' ,
2021-02-20 12:12:55 -08:00
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'campaign' ] ,
operation : [ 'addContact' ] ,
2021-02-20 12:12:55 -08:00
} ,
} ,
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'campaign' ] ,
operation : [ 'addContact' ] ,
2021-02-20 12:12:55 -08:00
} ,
} ,
options : [
{
displayName : 'Custom Fields' ,
name : 'customFieldsUi' ,
placeholder : 'Add Custom Field' ,
type : 'fixedCollection' ,
typeOptions : {
multipleValues : true ,
} ,
2022-04-01 01:12:47 -07:00
description : 'Filter by custom fields' ,
2021-02-20 12:12:55 -08:00
default : { } ,
options : [
{
name : 'customFieldsValues' ,
displayName : 'Custom Field' ,
values : [
{
displayName : 'Field Name' ,
name : 'fieldName' ,
type : 'string' ,
default : '' ,
2022-04-01 01:12:47 -07:00
description : 'The name of the field to add custom field to' ,
2021-02-20 12:12:55 -08:00
} ,
{
displayName : 'Value' ,
name : 'value' ,
type : 'string' ,
default : '' ,
2022-04-01 01:12:47 -07:00
description : 'The value to set on custom field' ,
2021-02-20 12:12:55 -08:00
} ,
] ,
} ,
] ,
} ,
{
displayName : 'First Name' ,
name : 'firstName' ,
type : 'string' ,
default : '' ,
2022-04-01 01:12:47 -07:00
description : 'First name of the contact to add' ,
2021-02-20 12:12:55 -08:00
} ,
{
2022-04-01 01:12:47 -07:00
displayName : 'Last Contacted' ,
name : 'lastContacted' ,
type : 'dateTime' ,
2021-02-20 12:12:55 -08:00
default : '' ,
2022-04-01 01:12:47 -07:00
description : 'Last contacted date of the contact to add' ,
2021-02-20 12:12:55 -08:00
} ,
{
2022-04-01 01:12:47 -07:00
displayName : 'Last Name' ,
name : 'lastName' ,
2021-02-20 12:12:55 -08:00
type : 'string' ,
default : '' ,
2022-04-01 01:12:47 -07:00
description : 'Last name of the contact to add' ,
2021-02-20 12:12:55 -08:00
} ,
{
displayName : 'Last Open' ,
name : 'lastOpen' ,
2022-04-01 01:12:47 -07:00
type : 'dateTime' ,
2021-02-20 12:12:55 -08:00
default : '' ,
2022-04-01 01:12:47 -07:00
description : 'Last opened date of the contact to add' ,
2021-02-20 12:12:55 -08:00
} ,
{
displayName : 'Last Replied' ,
name : 'lastReplied' ,
2022-04-01 01:12:47 -07:00
type : 'dateTime' ,
2021-02-20 12:12:55 -08:00
default : '' ,
2022-04-01 01:12:47 -07:00
description : 'Last replied date of the contact to add' ,
2021-02-20 12:12:55 -08:00
} ,
{
displayName : 'Mails Sent' ,
name : 'mailsSent' ,
type : 'number' ,
default : 0 ,
2022-04-01 01:12:47 -07:00
description : 'Number of emails sent to the contact to add' ,
2021-02-20 12:12:55 -08:00
} ,
{
displayName : 'Phone Number' ,
name : 'phoneNumber' ,
type : 'string' ,
default : '' ,
2022-04-01 01:12:47 -07:00
description : 'Phone number of the contact to add' ,
2021-02-20 12:12:55 -08:00
} ,
] ,
} ,
// ----------------------------------
// campaign: create
// ----------------------------------
{
displayName : 'Campaign Name' ,
name : 'campaignName' ,
type : 'string' ,
required : true ,
default : '' ,
2022-04-01 01:12:47 -07:00
description : 'The name of the campaign to create' ,
2021-02-20 12:12:55 -08:00
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'campaign' ] ,
operation : [ 'create' ] ,
2021-02-20 12:12:55 -08:00
} ,
} ,
} ,
// ----------------------------------
// campaign: get
// ----------------------------------
{
displayName : 'Campaign ID' ,
name : 'campaignId' ,
type : 'string' ,
default : '' ,
required : true ,
2022-04-01 01:12:47 -07:00
description : 'The ID of the campaign to retrieve' ,
2021-02-20 12:12:55 -08:00
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'campaign' ] ,
operation : [ 'get' ] ,
2021-02-20 12:12:55 -08:00
} ,
} ,
} ,
// ----------------------------------
// campaign: getAll
// ----------------------------------
{
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
default : false ,
2022-04-01 01:12:47 -07:00
description : 'Whether to return all results or only up to a given limit' ,
2021-02-20 12:12:55 -08:00
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'campaign' ] ,
operation : [ 'getAll' ] ,
2021-02-20 12:12:55 -08:00
} ,
} ,
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
default : 100 ,
2022-04-01 01:12:47 -07:00
description : 'Max number of results to return' ,
2021-02-20 12:12:55 -08:00
typeOptions : {
minValue : 1 ,
maxValue : 100 ,
} ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'campaign' ] ,
operation : [ 'getAll' ] ,
returnAll : [ false ] ,
2021-02-20 12:12:55 -08:00
} ,
} ,
} ,
// ----------------------------------
// campaign: pause
// ----------------------------------
{
displayName : 'Campaign ID' ,
name : 'campaignId' ,
type : 'string' ,
default : '' ,
required : true ,
2021-11-25 09:10:06 -08:00
description : 'The ID of the campaign to pause. The campaign must be in RUNNING mode.' ,
2021-02-20 12:12:55 -08:00
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'campaign' ] ,
operation : [ 'pause' ] ,
2021-02-20 12:12:55 -08:00
} ,
} ,
} ,
// ----------------------------------
// campaign: start
// ----------------------------------
{
displayName : 'Campaign ID' ,
name : 'campaignId' ,
type : 'string' ,
default : '' ,
required : true ,
2021-11-25 09:10:06 -08:00
description : 'The ID of the campaign to start. Email provider and contacts must be set.' ,
2021-02-20 12:12:55 -08:00
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'campaign' ] ,
operation : [ 'start' ] ,
2021-02-20 12:12:55 -08:00
} ,
} ,
} ,
2022-04-01 01:12:47 -07:00
// ----------------------------------
// campaign: duplicate
// ----------------------------------
{
2022-06-03 10:23:49 -07:00
displayName : 'Campaign Name or ID' ,
2022-04-01 01:12:47 -07:00
name : 'campaignId' ,
type : 'options' ,
default : '' ,
required : true ,
2022-08-01 13:47:55 -07:00
description :
2024-09-12 07:53:36 -07:00
'The ID of the campaign to duplicate. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.' ,
2022-04-01 01:12:47 -07:00
typeOptions : {
loadOptionsMethod : 'getCampaigns' ,
} ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'campaign' ] ,
operation : [ 'duplicate' ] ,
2022-04-01 01:12:47 -07:00
} ,
} ,
} ,
{
displayName : 'New Campaign Name' ,
name : 'campaignName' ,
type : 'string' ,
required : true ,
default : '' ,
description : 'The name of the new campaign to create' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'campaign' ] ,
operation : [ 'duplicate' ] ,
2022-04-01 01:12:47 -07:00
} ,
} ,
} ,
{
displayName : 'Options' ,
name : 'options' ,
type : 'collection' ,
default : { } ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
operation : [ 'duplicate' ] ,
resource : [ 'campaign' ] ,
2022-04-01 01:12:47 -07:00
} ,
} ,
options : [
{
displayName : 'Copy Contacts' ,
name : 'copyContacts' ,
type : 'boolean' ,
default : false ,
description : 'Whether to copy all the contacts from the original campaign' ,
} ,
{
displayName : 'Copy Email Provider' ,
name : 'copyProvider' ,
type : 'boolean' ,
default : true ,
description : 'Whether to set the same email provider than the original campaign' ,
} ,
{
displayName : 'Copy Email Sequence' ,
name : 'copyMails' ,
type : 'boolean' ,
default : true ,
2022-08-01 13:47:55 -07:00
description :
'Whether to copy all the steps of the email sequence from the original campaign' ,
2022-04-01 01:12:47 -07:00
} ,
{
displayName : 'Copy Global Settings' ,
name : 'copySettings' ,
type : 'boolean' ,
default : true ,
description : 'Whether to copy all the general settings from the original campaign' ,
} ,
] ,
} ,
2021-12-03 00:44:16 -08:00
] ;