2022-08-17 08:50:24 -07:00
import { INodeProperties } from 'n8n-workflow' ;
2020-11-10 09:28:03 -08:00
2021-12-03 00:44:16 -08:00
export const contactOperations : INodeProperties [ ] = [
2020-11-10 09:28:03 -08:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2020-11-10 09:28:03 -08:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'contact' ] ,
2020-11-10 09:28:03 -08:00
} ,
} ,
options : [
{
name : 'Create' ,
value : 'create' ,
description : 'Create a new contact' ,
2022-07-10 13:50:51 -07:00
action : 'Create a contact' ,
2020-11-10 09:28:03 -08:00
} ,
{
name : 'Delete' ,
value : 'delete' ,
description : 'Delete a contact' ,
2022-07-10 13:50:51 -07:00
action : 'Delete a contact' ,
2020-11-10 09:28:03 -08:00
} ,
{
name : 'Get' ,
value : 'get' ,
description : 'Get a contact' ,
2022-07-10 13:50:51 -07:00
action : 'Get a contact' ,
2020-11-10 09:28:03 -08:00
} ,
{
name : 'Get All' ,
value : 'getAll' ,
description : 'Get all contacts' ,
2022-07-10 13:50:51 -07:00
action : 'Get all contacts' ,
2020-11-10 09:28:03 -08:00
} ,
{
name : 'Update' ,
value : 'update' ,
description : 'Update contact properties' ,
2022-07-10 13:50:51 -07:00
action : 'Update a contact' ,
2020-11-10 09:28:03 -08:00
} ,
] ,
default : 'get' ,
} ,
2021-12-03 00:44:16 -08:00
] ;
2020-11-10 09:28:03 -08:00
2021-12-03 00:44:16 -08:00
export const contactFields : INodeProperties [ ] = [
2020-11-10 09:28:03 -08:00
/* -------------------------------------------------------------------------- */
/* contact:create */
/* -------------------------------------------------------------------------- */
{
displayName : 'Email' ,
name : 'email' ,
type : 'string' ,
2022-06-20 07:54:01 -07:00
placeholder : 'name@email.com' ,
2020-11-10 09:28:03 -08:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'contact' ] ,
operation : [ 'create' ] ,
2020-11-10 09:28:03 -08:00
} ,
} ,
default : '' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Campaign Name or ID' ,
2020-11-10 09:28:03 -08:00
name : 'campaignId' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getCampaigns' ,
} ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'contact' ] ,
operation : [ 'create' ] ,
2020-11-10 09:28:03 -08:00
} ,
} ,
default : '' ,
2022-08-17 08:50:24 -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-11-10 09:28:03 -08:00
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'contact' ] ,
operation : [ 'create' ] ,
2020-11-10 09:28:03 -08:00
} ,
} ,
options : [
{
displayName : 'Custom Fields' ,
name : 'customFieldsUi' ,
type : 'fixedCollection' ,
2022-04-22 09:29:51 -07:00
default : { } ,
2020-11-10 09:28:03 -08:00
placeholder : 'Add Custom Field' ,
typeOptions : {
multipleValues : true ,
} ,
options : [
{
name : 'customFieldValues' ,
displayName : 'Custom Field' ,
values : [
{
2022-06-03 10:23:49 -07:00
displayName : 'Field Name or ID' ,
2020-11-10 09:28:03 -08:00
name : 'customFieldId' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getCustomFields' ,
} ,
2022-08-17 08:50:24 -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-11-10 09:28:03 -08: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-11-10 09:28:03 -08:00
default : '' ,
} ,
] ,
} ,
] ,
} ,
{
displayName : 'Day Of Cycle' ,
name : 'dayOfCycle' ,
type : 'string' ,
2022-08-17 08:50:24 -07:00
description :
'The day on which the contact is in the Autoresponder cycle. null indicates the contacts is not in the cycle.' ,
2020-11-10 09:28:03 -08:00
default : '' ,
} ,
{
displayName : 'IP Address' ,
name : 'ipAddress' ,
type : 'string' ,
2022-08-17 08:50:24 -07:00
description : "The contact's IP address. IPv4 and IPv6 formats are accepted." ,
2020-11-10 09:28:03 -08:00
default : '' ,
} ,
{
displayName : 'Name' ,
name : 'name' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Note' ,
name : 'note' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Scoring' ,
name : 'scoring' ,
type : 'number' ,
default : '' ,
description : 'Contact scoring, pass null to remove the score from a contact' ,
typeOptions : {
minValue : 0 ,
} ,
} ,
{
2022-06-20 07:54:01 -07:00
displayName : 'Tag Names or IDs' ,
2020-11-10 09:28:03 -08:00
name : 'tags' ,
type : 'multiOptions' ,
2022-08-17 08:50:24 -07:00
description :
'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2020-11-10 09:28:03 -08:00
typeOptions : {
loadOptionsMethod : 'getTags' ,
} ,
2022-04-22 09:29:51 -07:00
default : [ ] ,
2020-11-10 09:28:03 -08:00
} ,
] ,
} ,
/* -------------------------------------------------------------------------- */
/* contact:delete */
/* -------------------------------------------------------------------------- */
{
displayName : 'Contact ID' ,
name : 'contactId' ,
type : 'string' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'contact' ] ,
operation : [ 'delete' ] ,
2020-11-10 09:28:03 -08:00
} ,
} ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'ID of contact to delete' ,
2020-11-10 09:28:03 -08:00
} ,
{
displayName : 'Options' ,
name : 'options' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'contact' ] ,
operation : [ 'delete' ] ,
2020-11-10 09:28:03 -08:00
} ,
} ,
options : [
{
displayName : 'IP Address' ,
name : 'ipAddress' ,
type : 'string' ,
2022-08-17 08:50:24 -07:00
description :
'This makes it possible to pass the IP from which the contact unsubscribed. Used only if the messageId was send.' ,
2020-11-10 09:28:03 -08:00
default : '' ,
} ,
{
displayName : 'Message ID' ,
name : 'messageId' ,
type : 'string' ,
2022-08-17 08:50:24 -07:00
description :
'The ID of a message (such as a newsletter, an autoresponder, or an RSS-newsletter). When passed, this method will simulate the unsubscribe process, as if the contact clicked the unsubscribe link in a given message.' ,
2020-11-10 09:28:03 -08:00
default : '' ,
} ,
] ,
} ,
2020-11-10 09:32:19 -08:00
2020-11-10 09:28:03 -08:00
/* -------------------------------------------------------------------------- */
/* contact:get */
/* -------------------------------------------------------------------------- */
{
displayName : 'Contact ID' ,
name : 'contactId' ,
type : 'string' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'contact' ] ,
operation : [ 'get' ] ,
2020-11-10 09:28:03 -08:00
} ,
} ,
default : '' ,
description : 'Unique identifier for a particular contact' ,
} ,
{
displayName : 'Options' ,
name : 'options' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'contact' ] ,
operation : [ 'get' ] ,
2020-11-10 09:28:03 -08:00
} ,
} ,
options : [
{
displayName : 'Fields' ,
name : 'fields' ,
type : 'string' ,
2022-08-17 08:50:24 -07:00
description :
'List of fields that should be returned. ID is always returned. Fields should be separated by comma' ,
2020-11-10 09:28:03 -08:00
default : '' ,
} ,
] ,
} ,
2020-11-10 09:32:19 -08:00
2020-11-10 09:28:03 -08:00
/* -------------------------------------------------------------------------- */
/* contact:getAll */
/* -------------------------------------------------------------------------- */
{
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'contact' ] ,
operation : [ 'getAll' ] ,
2020-11-10 09:28:03 -08: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-11-10 09:28:03 -08:00
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
2022-05-20 14:47:24 -07:00
typeOptions : {
minValue : 1 ,
} ,
2022-05-06 14:01:25 -07:00
description : 'Max number of results to return' ,
2020-11-10 09:28:03 -08:00
default : 20 ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'contact' ] ,
operation : [ 'getAll' ] ,
returnAll : [ false ] ,
2020-11-10 09:28:03 -08:00
} ,
} ,
} ,
{
displayName : 'Options' ,
name : 'options' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'contact' ] ,
operation : [ 'getAll' ] ,
2020-11-10 09:28:03 -08:00
} ,
} ,
options : [
{
displayName : 'Campaign ID' ,
name : 'campaignId' ,
type : 'string' ,
2022-05-06 14:01:25 -07:00
description : 'Search contacts by campaign ID' ,
2020-11-10 09:28:03 -08:00
default : '' ,
} ,
{
displayName : 'Change On From' ,
name : 'changeOnFrom' ,
type : 'dateTime' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Search contacts edited from this date' ,
2020-11-10 09:28:03 -08:00
} ,
{
displayName : 'Change On To' ,
name : 'changeOnTo' ,
type : 'dateTime' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Search contacts edited to this date' ,
2020-11-10 09:28:03 -08:00
} ,
{
displayName : 'Created On From' ,
name : 'createdOnFrom' ,
type : 'dateTime' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Count data from this date' ,
2020-11-10 09:28:03 -08:00
} ,
{
displayName : 'Created On To' ,
name : 'createdOnTo' ,
type : 'dateTime' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Count data from this date' ,
2020-11-10 09:28:03 -08:00
} ,
{
displayName : 'Exact Match' ,
name : 'exactMatch' ,
type : 'boolean' ,
default : false ,
2022-08-17 08:50:24 -07:00
description :
"Whether to search for contacts with the exact value of the email and name provided in the query string. Without this flag, matching is done via a standard 'like' comparison, which may sometimes be slow." ,
2020-11-10 09:28:03 -08:00
} ,
{
displayName : 'Fields' ,
name : 'fields' ,
type : 'string' ,
2022-08-17 08:50:24 -07:00
description :
'List of fields that should be returned. ID is always returned. Fields should be separated by comma' ,
2020-11-10 09:28:03 -08:00
default : '' ,
} ,
{
displayName : 'Name' ,
name : 'name' ,
type : 'string' ,
2022-05-06 14:01:25 -07:00
description : 'Search contacts by name' ,
2020-11-10 09:28:03 -08:00
default : '' ,
} ,
{
displayName : 'Origin' ,
name : 'origin' ,
type : 'options' ,
options : [
{
name : 'API' ,
value : 'api' ,
} ,
{
name : 'Copy' ,
value : 'copy' ,
} ,
{
name : 'Email' ,
value : 'email' ,
} ,
{
name : 'Forward' ,
value : 'forward' ,
} ,
{
2022-06-03 10:23:49 -07:00
name : 'Import' ,
2020-11-10 09:28:03 -08:00
value : 'import' ,
} ,
{
name : 'Iphone' ,
value : 'iphone' ,
} ,
{
name : 'Landing Page' ,
value : 'landing_page' ,
} ,
{
name : 'Leads' ,
value : 'leads' ,
} ,
{
name : 'Panel' ,
value : 'panel' ,
} ,
{
name : 'Sale' ,
value : 'sale' ,
} ,
{
name : 'Survey' ,
value : 'survey' ,
} ,
{
name : 'Webinar' ,
value : 'webinar' ,
} ,
{
name : 'WWW' ,
value : 'www' ,
} ,
] ,
2022-05-06 14:01:25 -07:00
description : 'Search contacts by origin' ,
2020-11-10 09:28:03 -08:00
default : '' ,
} ,
{
displayName : 'Sort By' ,
name : 'sortBy' ,
type : 'options' ,
options : [
{
name : 'Campaign ID' ,
value : 'campaignId' ,
} ,
{
name : 'Changed On' ,
value : 'changedOn' ,
} ,
{
name : 'Created On' ,
value : 'createdOn' ,
} ,
{
name : 'Email' ,
value : 'email' ,
} ,
] ,
default : '' ,
} ,
{
displayName : 'Sort Order' ,
name : 'sortOrder' ,
type : 'options' ,
options : [
{
name : 'ASC' ,
value : 'ASC' ,
} ,
{
name : 'DESC' ,
value : 'DESC' ,
} ,
] ,
default : '' ,
} ,
] ,
} ,
2021-02-07 14:32:12 -08:00
2020-11-10 09:28:03 -08:00
/* -------------------------------------------------------------------------- */
/* contact:update */
/* -------------------------------------------------------------------------- */
{
displayName : 'Contact ID' ,
name : 'contactId' ,
type : 'string' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'contact' ] ,
operation : [ 'update' ] ,
2020-11-10 09:28:03 -08:00
} ,
} ,
default : '' ,
description : 'Unique identifier for a particular contact' ,
} ,
{
displayName : 'Update Fields' ,
name : 'updateFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'contact' ] ,
operation : [ 'update' ] ,
2020-11-10 09:28:03 -08:00
} ,
} ,
options : [
{
2022-06-03 10:23:49 -07:00
displayName : 'Campaign Name or ID' ,
2020-11-10 09:28:03 -08:00
name : 'campaignId' ,
type : 'options' ,
2022-08-17 08:50:24 -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-11-10 09:28:03 -08:00
typeOptions : {
loadOptionsMethod : 'getCampaigns' ,
} ,
default : '' ,
} ,
{
displayName : 'Custom Fields' ,
name : 'customFieldsUi' ,
type : 'fixedCollection' ,
2022-04-22 09:29:51 -07:00
default : { } ,
2020-11-10 09:28:03 -08:00
placeholder : 'Add Custom Field' ,
typeOptions : {
multipleValues : true ,
} ,
options : [
{
name : 'customFieldValues' ,
displayName : 'Custom Field' ,
values : [
{
2022-06-03 10:23:49 -07:00
displayName : 'Field Name or ID' ,
2020-11-10 09:28:03 -08:00
name : 'customFieldId' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getCustomFields' ,
} ,
2022-08-17 08:50:24 -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-11-10 09:28:03 -08: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-11-10 09:28:03 -08:00
default : '' ,
} ,
] ,
} ,
] ,
} ,
{
displayName : 'Day Of Cycle' ,
name : 'dayOfCycle' ,
type : 'string' ,
2022-08-17 08:50:24 -07:00
description :
'The day on which the contact is in the Autoresponder cycle. null indicates the contacts is not in the cycle.' ,
2020-11-10 09:28:03 -08:00
default : '' ,
} ,
{
displayName : 'Email' ,
name : 'email' ,
type : 'string' ,
2022-06-20 07:54:01 -07:00
placeholder : 'name@email.com' ,
2020-11-10 09:28:03 -08:00
default : '' ,
} ,
{
displayName : 'IP Address' ,
name : 'ipAddress' ,
type : 'string' ,
2022-08-17 08:50:24 -07:00
description : "The contact's IP address. IPv4 and IPv6 formats are accepted." ,
2020-11-10 09:28:03 -08:00
default : '' ,
} ,
{
displayName : 'Name' ,
name : 'name' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Note' ,
name : 'note' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Scoring' ,
name : 'scoring' ,
type : 'number' ,
default : '' ,
description : 'Contact scoring, pass null to remove the score from a contact' ,
typeOptions : {
minValue : 0 ,
} ,
} ,
{
2022-06-20 07:54:01 -07:00
displayName : 'Tag Names or IDs' ,
2020-11-10 09:28:03 -08:00
name : 'tags' ,
type : 'multiOptions' ,
2022-08-17 08:50:24 -07:00
description :
'Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>' ,
2020-11-10 09:28:03 -08:00
typeOptions : {
loadOptionsMethod : 'getTags' ,
} ,
2022-04-22 09:29:51 -07:00
default : [ ] ,
2020-11-10 09:28:03 -08:00
} ,
] ,
} ,
2021-12-03 00:44:16 -08:00
] ;