2021-02-20 12:12:55 -08:00
import {
INodeProperties ,
} from 'n8n-workflow' ;
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' ,
} ,
{
name : 'Create' ,
value : 'create' ,
} ,
2022-04-01 01:12:47 -07:00
{
name : 'Duplicate' ,
value : 'duplicate' ,
} ,
2021-02-20 12:12:55 -08:00
{
name : 'Get' ,
value : 'get' ,
} ,
{
name : 'Get All' ,
value : 'getAll' ,
} ,
{
name : 'Pause' ,
value : 'pause' ,
} ,
{
name : 'Start' ,
value : 'start' ,
} ,
] ,
displayOptions : {
show : {
resource : [
'campaign' ,
] ,
} ,
} ,
} ,
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-06-03 10:23:49 -07:00
description : '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/nodes/expressions.html#expressions">expression</a>.' ,
2021-02-20 12:12:55 -08:00
displayOptions : {
show : {
resource : [
'campaign' ,
] ,
operation : [
'addContact' ,
] ,
} ,
} ,
} ,
{
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 : {
resource : [
'campaign' ,
] ,
operation : [
'addContact' ,
] ,
} ,
} ,
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
resource : [
'campaign' ,
] ,
operation : [
'addContact' ,
] ,
} ,
} ,
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 : {
resource : [
'campaign' ,
] ,
operation : [
'create' ,
] ,
} ,
} ,
} ,
// ----------------------------------
// 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 : {
resource : [
'campaign' ,
] ,
operation : [
'get' ,
] ,
} ,
} ,
} ,
// ----------------------------------
// 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 : {
resource : [
'campaign' ,
] ,
operation : [
'getAll' ,
] ,
} ,
} ,
} ,
{
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 : {
resource : [
'campaign' ,
] ,
operation : [
'getAll' ,
] ,
returnAll : [
false ,
] ,
} ,
} ,
} ,
// ----------------------------------
// 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 : {
resource : [
'campaign' ,
] ,
operation : [
'pause' ,
] ,
} ,
} ,
} ,
// ----------------------------------
// 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 : {
resource : [
'campaign' ,
] ,
operation : [
'start' ,
] ,
} ,
} ,
} ,
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-06-03 10:23:49 -07:00
description : 'The ID of the campaign to duplicate. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>.' ,
2022-04-01 01:12:47 -07:00
typeOptions : {
loadOptionsMethod : 'getCampaigns' ,
} ,
displayOptions : {
show : {
resource : [
'campaign' ,
] ,
operation : [
'duplicate' ,
] ,
} ,
} ,
} ,
{
displayName : 'New Campaign Name' ,
name : 'campaignName' ,
type : 'string' ,
required : true ,
default : '' ,
description : 'The name of the new campaign to create' ,
displayOptions : {
show : {
resource : [
'campaign' ,
] ,
operation : [
'duplicate' ,
] ,
} ,
} ,
} ,
{
displayName : 'Options' ,
name : 'options' ,
type : 'collection' ,
default : { } ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
operation : [
'duplicate' ,
] ,
resource : [
'campaign' ,
] ,
} ,
} ,
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 ,
description : 'Whether to copy all the steps of the email sequence from the original campaign' ,
} ,
{
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
] ;