2020-10-13 12:35:01 -07:00
import {
INodeProperties ,
} from 'n8n-workflow' ;
2021-12-03 00:44:16 -08:00
export const contactOperations : INodeProperties [ ] = [
2020-10-13 12:35:01 -07:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2020-10-13 12:35:01 -07:00
displayOptions : {
show : {
resource : [
'contact' ,
] ,
} ,
} ,
options : [
2020-10-13 12:39:36 -07:00
{
name : 'Create' ,
value : 'create' ,
description : 'Create a contact' ,
2022-07-10 13:50:51 -07:00
action : 'Create a contact' ,
2020-10-13 12:39:36 -07:00
} ,
2020-10-13 12:35:01 -07:00
{
name : 'Delete' ,
value : 'delete' ,
description : 'Delete a contact' ,
2022-07-10 13:50:51 -07:00
action : 'Delete a contact' ,
2020-10-13 12:35:01 -07:00
} ,
{
name : 'Get' ,
value : 'get' ,
description : 'Get a contact' ,
2022-07-10 13:50:51 -07:00
action : 'Get a contact' ,
2020-10-13 12:35:01 -07:00
} ,
2020-10-13 12:39:36 -07:00
{
name : 'Get All' ,
value : 'getAll' ,
description : 'Get all contacts' ,
2022-07-10 13:50:51 -07:00
action : 'Get all contacts' ,
2020-10-13 12:39:36 -07:00
} ,
2020-10-13 12:35:01 -07:00
{
name : 'Update' ,
value : 'update' ,
description : 'Update a contact' ,
2022-07-10 13:50:51 -07:00
action : 'Update a contact' ,
2020-10-13 12:35:01 -07:00
} ,
] ,
2020-10-15 03:07:06 -07:00
default : 'create' ,
2020-10-13 12:35:01 -07:00
} ,
2021-12-03 00:44:16 -08:00
] ;
2020-10-13 12:35:01 -07:00
2021-12-03 00:44:16 -08:00
export const contactFields : INodeProperties [ ] = [
2020-10-13 12:35:01 -07:00
2020-10-13 12:39:36 -07:00
/* -------------------------------------------------------------------------- */
/* contact:create */
/* -------------------------------------------------------------------------- */
{
displayName : 'Email' ,
name : 'email' ,
required : true ,
type : 'string' ,
2022-06-20 07:54:01 -07:00
placeholder : 'name@email.com' ,
2020-10-13 12:39:36 -07:00
displayOptions : {
show : {
operation : [
'create' ,
] ,
resource : [
'contact' ,
] ,
} ,
} ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The email address of the contact' ,
2020-10-13 12:39:36 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'List Name or ID' ,
2020-10-13 12:39:36 -07:00
name : 'listId' ,
required : true ,
type : 'options' ,
2022-07-14 13:05:11 -07:00
description : 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2020-10-13 12:39:36 -07:00
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' ,
2022-04-22 09:29:51 -07:00
default : { } ,
2020-10-13 12:39:36 -07:00
placeholder : 'Add Custom Field' ,
typeOptions : {
multipleValues : true ,
loadOptionsMethod : 'getCustomFields' ,
} ,
options : [
{
name : 'customFieldsValues' ,
displayName : 'Custom Field' ,
values : [
{
2022-06-03 10:23:49 -07:00
displayName : 'Key Name or ID' ,
2020-10-13 12:39:36 -07:00
name : 'key' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getCustomFields' ,
} ,
2022-07-14 13:05:11 -07:00
description : 'The end user specified key of the user defined data. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2020-10-13 12:39:36 -07:00
default : '' ,
} ,
{
displayName : 'Value' ,
name : 'value' ,
type : 'string' ,
2022-05-06 14:01:25 -07:00
description : 'The end user specified value of the user defined data' ,
2020-10-13 12:39:36 -07:00
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.' ,
} ,
{
2022-06-20 07:54:01 -07:00
displayName : 'Tag Names or IDs' ,
2020-10-13 12:39:36 -07:00
name : 'tags' ,
type : 'multiOptions' ,
typeOptions : {
loadOptionsMethod : 'getTags' ,
} ,
default : [ ] ,
2022-07-14 13:05:11 -07:00
description : 'The tags you want to set to the contact. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2020-10-13 12:39:36 -07:00
} ,
] ,
} ,
2020-10-13 12:35:01 -07:00
/* -------------------------------------------------------------------------- */
/* contact:delete */
/* -------------------------------------------------------------------------- */
{
displayName : 'Contact ID' ,
name : 'contactId' ,
required : true ,
type : 'string' ,
displayOptions : {
show : {
operation : [
'delete' ,
] ,
resource : [
'contact' ,
] ,
} ,
} ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Can be ID or email' ,
2020-10-13 12:35:01 -07:00
} ,
2020-10-13 12:39:36 -07:00
2020-10-13 12:35:01 -07:00
/* -------------------------------------------------------------------------- */
/* contact:get */
/* -------------------------------------------------------------------------- */
{
displayName : 'Contact ID' ,
name : 'contactId' ,
required : true ,
type : 'string' ,
displayOptions : {
show : {
operation : [
'get' ,
] ,
resource : [
'contact' ,
] ,
} ,
} ,
default : '' ,
2020-10-13 12:39:36 -07:00
description : 'Can be ID or email' ,
} ,
/* -------------------------------------------------------------------------- */
/* contact:getAll */
/* -------------------------------------------------------------------------- */
{
2022-06-03 10:23:49 -07:00
displayName : 'List Name or ID' ,
2020-10-13 12:39:36 -07:00
name : 'listId' ,
required : true ,
type : 'options' ,
2022-07-14 13:05:11 -07:00
description : 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2020-10-13 12:39:36 -07:00
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 ,
2022-05-06 14:01:25 -07:00
description : 'Whether to return all results or only up to a given limit' ,
2020-10-13 12:39:36 -07:00
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
displayOptions : {
show : {
operation : [
'getAll' ,
] ,
resource : [
'contact' ,
] ,
returnAll : [
false ,
] ,
} ,
} ,
typeOptions : {
minValue : 1 ,
maxValue : 500 ,
} ,
default : 100 ,
2022-05-06 14:01:25 -07:00
description : 'Max number of results to return' ,
2020-10-13 12:39:36 -07:00
} ,
{
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 : '' ,
2022-05-06 14:01:25 -07:00
description : 'A comma-separated list of attributes to include in the response' ,
2020-10-13 12:39:36 -07:00
} ,
{
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' ,
} ,
] ,
2020-10-13 12:35:01 -07:00
} ,
2020-10-13 12:39:36 -07:00
2020-10-13 12:35:01 -07:00
/* -------------------------------------------------------------------------- */
/* contact:update */
/* -------------------------------------------------------------------------- */
{
displayName : 'Email' ,
name : 'email' ,
required : true ,
type : 'string' ,
2022-06-20 07:54:01 -07:00
placeholder : 'name@email.com' ,
2020-10-13 12:35:01 -07:00
displayOptions : {
show : {
operation : [
'update' ,
] ,
resource : [
'contact' ,
] ,
} ,
} ,
default : '' ,
} ,
{
displayName : 'Update Fields' ,
name : 'updateFields' ,
type : 'collection' ,
displayOptions : {
show : {
operation : [
'update' ,
] ,
resource : [
'contact' ,
] ,
} ,
} ,
default : { } ,
placeholder : 'Add Field' ,
options : [
2020-12-07 14:53:55 -08:00
{
2022-06-20 07:54:01 -07:00
displayName : 'Add Tag Names or IDs' ,
2020-12-07 14:53:55 -08:00
name : 'addTags' ,
type : 'multiOptions' ,
typeOptions : {
loadOptionsMethod : 'getTags' ,
} ,
default : [ ] ,
2022-07-14 13:05:11 -07:00
description : 'The tags you want to add to the contact. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2020-12-07 14:53:55 -08:00
} ,
2020-10-13 12:35:01 -07:00
{
displayName : 'Custom Fields' ,
name : 'customFieldsUi' ,
type : 'fixedCollection' ,
2022-04-22 09:29:51 -07:00
default : { } ,
2020-10-13 12:35:01 -07:00
placeholder : 'Add Custom Field' ,
typeOptions : {
multipleValues : true ,
loadOptionsMethod : 'getCustomFields' ,
} ,
options : [
{
name : 'customFieldsValues' ,
displayName : 'Custom Field' ,
values : [
{
2022-06-03 10:23:49 -07:00
displayName : 'Key Name or ID' ,
2020-10-13 12:35:01 -07:00
name : 'key' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getCustomFields' ,
} ,
2022-07-14 13:05:11 -07:00
description : 'The end user specified key of the user defined data. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2020-10-13 12:35:01 -07:00
default : '' ,
} ,
{
displayName : 'Value' ,
name : 'value' ,
type : 'string' ,
2022-05-06 14:01:25 -07:00
description : 'The end user specified value of the user defined data' ,
2020-10-13 12:35:01 -07:00
default : '' ,
} ,
] ,
} ,
] ,
} ,
2020-12-07 14:53:55 -08:00
{
2022-06-23 10:45:56 -07:00
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-wrong-for-dynamic-multi-options
displayName : 'Remove Tags' ,
2020-12-07 14:53:55 -08:00
name : 'removeTags' ,
type : 'multiOptions' ,
typeOptions : {
loadOptionsMethod : 'getTags' ,
} ,
default : [ ] ,
2022-07-14 13:05:11 -07:00
description : 'The tags you want to add to the contact. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2020-12-07 14:53:55 -08:00
} ,
2020-10-13 12:35:01 -07:00
{
displayName : 'Status' ,
name : 'status' ,
type : 'options' ,
options : [
{
name : 'Active' ,
value : 'ACTIVE' ,
} ,
{
2020-10-13 12:39:36 -07:00
name : 'Banned' ,
value : 'BANNED' ,
2020-10-13 12:35:01 -07:00
} ,
{
name : 'Bounced' ,
value : 'BOUNCED' ,
} ,
{
2020-10-13 12:39:36 -07:00
name : 'Inactive' ,
value : 'INACTIVE' ,
2020-10-13 12:35:01 -07:00
} ,
{
2020-10-13 12:39:36 -07:00
name : 'Unsubscribed' ,
value : 'UNSUBSCRIBED' ,
2020-10-13 12:35:01 -07:00
} ,
] ,
default : '' ,
description : 'The status of the contact. You can only send email to contacts with ACTIVE status.' ,
} ,
{
2022-06-20 07:54:01 -07:00
displayName : 'Tag Names or IDs' ,
2020-10-13 12:35:01 -07:00
name : 'tags' ,
type : 'multiOptions' ,
typeOptions : {
loadOptionsMethod : 'getTags' ,
} ,
default : [ ] ,
2022-07-14 13:05:11 -07:00
description : 'The tags you want to set to the contact. Will replace all existing ones. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2020-10-13 12:35:01 -07:00
} ,
] ,
} ,
2021-12-03 00:44:16 -08:00
] ;