2021-01-13 11:20:30 -08:00
import { INodeProperties } from 'n8n-workflow' ;
2019-11-16 14:16:11 -08:00
2021-12-03 00:44:16 -08:00
export const leadOpeations : INodeProperties [ ] = [
2019-11-16 14:16:11 -08:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2019-11-16 14:16:11 -08:00
displayOptions : {
show : {
resource : [
'lead' ,
] ,
} ,
} ,
options : [
{
name : 'Create' ,
value : 'create' ,
description : 'Create a new lead' ,
} ,
2021-04-24 08:49:52 -07:00
{
name : 'Delete' ,
value : 'delete' ,
description : 'Delete a lead' ,
} ,
2019-11-20 06:45:58 -08:00
{
2019-11-22 14:04:06 -08:00
name : 'Get' ,
value : 'get' ,
description : 'Get data of a lead' ,
2019-11-20 06:45:58 -08:00
} ,
2019-11-21 09:39:04 -08:00
{
2019-11-22 14:04:06 -08:00
name : 'Get All' ,
value : 'getAll' ,
description : 'Get data of all leads' ,
2019-11-21 09:39:04 -08:00
} ,
{
2019-11-22 14:04:06 -08:00
name : 'Update' ,
value : 'update' ,
description : 'Update new lead' ,
2019-11-21 09:39:04 -08:00
} ,
2019-11-16 14:16:11 -08:00
] ,
2019-11-22 14:04:06 -08:00
default : 'create' ,
2019-11-16 14:16:11 -08:00
} ,
2021-12-03 00:44:16 -08:00
] ;
2019-11-16 14:16:11 -08:00
2021-12-03 00:44:16 -08:00
export const leadFields : INodeProperties [ ] = [
2019-11-21 09:39:04 -08:00
2021-04-24 08:49:52 -07:00
/* -------------------------------------------------------------------------- */
/* lead:delete */
/* -------------------------------------------------------------------------- */
2019-11-21 09:39:04 -08:00
{
displayName : 'Delete By' ,
name : 'deleteBy' ,
type : 'options' ,
displayOptions : {
show : {
resource : [
'lead' ,
] ,
operation : [
'delete' ,
] ,
} ,
} ,
options : [
{
name : 'ID' ,
value : 'id' ,
2022-05-06 14:01:25 -07:00
description : 'The Intercom defined ID representing the Lead' ,
2019-11-21 09:39:04 -08:00
} ,
{
name : 'User ID' ,
value : 'userId' ,
description : 'Automatically generated identifier for the Lead' ,
} ,
] ,
default : '' ,
} ,
{
displayName : 'Value' ,
name : 'value' ,
type : 'string' ,
2021-12-03 00:44:16 -08:00
default : '' ,
2019-11-21 09:39:04 -08:00
required : true ,
displayOptions : {
show : {
resource : [
'lead' ,
] ,
operation : [
'delete' ,
] ,
} ,
} ,
description : 'Delete by value' ,
} ,
2021-04-24 08:49:52 -07:00
/* -------------------------------------------------------------------------- */
/* lead:get */
/* -------------------------------------------------------------------------- */
2019-11-21 09:39:04 -08:00
{
2019-11-22 14:04:06 -08:00
displayName : 'Select By' ,
name : 'selectBy' ,
2019-11-21 09:39:04 -08:00
type : 'options' ,
displayOptions : {
show : {
resource : [
'lead' ,
] ,
operation : [
2019-11-22 14:04:06 -08:00
'get' ,
2019-11-21 09:39:04 -08:00
] ,
} ,
} ,
options : [
2019-11-22 14:04:06 -08:00
{
name : 'Email' ,
value : 'email' ,
description : 'Email representing the Lead' ,
} ,
2019-11-21 09:39:04 -08:00
{
name : 'ID' ,
value : 'id' ,
2022-05-06 14:01:25 -07:00
description : 'The Intercom defined ID representing the Lead' ,
2019-11-21 09:39:04 -08:00
} ,
{
name : 'User ID' ,
value : 'userId' ,
description : 'Automatically generated identifier for the Lead' ,
} ,
{
name : 'Phone' ,
value : 'phone' ,
description : 'Phone representing the Lead' ,
} ,
] ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The property to select the lead by' ,
2019-11-21 09:39:04 -08:00
} ,
{
displayName : 'Value' ,
name : 'value' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
resource : [
'lead' ,
] ,
operation : [
2019-11-22 14:04:06 -08:00
'get' ,
2019-11-21 09:39:04 -08:00
] ,
} ,
} ,
description : 'View by value' ,
} ,
2021-04-24 08:49:52 -07:00
/* -------------------------------------------------------------------------- */
/* lead:getAll */
/* -------------------------------------------------------------------------- */
2019-11-21 09:39:04 -08:00
{
2019-11-22 14:04:06 -08:00
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
2019-11-21 09:39:04 -08:00
displayOptions : {
show : {
resource : [
'lead' ,
] ,
operation : [
2019-11-22 14:04:06 -08:00
'getAll' ,
2019-11-21 09:39:04 -08:00
] ,
} ,
} ,
2019-11-22 14:04:06 -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' ,
2019-11-22 14:04:06 -08:00
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
displayOptions : {
show : {
resource : [
'lead' ,
] ,
operation : [
'getAll' ,
] ,
returnAll : [
false ,
] ,
2019-11-21 09:39:04 -08:00
} ,
2019-11-22 14:04:06 -08:00
} ,
typeOptions : {
minValue : 1 ,
maxValue : 60 ,
} ,
default : 50 ,
2022-05-06 14:01:25 -07:00
description : 'Max number of results to return' ,
2019-11-21 09:39:04 -08:00
} ,
{
2019-11-22 14:04:06 -08:00
displayName : 'Filters' ,
name : 'filters' ,
type : 'collection' ,
placeholder : 'Add Filter' ,
default : { } ,
2019-11-21 09:39:04 -08:00
displayOptions : {
show : {
resource : [
'lead' ,
] ,
operation : [
2019-11-22 14:04:06 -08:00
'getAll' ,
2019-11-21 09:39:04 -08:00
] ,
} ,
} ,
2019-11-22 14:04:06 -08:00
options : [
{
displayName : 'Email' ,
name : 'email' ,
type : 'string' ,
2022-06-20 07:54:01 -07:00
placeholder : 'name@email.com' ,
2019-11-22 14:04:06 -08:00
default : '' ,
description : 'The email address of the lead' ,
} ,
{
displayName : 'Phone' ,
name : 'phone' ,
type : 'string' ,
default : '' ,
description : 'The phone number of the lead' ,
} ,
2020-10-22 06:46:03 -07:00
] ,
2019-11-21 09:39:04 -08:00
} ,
2021-04-24 08:49:52 -07:00
/* -------------------------------------------------------------------------- */
/* lead:update */
/* -------------------------------------------------------------------------- */
2019-11-20 06:45:58 -08:00
{
displayName : 'Update By' ,
name : 'updateBy' ,
type : 'options' ,
displayOptions : {
show : {
resource : [
'lead' ,
] ,
operation : [
'update' ,
] ,
} ,
} ,
options : [
{
2019-11-21 09:39:04 -08:00
name : 'User ID' ,
2019-11-20 06:45:58 -08:00
value : 'userId' ,
description : 'Automatically generated identifier for the Lead' ,
} ,
{
2019-11-21 09:39:04 -08:00
name : 'ID' ,
2019-11-20 06:45:58 -08:00
value : 'id' ,
2022-05-06 14:01:25 -07:00
description : 'The Intercom defined ID representing the Lead' ,
2019-11-20 06:45:58 -08:00
} ,
] ,
2019-11-22 14:04:06 -08:00
default : 'id' ,
2022-05-06 14:01:25 -07:00
description : 'The property via which to query the lead' ,
2019-11-20 06:45:58 -08:00
} ,
{
displayName : 'Value' ,
name : 'value' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
resource : [
'lead' ,
] ,
operation : [
'update' ,
] ,
} ,
} ,
2019-11-22 14:04:06 -08:00
description : 'Value of the property to identify the lead to update' ,
2019-11-20 06:45:58 -08:00
} ,
2019-11-21 09:39:04 -08:00
2021-04-24 08:49:52 -07:00
/* -------------------------------------------------------------------------- */
/* lead:create */
/* -------------------------------------------------------------------------- */
2019-11-16 14:16:11 -08:00
{
displayName : 'Email' ,
name : 'email' ,
type : 'string' ,
2022-06-20 07:54:01 -07:00
placeholder : 'name@email.com' ,
2019-11-16 14:16:11 -08:00
default : '' ,
required : true ,
displayOptions : {
show : {
resource : [
'lead' ,
] ,
operation : [
'create' ,
] ,
} ,
} ,
2022-05-06 14:01:25 -07:00
description : 'The email of the user' ,
2019-11-16 14:16:11 -08:00
} ,
{
displayName : 'JSON Parameters' ,
name : 'jsonParameters' ,
type : 'boolean' ,
default : false ,
displayOptions : {
show : {
operation : [
'create' ,
2019-11-20 06:45:58 -08:00
'update' ,
2019-11-16 14:16:11 -08:00
] ,
resource : [
2019-11-22 14:04:06 -08:00
'lead' ,
2019-11-16 14:16:11 -08:00
] ,
} ,
} ,
} ,
{
2019-11-22 14:04:06 -08:00
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
2019-11-16 14:16:11 -08:00
type : 'collection' ,
2019-11-22 14:04:06 -08:00
placeholder : 'Add Field' ,
2019-11-16 14:16:11 -08:00
default : { } ,
displayOptions : {
show : {
operation : [
'create' ,
2019-11-20 06:45:58 -08:00
'update' ,
2019-11-16 14:16:11 -08:00
] ,
resource : [
2019-11-22 14:04:06 -08:00
'lead' ,
2019-11-16 14:16:11 -08:00
] ,
} ,
} ,
options : [
{
2019-11-22 14:04:06 -08:00
displayName : 'Avatar' ,
name : 'avatar' ,
2019-11-16 14:16:11 -08:00
type : 'string' ,
default : '' ,
2022-06-03 10:23:49 -07:00
description : 'An avatar image URL. note: the image URL needs to be https.' ,
2019-11-16 14:16:11 -08:00
} ,
2021-04-24 08:49:52 -07:00
{
2022-06-20 07:54:01 -07:00
displayName : 'Company Names or IDs' ,
2021-04-24 08:49:52 -07:00
name : 'companies' ,
type : 'multiOptions' ,
typeOptions : {
loadOptionsMethod : 'getCompanies' ,
} ,
default : [ ] ,
2022-06-20 07:54:01 -07:00
description : 'Identifies the companies this user belongs to. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>.' ,
2021-04-24 08:49:52 -07:00
} ,
{
displayName : 'Email' ,
name : 'email' ,
type : 'string' ,
2022-06-20 07:54:01 -07:00
placeholder : 'name@email.com' ,
2021-04-24 08:49:52 -07:00
default : '' ,
displayOptions : {
show : {
'/resource' : [
'lead' ,
] ,
'/operation' : [
'update' ,
] ,
} ,
} ,
2022-05-06 14:01:25 -07:00
description : 'The email of the user' ,
2021-04-24 08:49:52 -07:00
} ,
2019-11-16 14:16:11 -08:00
{
displayName : 'Name' ,
name : 'name' ,
type : 'string' ,
default : '' ,
description : 'Name of the user' ,
} ,
2019-11-22 14:04:06 -08:00
{
displayName : 'Phone' ,
name : 'phone' ,
type : 'string' ,
default : '' ,
description : 'The phone number of the user' ,
} ,
2019-11-16 14:16:11 -08:00
{
displayName : 'Unsubscribed From Emails' ,
name : 'unsubscribedFromEmails' ,
type : 'boolean' ,
2019-11-22 14:04:06 -08:00
default : false ,
2019-11-16 14:16:11 -08:00
description : 'Whether the Lead is unsubscribed from emails' ,
} ,
{
displayName : 'Update Last Request At' ,
name : 'updateLastRequestAt' ,
type : 'boolean' ,
default : false ,
2022-06-20 07:54:01 -07:00
description : 'Whether to instruct Intercom to update the users last_request_at value to the current API service time in UTC. default value if not sent is false.' ,
2019-11-16 14:16:11 -08:00
} ,
{
2021-04-24 08:49:52 -07:00
displayName : 'UTM Campaign' ,
name : 'utmCampaign' ,
2019-11-21 09:39:04 -08:00
type : 'string' ,
default : '' ,
2021-04-24 08:49:52 -07:00
description : 'Identifies a specific product promotion or strategic campaign' ,
2019-11-21 09:39:04 -08:00
} ,
{
2021-04-24 08:49:52 -07:00
displayName : 'UTM Content' ,
name : 'utmContent' ,
2019-11-21 09:39:04 -08:00
type : 'string' ,
default : '' ,
2021-04-24 08:49:52 -07:00
description : 'Identifies what specifically was clicked to bring the user to the site' ,
2019-11-21 09:39:04 -08:00
} ,
{
displayName : 'UTM Medium' ,
name : 'utmMedium' ,
type : 'string' ,
default : '' ,
description : 'Identifies what type of link was used' ,
} ,
{
2021-04-24 08:49:52 -07:00
displayName : 'UTM Source' ,
name : 'utmSource' ,
2019-11-21 09:39:04 -08:00
type : 'string' ,
default : '' ,
2022-06-03 10:23:49 -07:00
description : 'An avatar image URL. note: the image URL needs to be https.' ,
2019-11-21 09:39:04 -08:00
} ,
{
displayName : 'UTM Term' ,
name : 'utmTerm' ,
type : 'string' ,
default : '' ,
description : 'Identifies search terms' ,
} ,
2020-10-22 06:46:03 -07:00
] ,
2019-11-16 14:16:11 -08:00
} ,
{
displayName : 'Custom Attributes' ,
2019-11-16 15:47:28 -08:00
name : 'customAttributesJson' ,
type : 'json' ,
typeOptions : {
alwaysOpenEditWindow : true ,
} ,
displayOptions : {
show : {
resource : [
'lead' ,
] ,
operation : [
'create' ,
2019-11-20 06:45:58 -08:00
'update' ,
2019-11-16 15:47:28 -08:00
] ,
jsonParameters : [
true ,
] ,
} ,
} ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'A hash of key/value pairs to represent custom data you want to attribute to a user' ,
2019-11-16 15:47:28 -08:00
} ,
{
displayName : 'Custom Attributes' ,
name : 'customAttributesUi' ,
2019-11-16 14:16:11 -08:00
type : 'fixedCollection' ,
2022-04-22 09:29:51 -07:00
default : { } ,
2019-11-16 14:16:11 -08:00
placeholder : 'Add Attribute' ,
typeOptions : {
multipleValues : true ,
} ,
displayOptions : {
show : {
resource : [
'lead' ,
] ,
operation : [
'create' ,
2019-11-20 06:45:58 -08:00
'update' ,
2019-11-16 14:16:11 -08:00
] ,
jsonParameters : [
false ,
] ,
} ,
} ,
options : [
{
name : 'customAttributesValues' ,
displayName : 'Attributes' ,
values : [
{
displayName : 'Name' ,
name : 'name' ,
type : 'string' ,
default : '' ,
} ,
{
displayName : 'Value' ,
name : 'value' ,
type : 'string' ,
default : '' ,
} ,
] ,
2020-10-22 06:46:03 -07:00
} ,
2019-11-16 14:16:11 -08:00
] ,
2022-05-06 14:01:25 -07:00
description : 'A hash of key/value pairs to represent custom data you want to attribute to a user' ,
2019-11-16 14:16:11 -08:00
} ,
2021-12-03 00:44:16 -08:00
] ;