mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-21 20:00:02 +00:00
⚡ Improvements to Automizy-Node
This commit is contained in:
@@ -16,11 +16,6 @@ import {
|
|||||||
automizyApiRequestAllItems,
|
automizyApiRequestAllItems,
|
||||||
} from './GenericFunctions';
|
} from './GenericFunctions';
|
||||||
|
|
||||||
import {
|
|
||||||
contactListFields,
|
|
||||||
contactListOperations,
|
|
||||||
} from './ContactListDescription';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
contactFields,
|
contactFields,
|
||||||
contactOperations,
|
contactOperations,
|
||||||
@@ -62,10 +57,6 @@ export class Automizy implements INodeType {
|
|||||||
name: 'Contact',
|
name: 'Contact',
|
||||||
value: 'contact',
|
value: 'contact',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: 'Contact List',
|
|
||||||
value: 'contactList',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: 'List',
|
name: 'List',
|
||||||
value: 'list',
|
value: 'list',
|
||||||
@@ -74,8 +65,6 @@ export class Automizy implements INodeType {
|
|||||||
default: 'contactList',
|
default: 'contactList',
|
||||||
description: 'The resource to operate on.'
|
description: 'The resource to operate on.'
|
||||||
},
|
},
|
||||||
...contactListOperations,
|
|
||||||
...contactListFields,
|
|
||||||
|
|
||||||
...contactOperations,
|
...contactOperations,
|
||||||
...contactFields,
|
...contactFields,
|
||||||
@@ -89,6 +78,24 @@ export class Automizy implements INodeType {
|
|||||||
loadOptions: {
|
loadOptions: {
|
||||||
// Get all the tags to display them to user so that he can
|
// Get all the tags to display them to user so that he can
|
||||||
// select them easily
|
// select them easily
|
||||||
|
async getLists(
|
||||||
|
this: ILoadOptionsFunctions
|
||||||
|
): Promise<INodePropertyOptions[]> {
|
||||||
|
const returnData: INodePropertyOptions[] = [];
|
||||||
|
const lists = await automizyApiRequestAllItems.call(
|
||||||
|
this,
|
||||||
|
'smartLists',
|
||||||
|
'GET',
|
||||||
|
`/smart-lists`,
|
||||||
|
);
|
||||||
|
for (const list of lists) {
|
||||||
|
returnData.push({
|
||||||
|
name: list.name,
|
||||||
|
value: list.id
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return returnData;
|
||||||
|
},
|
||||||
async getTags(
|
async getTags(
|
||||||
this: ILoadOptionsFunctions
|
this: ILoadOptionsFunctions
|
||||||
): Promise<INodePropertyOptions[]> {
|
): Promise<INodePropertyOptions[]> {
|
||||||
@@ -100,17 +107,13 @@ export class Automizy implements INodeType {
|
|||||||
'/contacts/tag-manager'
|
'/contacts/tag-manager'
|
||||||
);
|
);
|
||||||
for (const tag of tags) {
|
for (const tag of tags) {
|
||||||
const tagName = tag.name;
|
|
||||||
const tagId = tag.name;
|
|
||||||
returnData.push({
|
returnData.push({
|
||||||
name: tagName,
|
name: tag.name,
|
||||||
value: tagId
|
value: tag.name
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return returnData;
|
return returnData;
|
||||||
},
|
},
|
||||||
// Get all the custom fields to display them to user so that he can
|
|
||||||
// select them easily
|
|
||||||
async getCustomFields(
|
async getCustomFields(
|
||||||
this: ILoadOptionsFunctions
|
this: ILoadOptionsFunctions
|
||||||
): Promise<INodePropertyOptions[]> {
|
): Promise<INodePropertyOptions[]> {
|
||||||
@@ -122,11 +125,9 @@ export class Automizy implements INodeType {
|
|||||||
'/custom-fields',
|
'/custom-fields',
|
||||||
);
|
);
|
||||||
for (const customField of customFields) {
|
for (const customField of customFields) {
|
||||||
const customFieldName = customField.name;
|
|
||||||
const customFieldId = customField.id;
|
|
||||||
returnData.push({
|
returnData.push({
|
||||||
name: customFieldName,
|
name: customField.name,
|
||||||
value: customFieldId
|
value: customField.id
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return returnData;
|
return returnData;
|
||||||
@@ -144,9 +145,9 @@ export class Automizy implements INodeType {
|
|||||||
const operation = this.getNodeParameter('operation', 0) as string;
|
const operation = this.getNodeParameter('operation', 0) as string;
|
||||||
for (let i = 0; i < length; i++) {
|
for (let i = 0; i < length; i++) {
|
||||||
|
|
||||||
if (resource === 'contactList') {
|
if (resource === 'contact') {
|
||||||
|
|
||||||
if (operation === 'add') {
|
if (operation === 'create') {
|
||||||
const listId = this.getNodeParameter('listId', i) as string;
|
const listId = this.getNodeParameter('listId', i) as string;
|
||||||
|
|
||||||
const email = this.getNodeParameter('email', i) as string;
|
const email = this.getNodeParameter('email', i) as string;
|
||||||
@@ -160,7 +161,7 @@ export class Automizy implements INodeType {
|
|||||||
Object.assign(body, additionalFields);
|
Object.assign(body, additionalFields);
|
||||||
|
|
||||||
if (body.customFieldsUi) {
|
if (body.customFieldsUi) {
|
||||||
const customFieldsValues= (body.customFieldsUi as IDataObject).customFieldsValues as IDataObject[];
|
const customFieldsValues = (body.customFieldsUi as IDataObject).customFieldsValues as IDataObject[];
|
||||||
|
|
||||||
body.customFields = {};
|
body.customFields = {};
|
||||||
|
|
||||||
@@ -181,6 +182,28 @@ export class Automizy implements INodeType {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (operation === 'delete') {
|
||||||
|
const contactId = this.getNodeParameter('contactId', i) as string;
|
||||||
|
|
||||||
|
responseData = await automizyApiRequest.call(
|
||||||
|
this,
|
||||||
|
'DELETE',
|
||||||
|
`/contacts/${contactId}`,
|
||||||
|
);
|
||||||
|
|
||||||
|
responseData = { success: true };
|
||||||
|
}
|
||||||
|
|
||||||
|
if (operation === 'get') {
|
||||||
|
const contactId = this.getNodeParameter('contactId', i) as string;
|
||||||
|
|
||||||
|
responseData = await automizyApiRequest.call(
|
||||||
|
this,
|
||||||
|
'GET',
|
||||||
|
`/contacts/${contactId}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (operation === 'getAll') {
|
if (operation === 'getAll') {
|
||||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||||
|
|
||||||
@@ -189,7 +212,7 @@ export class Automizy implements INodeType {
|
|||||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||||
|
|
||||||
if (additionalFields.direction && additionalFields.sortBy) {
|
if (additionalFields.direction && additionalFields.sortBy) {
|
||||||
qs.order = `${additionalFields.sortBy}:${additionalFields.direction }`;
|
qs.order = `${additionalFields.sortBy}:${additionalFields.direction}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (additionalFields.fields) {
|
if (additionalFields.fields) {
|
||||||
@@ -221,31 +244,6 @@ export class Automizy implements INodeType {
|
|||||||
responseData = responseData.contacts;
|
responseData = responseData.contacts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (resource === 'contact') {
|
|
||||||
|
|
||||||
if (operation === 'delete') {
|
|
||||||
const contactId = this.getNodeParameter('contactId', i) as string;
|
|
||||||
|
|
||||||
responseData = await automizyApiRequest.call(
|
|
||||||
this,
|
|
||||||
'DELETE',
|
|
||||||
`/contacts/${contactId}`,
|
|
||||||
);
|
|
||||||
|
|
||||||
responseData = { success: true };
|
|
||||||
}
|
|
||||||
|
|
||||||
if (operation === 'get') {
|
|
||||||
const contactId = this.getNodeParameter('contactId', i) as string;
|
|
||||||
|
|
||||||
responseData = await automizyApiRequest.call(
|
|
||||||
this,
|
|
||||||
'GET',
|
|
||||||
`/contacts/${contactId}`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (operation === 'update') {
|
if (operation === 'update') {
|
||||||
const email = this.getNodeParameter('email', i) as string;
|
const email = this.getNodeParameter('email', i) as string;
|
||||||
@@ -257,7 +255,7 @@ export class Automizy implements INodeType {
|
|||||||
Object.assign(body, updateFields);
|
Object.assign(body, updateFields);
|
||||||
|
|
||||||
if (body.customFieldsUi) {
|
if (body.customFieldsUi) {
|
||||||
const customFieldsValues= (body.customFieldsUi as IDataObject).customFieldsValues as IDataObject[];
|
const customFieldsValues = (body.customFieldsUi as IDataObject).customFieldsValues as IDataObject[];
|
||||||
|
|
||||||
body.customFields = {};
|
body.customFields = {};
|
||||||
|
|
||||||
@@ -324,7 +322,7 @@ export class Automizy implements INodeType {
|
|||||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||||
|
|
||||||
if (additionalFields.direction && additionalFields.sortBy) {
|
if (additionalFields.direction && additionalFields.sortBy) {
|
||||||
qs.order = `${additionalFields.sortBy}:${additionalFields.direction }`;
|
qs.order = `${additionalFields.sortBy}:${additionalFields.direction}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (additionalFields.fields) {
|
if (additionalFields.fields) {
|
||||||
|
|||||||
@@ -15,6 +15,11 @@ export const contactOperations = [
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
options: [
|
options: [
|
||||||
|
{
|
||||||
|
name: 'Create',
|
||||||
|
value: 'create',
|
||||||
|
description: 'Create a contact',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'Delete',
|
name: 'Delete',
|
||||||
value: 'delete',
|
value: 'delete',
|
||||||
@@ -25,6 +30,11 @@ export const contactOperations = [
|
|||||||
value: 'get',
|
value: 'get',
|
||||||
description: 'Get a contact',
|
description: 'Get a contact',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'Get All',
|
||||||
|
value: 'getAll',
|
||||||
|
description: 'Get all contacts',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'Update',
|
name: 'Update',
|
||||||
value: 'update',
|
value: 'update',
|
||||||
@@ -38,6 +48,143 @@ export const contactOperations = [
|
|||||||
|
|
||||||
export const contactFields = [
|
export const contactFields = [
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
/* contact:create */
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
{
|
||||||
|
displayName: 'Email',
|
||||||
|
name: 'email',
|
||||||
|
required: true,
|
||||||
|
type: 'string',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
operation: [
|
||||||
|
'create',
|
||||||
|
],
|
||||||
|
resource: [
|
||||||
|
'contact',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
description: 'The email address of the contact.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'List ID',
|
||||||
|
name: 'listId',
|
||||||
|
required: true,
|
||||||
|
type: 'options',
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getLists',
|
||||||
|
},
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
operation: [
|
||||||
|
'create',
|
||||||
|
],
|
||||||
|
resource: [
|
||||||
|
'contact',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Additional Fields',
|
||||||
|
name: 'additionalFields',
|
||||||
|
type: 'collection',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
operation: [
|
||||||
|
'create',
|
||||||
|
],
|
||||||
|
resource: [
|
||||||
|
'contact',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
default: {},
|
||||||
|
placeholder: 'Add Field',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
displayName: 'Custom Fields',
|
||||||
|
name: 'customFieldsUi',
|
||||||
|
type: 'fixedCollection',
|
||||||
|
default: '',
|
||||||
|
placeholder: 'Add Custom Field',
|
||||||
|
typeOptions: {
|
||||||
|
multipleValues: true,
|
||||||
|
loadOptionsMethod: 'getCustomFields',
|
||||||
|
},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'customFieldsValues',
|
||||||
|
displayName: 'Custom Field',
|
||||||
|
values: [
|
||||||
|
{
|
||||||
|
displayName: 'Key',
|
||||||
|
name: 'key',
|
||||||
|
type: 'options',
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getCustomFields',
|
||||||
|
},
|
||||||
|
description: 'The end user specified key of the user defined data.',
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Value',
|
||||||
|
name: 'value',
|
||||||
|
type: 'string',
|
||||||
|
description: 'The end user specified value of the user defined data.',
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Status',
|
||||||
|
name: 'status',
|
||||||
|
type: 'options',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'Active',
|
||||||
|
value: 'ACTIVE',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Banned',
|
||||||
|
value: 'BANNED',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Bounced',
|
||||||
|
value: 'BOUNCED',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Inactive',
|
||||||
|
value: 'INACTIVE',
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: 'Unsubscribed',
|
||||||
|
value: 'UNSUBSCRIBED',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
default: '',
|
||||||
|
description: 'The status of the contact. You can only send email to contacts with ACTIVE status.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Tags',
|
||||||
|
name: 'tags',
|
||||||
|
type: 'multiOptions',
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getTags',
|
||||||
|
},
|
||||||
|
default: [],
|
||||||
|
description: 'The tags you want to set to the contact.',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* contact:delete */
|
/* contact:delete */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
@@ -57,8 +204,9 @@ export const contactFields = [
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
default: '',
|
default: '',
|
||||||
description: 'Can be id or email'
|
description: 'Can be ID or email.'
|
||||||
},
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* contact:get */
|
/* contact:get */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
@@ -78,8 +226,123 @@ export const contactFields = [
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
default: '',
|
default: '',
|
||||||
description: 'Can be id or email'
|
description: 'Can be ID or email',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
/* contact:getAll */
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
{
|
||||||
|
displayName: 'List ID',
|
||||||
|
name: 'listId',
|
||||||
|
required: true,
|
||||||
|
type: 'options',
|
||||||
|
typeOptions: {
|
||||||
|
loadOptionsMethod: 'getLists',
|
||||||
|
},
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
operation: [
|
||||||
|
'getAll',
|
||||||
|
],
|
||||||
|
resource: [
|
||||||
|
'contact',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Return All',
|
||||||
|
name: 'returnAll',
|
||||||
|
type: 'boolean',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
operation: [
|
||||||
|
'getAll',
|
||||||
|
],
|
||||||
|
resource: [
|
||||||
|
'contact',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
default: false,
|
||||||
|
description: 'If all results should be returned or only up to a given limit.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Limit',
|
||||||
|
name: 'limit',
|
||||||
|
type: 'number',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
operation: [
|
||||||
|
'getAll',
|
||||||
|
],
|
||||||
|
resource: [
|
||||||
|
'contact',
|
||||||
|
],
|
||||||
|
returnAll: [
|
||||||
|
false,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
typeOptions: {
|
||||||
|
minValue: 1,
|
||||||
|
maxValue: 500,
|
||||||
|
},
|
||||||
|
default: 100,
|
||||||
|
description: 'How many results to return.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Additional Fields',
|
||||||
|
name: 'additionalFields',
|
||||||
|
type: 'collection',
|
||||||
|
placeholder: 'Add Field',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
operation: [
|
||||||
|
'getAll',
|
||||||
|
],
|
||||||
|
resource: [
|
||||||
|
'contact',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
default: {},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
displayName: 'Direction',
|
||||||
|
name: 'direction',
|
||||||
|
type: 'options',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'ASC',
|
||||||
|
value: 'asc',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'DESC',
|
||||||
|
value: 'desc',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
default: 'desc',
|
||||||
|
description: 'Defines the direction in which search results are ordered. Default value is DESC. Note: It has to be using with the Sort By parameter',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Fields',
|
||||||
|
name: 'fields',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
description: 'A comma-separated list of attributes to include in the response.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Sort By',
|
||||||
|
name: 'sortBy',
|
||||||
|
type: 'string',
|
||||||
|
default: 'Defines the field in which search results are sort by. Note: It has to be using with the Direcction parameter',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* contact:update */
|
/* contact:update */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
@@ -163,20 +426,20 @@ export const contactFields = [
|
|||||||
value: 'ACTIVE',
|
value: 'ACTIVE',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Inactive',
|
name: 'Banned',
|
||||||
value: 'INACTIVE',
|
value: 'BANNED',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Bounced',
|
name: 'Bounced',
|
||||||
value: 'BOUNCED',
|
value: 'BOUNCED',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Unsubscribed',
|
name: 'Inactive',
|
||||||
value: 'UNSUBSCRIBED',
|
value: 'INACTIVE',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Banned',
|
name: 'Unsubscribed',
|
||||||
value: 'BANNED',
|
value: 'UNSUBSCRIBED',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
default: '',
|
default: '',
|
||||||
@@ -190,7 +453,7 @@ export const contactFields = [
|
|||||||
loadOptionsMethod: 'getTags',
|
loadOptionsMethod: 'getTags',
|
||||||
},
|
},
|
||||||
default: [],
|
default: [],
|
||||||
description: 'The tags you want to set to the contact.',
|
description: 'The tags you want to set to the contact. Will replace all existing ones.',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,278 +0,0 @@
|
|||||||
import {
|
|
||||||
INodeProperties,
|
|
||||||
} from 'n8n-workflow';
|
|
||||||
|
|
||||||
export const contactListOperations = [
|
|
||||||
{
|
|
||||||
displayName: 'Operation',
|
|
||||||
name: 'operation',
|
|
||||||
type: 'options',
|
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
resource: [
|
|
||||||
'contactList',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
name: 'Add',
|
|
||||||
value: 'add',
|
|
||||||
description: 'Add a contact to a list',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Get All',
|
|
||||||
value: 'getAll',
|
|
||||||
description: 'Get all contacts on a list',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
default: 'add',
|
|
||||||
description: 'The operation to perform.',
|
|
||||||
},
|
|
||||||
] as INodeProperties[];
|
|
||||||
|
|
||||||
export const contactListFields = [
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
|
||||||
/* contactList:add */
|
|
||||||
/* -------------------------------------------------------------------------- */
|
|
||||||
{
|
|
||||||
displayName: 'Email',
|
|
||||||
name: 'email',
|
|
||||||
required: true,
|
|
||||||
type: 'string',
|
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
operation: [
|
|
||||||
'add',
|
|
||||||
],
|
|
||||||
resource: [
|
|
||||||
'contactList',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
default: '',
|
|
||||||
description: 'The email address of the contactList',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
displayName: 'List ID',
|
|
||||||
name: 'listId',
|
|
||||||
required: true,
|
|
||||||
type: 'string',
|
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
operation: [
|
|
||||||
'add',
|
|
||||||
],
|
|
||||||
resource: [
|
|
||||||
'contactList',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
default: '',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
displayName: 'Additional Fields',
|
|
||||||
name: 'additionalFields',
|
|
||||||
type: 'collection',
|
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
operation: [
|
|
||||||
'add',
|
|
||||||
],
|
|
||||||
resource: [
|
|
||||||
'contactList',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
default: {},
|
|
||||||
placeholder: 'Add Field',
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
displayName: 'Custom Fields',
|
|
||||||
name: 'customFieldsUi',
|
|
||||||
type: 'fixedCollection',
|
|
||||||
default: '',
|
|
||||||
placeholder: 'Add Custom Field',
|
|
||||||
typeOptions: {
|
|
||||||
multipleValues: true,
|
|
||||||
loadOptionsMethod: 'getCustomFields',
|
|
||||||
},
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
name: 'customFieldsValues',
|
|
||||||
displayName: 'Custom Field',
|
|
||||||
values: [
|
|
||||||
{
|
|
||||||
displayName: 'Key',
|
|
||||||
name: 'key',
|
|
||||||
type: 'options',
|
|
||||||
typeOptions: {
|
|
||||||
loadOptionsMethod: 'getCustomFields',
|
|
||||||
},
|
|
||||||
description: 'The end user specified key of the user defined data.',
|
|
||||||
default: '',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
displayName: 'Value',
|
|
||||||
name: 'value',
|
|
||||||
type: 'string',
|
|
||||||
description: 'The end user specified value of the user defined data.',
|
|
||||||
default: '',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
displayName: 'Status',
|
|
||||||
name: 'status',
|
|
||||||
type: 'options',
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
name: 'Active',
|
|
||||||
value: 'ACTIVE',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Inactive',
|
|
||||||
value: 'INACTIVE',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Bounced',
|
|
||||||
value: 'BOUNCED',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Unsubscribed',
|
|
||||||
value: 'UNSUBSCRIBED',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Banned',
|
|
||||||
value: 'BANNED',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
default: '',
|
|
||||||
description: 'The status of the contact. You can only send email to contacts with ACTIVE status.',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
displayName: 'Tags',
|
|
||||||
name: 'tags',
|
|
||||||
type: 'multiOptions',
|
|
||||||
typeOptions: {
|
|
||||||
loadOptionsMethod: 'getTags',
|
|
||||||
},
|
|
||||||
default: [],
|
|
||||||
description: 'The tags you want to set to the contact.',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
/* -------------------------------------------------------------------------- */
|
|
||||||
/* contactList:getAll */
|
|
||||||
/* -------------------------------------------------------------------------- */
|
|
||||||
{
|
|
||||||
displayName: 'List ID',
|
|
||||||
name: 'listId',
|
|
||||||
required: true,
|
|
||||||
type: 'string',
|
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
operation: [
|
|
||||||
'getAll',
|
|
||||||
],
|
|
||||||
resource: [
|
|
||||||
'contactList',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
default: '',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
displayName: 'Return All',
|
|
||||||
name: 'returnAll',
|
|
||||||
type: 'boolean',
|
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
operation: [
|
|
||||||
'getAll',
|
|
||||||
],
|
|
||||||
resource: [
|
|
||||||
'contactList',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
default: false,
|
|
||||||
description: 'If all results should be returned or only up to a given limit.',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
displayName: 'Limit',
|
|
||||||
name: 'limit',
|
|
||||||
type: 'number',
|
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
operation: [
|
|
||||||
'getAll',
|
|
||||||
],
|
|
||||||
resource: [
|
|
||||||
'contactList',
|
|
||||||
],
|
|
||||||
returnAll: [
|
|
||||||
false,
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
typeOptions: {
|
|
||||||
minValue: 1,
|
|
||||||
maxValue: 500,
|
|
||||||
},
|
|
||||||
default: 100,
|
|
||||||
description: 'How many results to return.',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
displayName: 'Additional Fields',
|
|
||||||
name: 'additionalFields',
|
|
||||||
type: 'collection',
|
|
||||||
placeholder: 'Add Field',
|
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
operation: [
|
|
||||||
'getAll',
|
|
||||||
],
|
|
||||||
resource: [
|
|
||||||
'contactList',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
default: {},
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
displayName: 'Direction',
|
|
||||||
name: 'direction',
|
|
||||||
type: 'options',
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
name: 'ASC',
|
|
||||||
value: 'asc',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'DESC',
|
|
||||||
value: 'desc',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
default: 'desc',
|
|
||||||
description: 'Defines the direction in which search results are ordered. Default value is DESC. Note: It has to be using with the Sort By parameter',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
displayName: 'Fields',
|
|
||||||
name: 'fields',
|
|
||||||
type: 'string',
|
|
||||||
default: '',
|
|
||||||
description: 'A comma-separated list of attributes to include in the response.',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
displayName: 'Sort By',
|
|
||||||
name: 'sortBy',
|
|
||||||
type: 'string',
|
|
||||||
default: 'Defines the field in which search results are sort by. Note: It has to be using with the Direcction parameter',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
] as INodeProperties[];
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 1.7 KiB |
Reference in New Issue
Block a user