2023-01-27 03:22:44 -08:00
import type { INodeProperties } from 'n8n-workflow' ;
2020-10-13 12:35:01 -07:00
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 : {
2022-08-01 13:47:55 -07:00
resource : [ 'contact' ] ,
2020-10-13 12:35:01 -07:00
} ,
} ,
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
{
2022-09-07 07:51:14 -07:00
name : 'Get Many' ,
2020-10-13 12:39:36 -07:00
value : 'getAll' ,
2022-09-13 03:36:36 -07:00
description : 'Get many contacts' ,
2022-09-08 08:10:13 -07:00
action : 'Get many 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: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 : {
2022-08-01 13:47:55 -07:00
operation : [ 'create' ] ,
resource : [ 'contact' ] ,
2020-10-13 12:39:36 -07:00
} ,
} ,
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-08-01 13:47:55 -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 : {
2022-08-01 13:47:55 -07:00
operation : [ 'create' ] ,
resource : [ 'contact' ] ,
2020-10-13 12:39:36 -07:00
} ,
} ,
default : '' ,
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
operation : [ 'create' ] ,
resource : [ 'contact' ] ,
2020-10-13 12:39:36 -07:00
} ,
} ,
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-08-01 13:47:55 -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 : '' ,
2022-08-01 13:47:55 -07:00
description :
'The status of the contact. You can only send email to contacts with ACTIVE status.' ,
2020-10-13 12:39:36 -07:00
} ,
{
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-08-01 13:47:55 -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 : {
2022-08-01 13:47:55 -07:00
operation : [ 'delete' ] ,
resource : [ 'contact' ] ,
2020-10-13 12:35:01 -07:00
} ,
} ,
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 : {
2022-08-01 13:47:55 -07:00
operation : [ 'get' ] ,
resource : [ 'contact' ] ,
2020-10-13 12:35:01 -07:00
} ,
} ,
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-08-01 13:47:55 -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 : {
2022-08-01 13:47:55 -07:00
operation : [ 'getAll' ] ,
resource : [ 'contact' ] ,
2020-10-13 12:39:36 -07:00
} ,
} ,
default : '' ,
} ,
{
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
operation : [ 'getAll' ] ,
resource : [ 'contact' ] ,
2020-10-13 12:39:36 -07:00
} ,
} ,
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 : {
2022-08-01 13:47:55 -07:00
operation : [ 'getAll' ] ,
resource : [ 'contact' ] ,
returnAll : [ false ] ,
2020-10-13 12:39:36 -07:00
} ,
} ,
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 : {
2022-08-01 13:47:55 -07:00
operation : [ 'getAll' ] ,
resource : [ 'contact' ] ,
2020-10-13 12:39:36 -07:00
} ,
} ,
default : { } ,
options : [
{
displayName : 'Direction' ,
name : 'direction' ,
type : 'options' ,
options : [
{
name : 'ASC' ,
value : 'asc' ,
} ,
{
name : 'DESC' ,
value : 'desc' ,
} ,
] ,
default : 'desc' ,
2022-08-01 13:47:55 -07:00
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' ,
2020-10-13 12:39:36 -07:00
} ,
{
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' ,
2022-08-01 13:47:55 -07:00
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:39:36 -07:00
} ,
] ,
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 : {
2022-08-01 13:47:55 -07:00
operation : [ 'update' ] ,
resource : [ 'contact' ] ,
2020-10-13 12:35:01 -07:00
} ,
} ,
default : '' ,
} ,
{
displayName : 'Update Fields' ,
name : 'updateFields' ,
type : 'collection' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
operation : [ 'update' ] ,
resource : [ 'contact' ] ,
2020-10-13 12:35:01 -07:00
} ,
} ,
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-08-01 13:47:55 -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-08-01 13:47:55 -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-08-01 13:47:55 -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 : '' ,
2022-08-01 13:47:55 -07:00
description :
'The status of the contact. You can only send email to contacts with ACTIVE status.' ,
2020-10-13 12:35:01 -07:00
} ,
{
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-08-01 13:47:55 -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
] ;