2023-01-27 03:22:44 -08:00
import type {
2019-06-23 12:21:44 -07:00
IDataObject ,
2023-03-06 08:33:32 -08:00
IExecuteFunctions ,
2024-02-14 07:29:09 -08:00
IHttpRequestMethods ,
2023-03-06 08:33:32 -08:00
ILoadOptionsFunctions ,
2019-06-23 12:21:44 -07:00
INodeExecutionData ,
2020-07-23 13:51:05 -07:00
INodePropertyOptions ,
2020-10-01 05:01:39 -07:00
INodeType ,
INodeTypeDescription ,
2019-06-23 12:21:44 -07:00
} from 'n8n-workflow' ;
2023-01-27 03:22:44 -08:00
import { NodeOperationError } from 'n8n-workflow' ;
2019-06-23 12:21:44 -07:00
2023-01-27 03:22:44 -08:00
import type { ICustomProperties } from './GenericFunctions' ;
2019-06-23 12:21:44 -07:00
import {
pipedriveApiRequest ,
pipedriveApiRequestAllItems ,
2019-10-22 02:30:35 -07:00
pipedriveEncodeCustomProperties ,
pipedriveGetCustomProperties ,
2019-08-27 23:20:53 -07:00
pipedriveResolveCustomProperties ,
2021-10-09 12:20:04 -07:00
sortOptionParameters ,
2019-06-23 12:21:44 -07:00
} from './GenericFunctions' ;
2022-08-17 08:50:24 -07:00
import { currencies } from './utils' ;
2021-07-20 06:53:10 -07:00
2019-07-10 01:16:48 -07:00
interface CustomProperty {
name : string ;
value : string ;
}
/ * *
* Add the additional fields to the body
*
* @param { IDataObject } body The body object to add fields to
* @param { IDataObject } additionalFields The fields to add
* /
function addAdditionalFields ( body : IDataObject , additionalFields : IDataObject ) {
for ( const key of Object . keys ( additionalFields ) ) {
2022-08-17 08:50:24 -07:00
if (
key === 'customProperties' &&
( additionalFields . customProperties as IDataObject ) . property !== undefined
) {
for ( const customProperty of ( additionalFields . customProperties as IDataObject ) !
. property ! as CustomProperty [ ] ) {
2019-07-10 01:16:48 -07:00
body [ customProperty . name ] = customProperty . value ;
}
} else {
body [ key ] = additionalFields [ key ] ;
}
}
}
2019-06-23 12:21:44 -07:00
export class Pipedrive implements INodeType {
description : INodeTypeDescription = {
displayName : 'Pipedrive' ,
name : 'pipedrive' ,
2021-06-12 12:00:37 -07:00
icon : 'file:pipedrive.svg' ,
2019-06-23 12:21:44 -07:00
group : [ 'transform' ] ,
version : 1 ,
2019-07-14 09:55:04 -07:00
subtitle : '={{$parameter["operation"] + ": " + $parameter["resource"]}}' ,
2019-06-23 22:24:47 -07:00
description : 'Create and edit data in Pipedrive' ,
2019-06-23 12:21:44 -07:00
defaults : {
name : 'Pipedrive' ,
} ,
inputs : [ 'main' ] ,
outputs : [ 'main' ] ,
credentials : [
{
name : 'pipedriveApi' ,
required : true ,
2020-06-09 06:48:40 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
authentication : [ 'apiToken' ] ,
2020-06-09 06:48:40 -07:00
} ,
} ,
2022-02-05 13:55:43 -08:00
testedBy : {
request : {
method : 'GET' ,
url : '/users/me' ,
} ,
} ,
2020-06-09 06:48:40 -07:00
} ,
{
name : 'pipedriveOAuth2Api' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
authentication : [ 'oAuth2' ] ,
2020-06-09 06:48:40 -07:00
} ,
} ,
} ,
2019-06-23 12:21:44 -07:00
] ,
2022-02-05 13:55:43 -08:00
requestDefaults : {
baseURL : 'https://api.pipedrive.com/v1' ,
url : '' ,
} ,
2019-06-23 12:21:44 -07:00
properties : [
2020-06-09 06:48:40 -07:00
{
displayName : 'Authentication' ,
name : 'authentication' ,
type : 'options' ,
options : [
{
2020-07-23 13:51:05 -07:00
name : 'API Token' ,
2020-10-22 06:46:03 -07:00
value : 'apiToken' ,
2020-06-09 06:48:40 -07:00
} ,
{
name : 'OAuth2' ,
value : 'oAuth2' ,
} ,
] ,
2020-07-23 13:51:05 -07:00
default : 'apiToken' ,
2020-06-09 06:48:40 -07:00
} ,
2019-06-23 12:21:44 -07:00
{
2019-07-14 08:57:08 -07:00
displayName : 'Resource' ,
name : 'resource' ,
2019-06-23 12:21:44 -07:00
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2019-06-23 12:21:44 -07:00
options : [
{
2019-07-14 08:57:08 -07:00
name : 'Activity' ,
value : 'activity' ,
} ,
{
name : 'Deal' ,
value : 'deal' ,
2019-06-23 12:21:44 -07:00
} ,
2021-09-16 10:09:19 -07:00
{
name : 'Deal Activity' ,
value : 'dealActivity' ,
} ,
2021-08-01 12:19:41 -07:00
{
name : 'Deal Product' ,
value : 'dealProduct' ,
} ,
2019-09-03 14:06:03 -07:00
{
name : 'File' ,
value : 'file' ,
} ,
2021-07-20 06:53:10 -07:00
{
name : 'Lead' ,
value : 'lead' ,
} ,
2019-09-02 13:26:42 -07:00
{
name : 'Note' ,
value : 'note' ,
} ,
2019-06-23 12:21:44 -07:00
{
2019-07-14 08:57:08 -07:00
name : 'Organization' ,
value : 'organization' ,
2019-06-23 12:21:44 -07:00
} ,
2019-07-10 01:16:48 -07:00
{
2019-07-14 08:57:08 -07:00
name : 'Person' ,
value : 'person' ,
} ,
{
name : 'Product' ,
value : 'product' ,
} ,
] ,
default : 'deal' ,
} ,
// ----------------------------------
// operations
// ----------------------------------
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2019-07-14 08:57:08 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'activity' ] ,
2019-07-10 01:16:48 -07:00
} ,
2019-07-14 08:57:08 -07:00
} ,
options : [
2019-06-23 12:21:44 -07:00
{
2019-07-14 08:57:08 -07:00
name : 'Create' ,
value : 'create' ,
description : 'Create an activity' ,
2022-07-10 13:50:51 -07:00
action : 'Create an activity' ,
2019-06-23 12:21:44 -07:00
} ,
{
2019-07-14 08:57:08 -07:00
name : 'Delete' ,
value : 'delete' ,
2019-06-23 12:21:44 -07:00
description : 'Delete an activity' ,
2022-07-10 13:50:51 -07:00
action : 'Delete an activity' ,
2019-06-23 12:21:44 -07:00
} ,
{
2019-07-14 08:57:08 -07:00
name : 'Get' ,
value : 'get' ,
description : 'Get data of an activity' ,
2022-07-10 13:50:51 -07:00
action : 'Get an activity' ,
2019-06-23 12:21:44 -07:00
} ,
2019-08-27 23:20:53 -07:00
{
2022-09-07 07:51:14 -07:00
name : 'Get Many' ,
2019-08-27 23:20:53 -07:00
value : 'getAll' ,
2022-09-13 03:36:36 -07:00
description : 'Get data of many activities' ,
2022-09-08 08:10:13 -07:00
action : 'Get many activities' ,
2019-08-27 23:20:53 -07:00
} ,
2019-07-10 01:16:48 -07:00
{
2019-07-14 08:57:08 -07:00
name : 'Update' ,
value : 'update' ,
description : 'Update an activity' ,
2022-07-10 13:50:51 -07:00
action : 'Update an activity' ,
2019-07-14 08:57:08 -07:00
} ,
] ,
default : 'create' ,
} ,
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2019-07-14 08:57:08 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'deal' ] ,
2019-07-10 01:16:48 -07:00
} ,
2019-07-14 08:57:08 -07:00
} ,
options : [
2019-06-23 12:21:44 -07:00
{
2019-07-14 08:57:08 -07:00
name : 'Create' ,
value : 'create' ,
description : 'Create a deal' ,
2022-07-10 13:50:51 -07:00
action : 'Create a deal' ,
2019-06-23 12:21:44 -07:00
} ,
{
2019-07-14 08:57:08 -07:00
name : 'Delete' ,
value : 'delete' ,
description : 'Delete a deal' ,
2022-07-10 13:50:51 -07:00
action : 'Delete a deal' ,
2019-06-23 12:21:44 -07:00
} ,
2019-11-02 13:41:13 -07:00
{
name : 'Duplicate' ,
value : 'duplicate' ,
description : 'Duplicate a deal' ,
2022-07-10 13:50:51 -07:00
action : 'Duplicate a deal' ,
2019-11-02 13:41:13 -07:00
} ,
2019-06-23 12:21:44 -07:00
{
2019-07-14 08:57:08 -07:00
name : 'Get' ,
value : 'get' ,
2019-06-23 12:21:44 -07:00
description : 'Get data of a deal' ,
2022-07-10 13:50:51 -07:00
action : 'Get a deal' ,
2019-06-23 12:21:44 -07:00
} ,
2019-08-27 23:20:53 -07:00
{
2022-09-07 07:51:14 -07:00
name : 'Get Many' ,
2019-08-27 23:20:53 -07:00
value : 'getAll' ,
2022-09-13 03:36:36 -07:00
description : 'Get data of many deals' ,
2022-09-08 08:10:13 -07:00
action : 'Get many deals' ,
2019-08-27 23:20:53 -07:00
} ,
2021-06-06 11:54:49 -07:00
{
name : 'Search' ,
value : 'search' ,
description : 'Search a deal' ,
2022-07-10 13:50:51 -07:00
action : 'Search a deal' ,
2021-06-06 11:54:49 -07:00
} ,
2019-06-23 12:21:44 -07:00
{
2019-07-14 08:57:08 -07:00
name : 'Update' ,
value : 'update' ,
description : 'Update a deal' ,
2022-07-10 13:50:51 -07:00
action : 'Update a deal' ,
2019-07-14 08:57:08 -07:00
} ,
] ,
default : 'create' ,
} ,
2021-09-16 10:09:19 -07:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2021-09-16 10:09:19 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'dealActivity' ] ,
2021-09-16 10:09:19 -07:00
} ,
} ,
options : [
{
2022-09-07 07:51:14 -07:00
name : 'Get Many' ,
2021-09-16 10:09:19 -07:00
value : 'getAll' ,
2022-09-13 03:36:36 -07:00
description : 'Get many activities of a deal' ,
2022-09-08 08:10:13 -07:00
action : 'Get many deal activities' ,
2021-09-16 10:09:19 -07:00
} ,
] ,
default : 'getAll' ,
} ,
2021-08-01 12:19:41 -07:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2021-08-01 12:19:41 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'dealProduct' ] ,
2021-08-01 12:19:41 -07:00
} ,
} ,
options : [
{
name : 'Add' ,
value : 'add' ,
description : 'Add a product to a deal' ,
2022-07-10 13:50:51 -07:00
action : 'Add a deal product' ,
2021-08-01 12:19:41 -07:00
} ,
{
2022-09-07 07:51:14 -07:00
name : 'Get Many' ,
2021-08-01 12:19:41 -07:00
value : 'getAll' ,
2022-09-13 03:36:36 -07:00
description : 'Get many products in a deal' ,
2022-09-08 08:10:13 -07:00
action : 'Get many deal products' ,
2021-08-01 12:19:41 -07:00
} ,
{
name : 'Remove' ,
value : 'remove' ,
description : 'Remove a product from a deal' ,
2022-07-10 13:50:51 -07:00
action : 'Remove a deal product' ,
2021-08-01 12:19:41 -07:00
} ,
{
name : 'Update' ,
value : 'update' ,
description : 'Update a product in a deal' ,
2022-07-10 13:50:51 -07:00
action : 'Update a deal product' ,
2021-08-01 12:19:41 -07:00
} ,
] ,
default : 'add' ,
} ,
2019-09-03 14:06:03 -07:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2019-09-03 14:06:03 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'file' ] ,
2019-09-03 14:06:03 -07:00
} ,
} ,
options : [
{
name : 'Create' ,
value : 'create' ,
description : 'Create a file' ,
2022-07-10 13:50:51 -07:00
action : 'Create a file' ,
2019-09-03 14:06:03 -07:00
} ,
{
name : 'Delete' ,
value : 'delete' ,
description : 'Delete a file' ,
2022-07-10 13:50:51 -07:00
action : 'Delete a file' ,
2019-09-03 14:06:03 -07:00
} ,
{
name : 'Download' ,
value : 'download' ,
description : 'Download a file' ,
2022-07-10 13:50:51 -07:00
action : 'Download a file' ,
2019-09-03 14:06:03 -07:00
} ,
{
name : 'Get' ,
value : 'get' ,
description : 'Get data of a file' ,
2022-07-10 13:50:51 -07:00
action : 'Get a file' ,
2019-09-03 14:06:03 -07:00
} ,
2023-08-09 02:54:20 -07:00
{
name : 'Update' ,
value : 'update' ,
description : 'Update file details' ,
action : 'update details of a file' ,
} ,
2019-09-03 14:06:03 -07:00
// {
// name: 'Get All',
// value: 'getAll',
// description: 'Get data of all file',
// },
// {
// name: 'Update',
// value: 'update',
// description: 'Update a file',
// },
] ,
default : 'create' ,
} ,
2021-07-20 06:53:10 -07:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2021-07-20 06:53:10 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'lead' ] ,
2021-07-20 06:53:10 -07:00
} ,
} ,
options : [
{
name : 'Create' ,
value : 'create' ,
description : 'Create a lead' ,
2022-07-10 13:50:51 -07:00
action : 'Create a lead' ,
2021-07-20 06:53:10 -07:00
} ,
{
name : 'Delete' ,
value : 'delete' ,
description : 'Delete a lead' ,
2022-07-10 13:50:51 -07:00
action : 'Delete a lead' ,
2021-07-20 06:53:10 -07:00
} ,
{
name : 'Get' ,
value : 'get' ,
description : 'Get data of a lead' ,
2022-07-10 13:50:51 -07:00
action : 'Get a lead' ,
2021-07-20 06:53:10 -07:00
} ,
{
2022-09-07 07:51:14 -07:00
name : 'Get Many' ,
2021-07-20 06:53:10 -07:00
value : 'getAll' ,
2022-09-13 03:36:36 -07:00
description : 'Get data of many leads' ,
2022-09-08 08:10:13 -07:00
action : 'Get many leads' ,
2021-07-20 06:53:10 -07:00
} ,
{
name : 'Update' ,
value : 'update' ,
description : 'Update a lead' ,
2022-07-10 13:50:51 -07:00
action : 'Update a lead' ,
2021-07-20 06:53:10 -07:00
} ,
] ,
default : 'create' ,
} ,
2019-09-02 13:26:42 -07:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2019-09-02 13:26:42 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'note' ] ,
2019-09-02 13:26:42 -07:00
} ,
} ,
options : [
{
name : 'Create' ,
value : 'create' ,
description : 'Create a note' ,
2022-07-10 13:50:51 -07:00
action : 'Create a note' ,
2019-09-02 13:26:42 -07:00
} ,
{
name : 'Delete' ,
value : 'delete' ,
description : 'Delete a note' ,
2022-07-10 13:50:51 -07:00
action : 'Delete a note' ,
2019-09-02 13:26:42 -07:00
} ,
{
name : 'Get' ,
value : 'get' ,
description : 'Get data of a note' ,
2022-07-10 13:50:51 -07:00
action : 'Get a note' ,
2019-09-02 13:26:42 -07:00
} ,
{
2022-09-07 07:51:14 -07:00
name : 'Get Many' ,
2019-09-02 13:26:42 -07:00
value : 'getAll' ,
2022-09-13 03:36:36 -07:00
description : 'Get data of many notes' ,
2022-09-08 08:10:13 -07:00
action : 'Get many notes' ,
2019-09-02 13:26:42 -07:00
} ,
{
name : 'Update' ,
value : 'update' ,
description : 'Update a note' ,
2022-07-10 13:50:51 -07:00
action : 'Update a note' ,
2019-09-02 13:26:42 -07:00
} ,
] ,
default : 'create' ,
} ,
2019-07-14 08:57:08 -07:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2019-07-14 08:57:08 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'organization' ] ,
2019-06-23 12:21:44 -07:00
} ,
2019-07-14 08:57:08 -07:00
} ,
options : [
2019-06-23 12:21:44 -07:00
{
2019-07-14 08:57:08 -07:00
name : 'Create' ,
value : 'create' ,
description : 'Create an organization' ,
2022-07-10 13:50:51 -07:00
action : 'Create an organization' ,
2019-07-14 08:57:08 -07:00
} ,
{
name : 'Delete' ,
value : 'delete' ,
2020-07-24 03:56:41 -07:00
description : 'Delete an organization' ,
2022-07-10 13:50:51 -07:00
action : 'Delete an organization' ,
2019-07-14 08:57:08 -07:00
} ,
{
name : 'Get' ,
value : 'get' ,
description : 'Get data of an organization' ,
2022-07-10 13:50:51 -07:00
action : 'Get an organization' ,
2019-06-23 12:21:44 -07:00
} ,
2019-07-09 23:40:59 -07:00
{
2022-09-07 07:51:14 -07:00
name : 'Get Many' ,
2019-07-14 08:57:08 -07:00
value : 'getAll' ,
2022-09-13 03:36:36 -07:00
description : 'Get data of many organizations' ,
2022-09-08 08:10:13 -07:00
action : 'Get many organizations' ,
2019-07-09 23:40:59 -07:00
} ,
2021-07-24 01:34:29 -07:00
{
name : 'Search' ,
value : 'search' ,
description : 'Search organizations' ,
2022-07-10 13:50:51 -07:00
action : 'Search an organization' ,
2021-07-24 01:34:29 -07:00
} ,
2022-06-03 10:23:49 -07:00
{
name : 'Update' ,
value : 'update' ,
description : 'Update an organization' ,
2022-07-10 13:50:51 -07:00
action : 'Update an organization' ,
2022-06-03 10:23:49 -07:00
} ,
2019-07-14 08:57:08 -07:00
] ,
default : 'create' ,
} ,
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2019-07-14 08:57:08 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'person' ] ,
2019-07-14 08:57:08 -07:00
} ,
} ,
options : [
2019-07-09 23:40:59 -07:00
{
2019-07-14 08:57:08 -07:00
name : 'Create' ,
value : 'create' ,
description : 'Create a person' ,
2022-07-10 13:50:51 -07:00
action : 'Create a person' ,
2019-07-09 23:40:59 -07:00
} ,
{
2019-07-14 08:57:08 -07:00
name : 'Delete' ,
value : 'delete' ,
description : 'Delete a person' ,
2022-07-10 13:50:51 -07:00
action : 'Delete a person' ,
2019-07-09 23:40:59 -07:00
} ,
2019-06-23 12:21:44 -07:00
{
2019-07-14 08:57:08 -07:00
name : 'Get' ,
value : 'get' ,
description : 'Get data of a person' ,
2022-07-10 13:50:51 -07:00
action : 'Get a person' ,
2019-06-23 12:21:44 -07:00
} ,
{
2022-09-07 07:51:14 -07:00
name : 'Get Many' ,
2019-07-14 08:57:08 -07:00
value : 'getAll' ,
2022-09-13 03:36:36 -07:00
description : 'Get data of many persons' ,
2022-09-08 08:10:13 -07:00
action : 'Get many people' ,
2019-06-23 12:21:44 -07:00
} ,
2020-07-23 13:51:05 -07:00
{
name : 'Search' ,
value : 'search' ,
description : 'Search all persons' ,
2022-07-10 13:50:51 -07:00
action : 'Search a person' ,
2020-07-23 13:51:05 -07:00
} ,
2019-06-23 12:21:44 -07:00
{
2019-07-14 08:57:08 -07:00
name : 'Update' ,
value : 'update' ,
2019-06-23 12:21:44 -07:00
description : 'Update a person' ,
2022-07-10 13:50:51 -07:00
action : 'Update a person' ,
2019-06-23 12:21:44 -07:00
} ,
] ,
2019-07-14 08:57:08 -07:00
default : 'create' ,
} ,
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2019-07-14 08:57:08 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'product' ] ,
2019-07-14 08:57:08 -07:00
} ,
} ,
options : [
{
2022-09-07 07:51:14 -07:00
name : 'Get Many' ,
2019-07-14 08:57:08 -07:00
value : 'getAll' ,
2022-09-13 03:36:36 -07:00
description : 'Get data of many products' ,
2022-09-08 08:10:13 -07:00
action : 'Get many products' ,
2019-07-14 08:57:08 -07:00
} ,
] ,
default : 'getAll' ,
2019-06-23 12:21:44 -07:00
} ,
// ----------------------------------
2019-07-14 08:57:08 -07:00
// Activity
// ----------------------------------
// ----------------------------------
// activity:create
2019-06-23 12:21:44 -07:00
// ----------------------------------
{
displayName : 'Subject' ,
name : 'subject' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'create' ] ,
resource : [ 'activity' ] ,
2019-06-23 12:21:44 -07:00
} ,
} ,
description : 'The subject of the activity to create' ,
} ,
{
displayName : 'Done' ,
name : 'done' ,
type : 'options' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'create' ] ,
resource : [ 'activity' ] ,
2019-06-23 12:21:44 -07:00
} ,
} ,
options : [
{
2022-06-03 10:23:49 -07:00
name : 'Not Done' ,
2019-06-23 12:21:44 -07:00
value : '0' ,
} ,
{
name : 'Done' ,
value : '1' ,
} ,
] ,
default : '0' ,
2022-05-06 14:01:25 -07:00
description : 'Whether the activity is done or not' ,
2019-06-23 12:21:44 -07:00
} ,
{
displayName : 'Type' ,
name : 'type' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'create' ] ,
resource : [ 'activity' ] ,
2019-06-23 12:21:44 -07:00
} ,
} ,
placeholder : 'call' ,
2022-05-06 14:01:25 -07:00
description : 'Type of the activity like "call", "meeting", etc' ,
2019-06-23 12:21:44 -07:00
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'create' ] ,
resource : [ 'activity' ] ,
2019-06-23 12:21:44 -07:00
} ,
} ,
default : { } ,
options : [
{
displayName : 'Deal ID' ,
name : 'deal_id' ,
type : 'number' ,
default : 0 ,
description : 'ID of the deal this activity will be associated with' ,
} ,
2021-06-06 11:54:49 -07:00
{
displayName : 'Due Date' ,
name : 'due_date' ,
type : 'dateTime' ,
default : '' ,
description : 'Due Date to activity be done YYYY-MM-DD' ,
} ,
2019-06-23 12:21:44 -07:00
{
displayName : 'Note' ,
name : 'note' ,
type : 'string' ,
typeOptions : {
rows : 5 ,
} ,
default : '' ,
description : 'Note of the activity (HTML format)' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Organization Name or ID' ,
2019-06-23 12:21:44 -07:00
name : 'org_id' ,
2021-06-06 11:54:49 -07:00
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getOrganizationIds' ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'ID of the organization this activity will be associated with. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2019-06-23 12:21:44 -07:00
} ,
{
displayName : 'Person ID' ,
name : 'person_id' ,
type : 'number' ,
default : 0 ,
description : 'ID of the person this activity will be associated with' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'User Name or ID' ,
2019-06-23 12:21:44 -07:00
name : 'user_id' ,
2021-06-06 11:54:49 -07:00
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getUserIds' ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'ID of the active user whom the activity will be assigned to. If omitted, the activity will be assigned to the authorized user. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2019-06-23 12:21:44 -07:00
} ,
2019-07-10 01:16:48 -07:00
{
displayName : 'Custom Properties' ,
name : 'customProperties' ,
placeholder : 'Add Custom Property' ,
2022-05-06 14:01:25 -07:00
description : 'Adds a custom property to set also values which have not been predefined' ,
2019-07-10 01:16:48 -07:00
type : 'fixedCollection' ,
typeOptions : {
multipleValues : true ,
} ,
default : { } ,
options : [
{
name : 'property' ,
displayName : 'Property' ,
values : [
{
displayName : 'Property Name' ,
name : 'name' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Name of the property to set' ,
2019-07-10 01:16:48 -07:00
} ,
{
displayName : 'Property Value' ,
name : 'value' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Value of the property to set' ,
2019-07-10 01:16:48 -07:00
} ,
2020-10-22 06:46:03 -07:00
] ,
2019-07-10 01:16:48 -07:00
} ,
] ,
} ,
2019-06-23 12:21:44 -07:00
] ,
} ,
2019-07-14 08:57:08 -07:00
// ----------------------------------
// activity:delete
// ----------------------------------
{
displayName : 'Activity ID' ,
name : 'activityId' ,
type : 'number' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'delete' ] ,
resource : [ 'activity' ] ,
2019-07-14 08:57:08 -07:00
} ,
} ,
default : 0 ,
required : true ,
2022-05-06 14:01:25 -07:00
description : 'ID of the activity to delete' ,
2019-07-14 08:57:08 -07:00
} ,
2019-06-23 12:21:44 -07:00
// ----------------------------------
2019-07-14 08:57:08 -07:00
// activity:get
2019-06-23 12:21:44 -07:00
// ----------------------------------
{
2019-07-14 08:57:08 -07:00
displayName : 'Activity ID' ,
name : 'activityId' ,
type : 'number' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'get' ] ,
resource : [ 'activity' ] ,
2019-07-14 08:57:08 -07:00
} ,
} ,
default : 0 ,
2019-06-23 12:21:44 -07:00
required : true ,
2022-05-06 14:01:25 -07:00
description : 'ID of the activity to get' ,
2019-07-14 08:57:08 -07:00
} ,
// ----------------------------------
// activity:update
// ----------------------------------
{
displayName : 'Activity ID' ,
name : 'activityId' ,
type : 'number' ,
2019-06-23 12:21:44 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'update' ] ,
resource : [ 'activity' ] ,
2019-06-23 12:21:44 -07:00
} ,
} ,
2019-07-14 08:57:08 -07:00
default : 0 ,
required : true ,
2022-05-06 14:01:25 -07:00
description : 'ID of the activity to update' ,
2019-06-23 12:21:44 -07:00
} ,
{
2019-07-14 08:57:08 -07:00
displayName : 'Update Fields' ,
name : 'updateFields' ,
2019-06-23 12:21:44 -07:00
type : 'collection' ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'update' ] ,
resource : [ 'activity' ] ,
2019-06-23 12:21:44 -07:00
} ,
} ,
default : { } ,
options : [
{
2019-07-14 08:57:08 -07:00
displayName : 'Deal ID' ,
name : 'deal_id' ,
type : 'number' ,
default : 0 ,
description : 'ID of the deal this activity will be associated with' ,
2019-06-23 12:21:44 -07:00
} ,
2021-06-06 11:54:49 -07:00
{
displayName : 'Due Date' ,
name : 'due_date' ,
type : 'dateTime' ,
default : '' ,
description : 'Due Date to activity be done YYYY-MM-DD' ,
} ,
2019-06-23 12:21:44 -07:00
{
2019-07-14 08:57:08 -07:00
displayName : 'Done' ,
name : 'done' ,
type : 'options' ,
options : [
{
2022-06-03 10:23:49 -07:00
name : 'Not Done' ,
2019-07-14 08:57:08 -07:00
value : '0' ,
} ,
{
name : 'Done' ,
value : '1' ,
} ,
] ,
default : '0' ,
2022-05-06 14:01:25 -07:00
description : 'Whether the activity is done or not' ,
2019-07-14 08:57:08 -07:00
} ,
{
displayName : 'Note' ,
name : 'note' ,
2019-06-23 12:21:44 -07:00
type : 'string' ,
2019-07-14 08:57:08 -07:00
typeOptions : {
rows : 5 ,
} ,
2019-06-23 12:21:44 -07:00
default : '' ,
2019-07-14 08:57:08 -07:00
description : 'Note of the activity (HTML format)' ,
2019-06-23 12:21:44 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Organization Name or ID' ,
2019-06-23 12:21:44 -07:00
name : 'org_id' ,
2021-06-06 11:54:49 -07:00
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getOrganizationIds' ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'ID of the organization this activity will be associated with. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2019-06-23 12:21:44 -07:00
} ,
{
displayName : 'Person ID' ,
name : 'person_id' ,
type : 'number' ,
default : 0 ,
2019-07-14 08:57:08 -07:00
description : 'ID of the person this activity will be associated with' ,
2019-06-23 12:21:44 -07:00
} ,
{
2019-07-14 08:57:08 -07:00
displayName : 'Subject' ,
name : 'subject' ,
type : 'string' ,
default : '' ,
description : 'The subject of the activity' ,
2019-06-23 12:21:44 -07:00
} ,
{
2019-07-14 08:57:08 -07:00
displayName : 'Type' ,
name : 'type' ,
type : 'string' ,
default : '' ,
placeholder : 'call' ,
2022-05-06 14:01:25 -07:00
description : 'Type of the activity like "call", "meeting", etc' ,
2019-06-23 12:21:44 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'User Name or ID' ,
2019-06-23 12:21:44 -07:00
name : 'user_id' ,
2021-06-06 11:54:49 -07:00
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getUserIds' ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'ID of the active user whom the activity will be assigned to. If omitted, the activity will be assigned to the authorized user. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2019-06-23 12:21:44 -07:00
} ,
2019-07-10 01:16:48 -07:00
{
displayName : 'Custom Properties' ,
name : 'customProperties' ,
placeholder : 'Add Custom Property' ,
2022-05-06 14:01:25 -07:00
description : 'Adds a custom property to set also values which have not been predefined' ,
2019-07-10 01:16:48 -07:00
type : 'fixedCollection' ,
typeOptions : {
multipleValues : true ,
} ,
default : { } ,
options : [
{
name : 'property' ,
displayName : 'Property' ,
values : [
{
displayName : 'Property Name' ,
name : 'name' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Name of the property to set' ,
2019-07-10 01:16:48 -07:00
} ,
{
displayName : 'Property Value' ,
name : 'value' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Value of the property to set' ,
2019-07-10 01:16:48 -07:00
} ,
2020-10-22 06:46:03 -07:00
] ,
2019-07-10 01:16:48 -07:00
} ,
] ,
} ,
] ,
} ,
// ----------------------------------
2019-07-14 08:57:08 -07:00
// deal
2019-07-10 01:16:48 -07:00
// ----------------------------------
2019-06-23 12:21:44 -07:00
// ----------------------------------
2019-07-14 08:57:08 -07:00
// deal:create
2019-06-23 12:21:44 -07:00
// ----------------------------------
{
2019-07-14 08:57:08 -07:00
displayName : 'Title' ,
name : 'title' ,
2019-06-23 12:21:44 -07:00
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'create' ] ,
resource : [ 'deal' ] ,
2019-06-23 12:21:44 -07:00
} ,
} ,
2019-07-14 08:57:08 -07:00
description : 'The title of the deal to create' ,
2019-06-23 12:21:44 -07:00
} ,
2021-07-20 06:53:10 -07:00
{
displayName : 'Associate With' ,
name : 'associateWith' ,
type : 'options' ,
options : [
{
name : 'Organization' ,
value : 'organization' ,
} ,
{
name : 'Person' ,
value : 'person' ,
} ,
] ,
default : 'organization' ,
description : 'Type of entity to link to this deal' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'deal' ] ,
operation : [ 'create' ] ,
2021-07-20 06:53:10 -07:00
} ,
} ,
} ,
{
displayName : 'Organization ID' ,
name : 'org_id' ,
type : 'number' ,
default : 0 ,
description : 'ID of the organization this deal will be associated with' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'create' ] ,
resource : [ 'deal' ] ,
associateWith : [ 'organization' ] ,
2021-07-20 06:53:10 -07:00
} ,
} ,
} ,
{
displayName : 'Person ID' ,
name : 'person_id' ,
type : 'number' ,
default : 0 ,
2022-05-06 14:01:25 -07:00
description : 'ID of the person this deal will be associated with' ,
2021-07-20 06:53:10 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'create' ] ,
resource : [ 'deal' ] ,
associateWith : [ 'person' ] ,
2021-07-20 06:53:10 -07:00
} ,
} ,
} ,
2019-06-23 12:21:44 -07:00
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'create' ] ,
resource : [ 'deal' ] ,
2019-06-23 12:21:44 -07:00
} ,
} ,
default : { } ,
options : [
{
2019-07-14 08:57:08 -07:00
displayName : 'Currency' ,
name : 'currency' ,
type : 'string' ,
default : 'USD' ,
2022-08-17 08:50:24 -07:00
description :
'Currency of the deal. Accepts a 3-character currency code. Like EUR, USD, ...' ,
2019-07-14 08:57:08 -07:00
} ,
2020-12-07 14:44:10 -08:00
{
displayName : 'Custom Properties' ,
name : 'customProperties' ,
placeholder : 'Add Custom Property' ,
2022-05-06 14:01:25 -07:00
description : 'Adds a custom property to set also values which have not been predefined' ,
2020-12-07 14:44:10 -08:00
type : 'fixedCollection' ,
typeOptions : {
multipleValues : true ,
} ,
default : { } ,
options : [
{
name : 'property' ,
displayName : 'Property' ,
values : [
{
2022-06-03 10:23:49 -07:00
displayName : 'Property Name or ID' ,
2020-12-07 14:44:10 -08:00
name : 'name' ,
2021-06-06 11:54:49 -07:00
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getDealCustomFields' ,
} ,
2020-12-07 14:44:10 -08:00
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'Name of the property to set. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2020-12-07 14:44:10 -08:00
} ,
{
displayName : 'Property Value' ,
name : 'value' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Value of the property to set' ,
2020-12-07 14:44:10 -08:00
} ,
] ,
} ,
] ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Label Name or ID' ,
2020-12-07 14:44:10 -08:00
name : 'label' ,
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-12-07 14:44:10 -08:00
typeOptions : {
loadOptionsMethod : 'getDealLabels' ,
} ,
default : '' ,
} ,
2019-07-14 08:57:08 -07:00
{
displayName : 'Lost Reason' ,
name : 'lost_reason' ,
2019-06-23 12:21:44 -07:00
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Reason why the deal was lost' ,
2019-06-23 12:21:44 -07:00
} ,
{
displayName : 'Organization ID' ,
name : 'org_id' ,
2021-07-20 06:53:10 -07:00
type : 'number' ,
default : 0 ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
'/associateWith' : [ 'person' ] ,
2021-07-20 06:53:10 -07:00
} ,
2021-06-06 11:54:49 -07:00
} ,
2021-07-20 06:53:10 -07:00
description : 'ID of the organization this deal will be associated with' ,
2019-06-23 12:21:44 -07:00
} ,
{
2019-07-14 08:57:08 -07:00
displayName : 'Person ID' ,
name : 'person_id' ,
type : 'number' ,
default : 0 ,
2021-07-20 06:53:10 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
'/associateWith' : [ 'organization' ] ,
2021-07-20 06:53:10 -07:00
} ,
} ,
2022-05-06 14:01:25 -07:00
description : 'ID of the person this deal will be associated with' ,
2019-07-14 08:57:08 -07:00
} ,
{
displayName : 'Probability' ,
name : 'probability' ,
type : 'number' ,
2019-06-23 12:21:44 -07:00
typeOptions : {
2019-07-14 08:57:08 -07:00
minValue : 0 ,
maxValue : 100 ,
2019-06-23 12:21:44 -07:00
} ,
2019-07-14 08:57:08 -07:00
default : 0 ,
2022-05-06 14:01:25 -07:00
description : 'Deal success probability percentage' ,
2019-07-14 08:57:08 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Stage Name or ID' ,
2019-07-14 08:57:08 -07:00
name : 'stage_id' ,
2021-06-06 11:54:49 -07:00
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getStageIds' ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'ID of the stage this deal will be placed in a pipeline. If omitted, the deal will be placed in the first stage of the default pipeline. (PIPELINE > STAGE). Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2019-07-14 08:57:08 -07:00
} ,
{
displayName : 'Status' ,
name : 'status' ,
type : 'options' ,
options : [
{
name : 'Open' ,
value : 'open' ,
} ,
{
name : 'Won' ,
value : 'won' ,
} ,
{
name : 'Lost' ,
value : 'lost' ,
} ,
{
name : 'Deleted' ,
value : 'deleted' ,
} ,
] ,
default : 'open' ,
2022-08-17 08:50:24 -07:00
description :
'The status of the deal. If not provided it will automatically be set to "open".' ,
2019-07-14 08:57:08 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'User Name or ID' ,
2019-07-14 08:57:08 -07:00
name : 'user_id' ,
2021-06-06 11:54:49 -07:00
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getUserIds' ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'ID of the active user whom the activity will be assigned to. If omitted, the activity will be assigned to the authorized user. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2019-07-14 08:57:08 -07:00
} ,
{
displayName : 'Value' ,
name : 'value' ,
type : 'number' ,
default : 0 ,
description : 'Value of the deal. If not set it will automatically be set to 0.' ,
2019-06-23 12:21:44 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Visible To' ,
2019-06-23 12:21:44 -07:00
name : 'visible_to' ,
type : 'options' ,
options : [
{
2022-06-03 10:23:49 -07:00
name : 'Owner & Followers (Private)' ,
2019-06-23 12:21:44 -07:00
value : '1' ,
} ,
{
2022-06-03 10:23:49 -07:00
name : 'Entire Company (Shared)' ,
2019-06-23 12:21:44 -07:00
value : '3' ,
} ,
] ,
default : '3' ,
2022-08-17 08:50:24 -07:00
description :
'Visibility of the deal. If omitted, visibility will be set to the default visibility setting of this item type for the authorized user.' ,
2019-07-10 01:16:48 -07:00
} ,
2019-06-23 12:21:44 -07:00
] ,
} ,
// ----------------------------------
2019-07-14 08:57:08 -07:00
// deal:delete
2019-06-23 12:21:44 -07:00
// ----------------------------------
{
displayName : 'Deal ID' ,
name : 'dealId' ,
type : 'number' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'delete' ] ,
resource : [ 'deal' ] ,
2019-06-23 12:21:44 -07:00
} ,
} ,
default : 0 ,
required : true ,
2022-05-06 14:01:25 -07:00
description : 'ID of the deal to delete' ,
2019-06-23 12:21:44 -07:00
} ,
2019-11-02 13:41:13 -07:00
// ----------------------------------
// deal:duplicate
// ----------------------------------
{
displayName : 'Deal ID' ,
name : 'dealId' ,
type : 'number' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'duplicate' ] ,
resource : [ 'deal' ] ,
2019-11-02 13:41:13 -07:00
} ,
} ,
default : 0 ,
required : true ,
2022-05-06 14:01:25 -07:00
description : 'ID of the deal to duplicate' ,
2019-11-02 13:41:13 -07:00
} ,
2019-07-10 01:16:48 -07:00
// ----------------------------------
2019-07-14 08:57:08 -07:00
// deal:get
2019-07-10 01:16:48 -07:00
// ----------------------------------
{
2019-07-14 08:57:08 -07:00
displayName : 'Deal ID' ,
name : 'dealId' ,
2019-07-10 01:16:48 -07:00
type : 'number' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'get' ] ,
resource : [ 'deal' ] ,
2019-07-10 01:16:48 -07:00
} ,
} ,
default : 0 ,
required : true ,
2022-05-06 14:01:25 -07:00
description : 'ID of the deal to get' ,
2019-07-10 01:16:48 -07:00
} ,
2019-06-23 12:21:44 -07:00
// ----------------------------------
2019-07-14 08:57:08 -07:00
// deal:update
2019-06-23 12:21:44 -07:00
// ----------------------------------
{
2019-07-14 08:57:08 -07:00
displayName : 'Deal ID' ,
name : 'dealId' ,
2019-06-23 12:21:44 -07:00
type : 'number' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'update' ] ,
resource : [ 'deal' ] ,
2019-06-23 12:21:44 -07:00
} ,
} ,
default : 0 ,
required : true ,
2022-05-06 14:01:25 -07:00
description : 'ID of the deal to update' ,
2019-06-23 12:21:44 -07:00
} ,
2019-07-09 23:40:59 -07:00
{
2019-07-14 08:57:08 -07:00
displayName : 'Update Fields' ,
name : 'updateFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
2019-07-09 23:40:59 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'update' ] ,
resource : [ 'deal' ] ,
2019-07-09 23:40:59 -07:00
} ,
} ,
2019-07-14 08:57:08 -07:00
default : { } ,
options : [
{
displayName : 'Currency' ,
name : 'currency' ,
type : 'string' ,
default : 'USD' ,
2022-08-17 08:50:24 -07:00
description :
'Currency of the deal. Accepts a 3-character currency code. Like EUR, USD, ...' ,
2019-07-09 23:40:59 -07:00
} ,
2020-12-07 14:44:10 -08:00
{
displayName : 'Custom Properties' ,
name : 'customProperties' ,
placeholder : 'Add Custom Property' ,
2022-05-06 14:01:25 -07:00
description : 'Adds a custom property to set also values which have not been predefined' ,
2020-12-07 14:44:10 -08:00
type : 'fixedCollection' ,
typeOptions : {
multipleValues : true ,
} ,
default : { } ,
options : [
{
name : 'property' ,
displayName : 'Property' ,
values : [
{
2022-06-03 10:23:49 -07:00
displayName : 'Property Name or ID' ,
2020-12-07 14:44:10 -08:00
name : 'name' ,
2021-06-06 11:54:49 -07:00
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getDealCustomFields' ,
} ,
2020-12-07 14:44:10 -08:00
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'Name of the custom field to set. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2020-12-07 14:44:10 -08:00
} ,
{
displayName : 'Property Value' ,
name : 'value' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Value of the property to set' ,
2020-12-07 14:44:10 -08:00
} ,
] ,
} ,
] ,
} ,
2021-06-06 11:54:49 -07:00
{
2022-06-03 10:23:49 -07:00
displayName : 'User Name or ID' ,
2021-06-06 11:54:49 -07:00
name : 'user_id' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getUserIds' ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'ID of the active user whom the activity will be assigned to. If omitted, the activity will be assigned to the authorized user. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-06-06 11:54:49 -07:00
} ,
2020-12-07 14:44:10 -08:00
{
2022-06-03 10:23:49 -07:00
displayName : 'Label Name or ID' ,
2020-12-07 14:44:10 -08:00
name : 'label' ,
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-12-07 14:44:10 -08:00
typeOptions : {
loadOptionsMethod : 'getDealLabels' ,
} ,
default : '' ,
} ,
2019-07-14 08:57:08 -07:00
{
displayName : 'Lost Reason' ,
name : 'lost_reason' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Reason why the deal was lost' ,
2019-06-23 12:21:44 -07:00
} ,
2019-07-14 08:57:08 -07:00
{
2022-06-03 10:23:49 -07:00
displayName : 'Organization Name or ID' ,
2019-07-14 08:57:08 -07:00
name : 'org_id' ,
2021-06-06 11:54:49 -07:00
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getOrganizationIds' ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'ID of the organization this deal will be associated with. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2019-06-23 12:21:44 -07:00
} ,
2019-07-14 08:57:08 -07:00
{
displayName : 'Person ID' ,
name : 'person_id' ,
type : 'number' ,
default : 0 ,
2022-05-06 14:01:25 -07:00
description : 'ID of the person this deal will be associated with' ,
2019-07-09 23:40:59 -07:00
} ,
2019-07-14 08:57:08 -07:00
{
displayName : 'Probability' ,
name : 'probability' ,
type : 'number' ,
typeOptions : {
minValue : 0 ,
maxValue : 100 ,
} ,
default : 0 ,
2022-05-06 14:01:25 -07:00
description : 'Deal success probability percentage' ,
2019-07-09 23:40:59 -07:00
} ,
2019-07-14 08:57:08 -07:00
{
2022-06-03 10:23:49 -07:00
displayName : 'Stage Name or ID' ,
2019-07-14 08:57:08 -07:00
name : 'stage_id' ,
2021-06-06 11:54:49 -07:00
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getStageIds' ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'ID of the stage this deal will be placed in a pipeline. If omitted, the deal will be placed in the first stage of the default pipeline. (PIPELINE > STAGE). Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2019-07-14 08:57:08 -07:00
} ,
{
displayName : 'Status' ,
name : 'status' ,
type : 'options' ,
options : [
{
name : 'Open' ,
value : 'open' ,
} ,
{
name : 'Won' ,
value : 'won' ,
} ,
{
name : 'Lost' ,
value : 'lost' ,
} ,
{
name : 'Deleted' ,
value : 'deleted' ,
} ,
2019-06-23 12:21:44 -07:00
] ,
2019-07-14 08:57:08 -07:00
default : 'open' ,
2022-08-17 08:50:24 -07:00
description :
'The status of the deal. If not provided it will automatically be set to "open".' ,
2019-06-23 12:21:44 -07:00
} ,
2019-07-14 08:57:08 -07:00
{
displayName : 'Title' ,
name : 'title' ,
type : 'string' ,
default : '' ,
description : 'The title of the deal' ,
} ,
{
displayName : 'Value' ,
name : 'value' ,
type : 'number' ,
default : 0 ,
description : 'Value of the deal. If not set it will automatically be set to 0.' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Visible To' ,
2019-07-14 08:57:08 -07:00
name : 'visible_to' ,
type : 'options' ,
options : [
{
2022-06-03 10:23:49 -07:00
name : 'Owner & Followers (Private)' ,
2019-07-14 08:57:08 -07:00
value : '1' ,
} ,
{
2022-06-03 10:23:49 -07:00
name : 'Entire Company (Shared)' ,
2019-07-14 08:57:08 -07:00
value : '3' ,
} ,
2019-06-23 12:21:44 -07:00
] ,
2019-07-14 08:57:08 -07:00
default : '3' ,
2022-08-17 08:50:24 -07:00
description :
'Visibility of the deal. If omitted, visibility will be set to the default visibility setting of this item type for the authorized user.' ,
2019-06-23 12:21:44 -07:00
} ,
2019-07-14 08:57:08 -07:00
] ,
2019-07-09 23:40:59 -07:00
} ,
2021-08-01 12:19:41 -07:00
// ----------------------------------
// dealProduct:add
// ----------------------------------
{
2022-06-03 10:23:49 -07:00
displayName : 'Deal Name or ID' ,
2021-08-01 12:19:41 -07:00
name : 'dealId' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getDeals' ,
} ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'add' ] ,
resource : [ 'dealProduct' ] ,
2021-08-01 12:19:41 -07:00
} ,
} ,
2022-08-17 08:50:24 -07:00
description :
'The ID of the deal to add a product to. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-08-01 12:19:41 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Product Name or ID' ,
2021-08-01 12:19:41 -07:00
name : 'productId' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getProducts' ,
} ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'add' ] ,
resource : [ 'dealProduct' ] ,
2021-08-01 12:19:41 -07:00
} ,
} ,
2022-08-17 08:50:24 -07:00
description :
'The ID of the product to add to a deal. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-08-01 12:19:41 -07:00
} ,
{
displayName : 'Item Price' ,
name : 'item_price' ,
type : 'number' ,
typeOptions : {
numberPrecision : 2 ,
} ,
2022-08-17 08:50:24 -07:00
default : 0.0 ,
2021-08-01 12:19:41 -07:00
required : true ,
description : 'Price at which to add or update this product in a deal' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'add' ] ,
resource : [ 'dealProduct' ] ,
2021-08-01 12:19:41 -07:00
} ,
} ,
} ,
{
displayName : 'Quantity' ,
name : 'quantity' ,
type : 'number' ,
default : 1 ,
typeOptions : {
minValue : 1 ,
} ,
required : true ,
description : 'How many items of this product to add/update in a deal' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'add' ] ,
resource : [ 'dealProduct' ] ,
2021-08-01 12:19:41 -07:00
} ,
} ,
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'add' ] ,
resource : [ 'dealProduct' ] ,
2021-08-01 12:19:41 -07:00
} ,
} ,
default : { } ,
options : [
{
displayName : 'Comments' ,
name : 'comments' ,
type : 'string' ,
typeOptions : {
rows : 4 ,
} ,
default : '' ,
description : 'Text to describe this product-deal attachment' ,
} ,
{
displayName : 'Discount Percentage' ,
name : 'discount_percentage' ,
type : 'number' ,
default : 0 ,
typeOptions : {
minValue : 0 ,
maxValue : 100 ,
} ,
description : 'Percentage of discount to apply' ,
} ,
{
displayName : 'Product Variation ID' ,
name : 'product_variation_id' ,
type : 'string' ,
default : '' ,
description : 'ID of the product variation to use' ,
} ,
] ,
} ,
// ----------------------------------
// dealProduct:update
// ----------------------------------
{
2022-06-03 10:23:49 -07:00
displayName : 'Deal Name or ID' ,
2021-08-01 12:19:41 -07:00
name : 'dealId' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getDeals' ,
} ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'update' ] ,
resource : [ 'dealProduct' ] ,
2021-08-01 12:19:41 -07:00
} ,
} ,
2022-08-17 08:50:24 -07:00
description :
'The ID of the deal whose product to update. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-08-01 12:19:41 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Product Attachment Name or ID' ,
2021-08-01 12:19:41 -07:00
name : 'productAttachmentId' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getProductsDeal' ,
2022-08-17 08:50:24 -07:00
loadOptionsDependsOn : [ 'dealId' ] ,
2021-08-01 12:19:41 -07:00
} ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'update' ] ,
resource : [ 'dealProduct' ] ,
2021-08-01 12:19:41 -07:00
} ,
} ,
2022-08-17 08:50:24 -07:00
description :
'ID of the deal-product (the ID of the product attached to the deal). Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-08-01 12:19:41 -07:00
} ,
{
displayName : 'Update Fields' ,
name : 'updateFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'update' ] ,
resource : [ 'dealProduct' ] ,
2021-08-01 12:19:41 -07:00
} ,
} ,
default : { } ,
options : [
{
displayName : 'Comments' ,
name : 'comments' ,
type : 'string' ,
typeOptions : {
rows : 4 ,
} ,
default : '' ,
description : 'Text to describe this product-deal attachment' ,
} ,
{
displayName : 'Discount Percentage' ,
name : 'discount_percentage' ,
type : 'number' ,
default : 0 ,
typeOptions : {
minValue : 0 ,
maxValue : 100 ,
} ,
description : 'Percentage of discount to apply' ,
} ,
{
displayName : 'Item Price' ,
name : 'item_price' ,
type : 'number' ,
typeOptions : {
numberPrecision : 2 ,
} ,
2022-08-17 08:50:24 -07:00
default : 0.0 ,
2021-08-01 12:19:41 -07:00
description : 'Price at which to add or update this product in a deal' ,
} ,
{
displayName : 'Quantity' ,
name : 'quantity' ,
type : 'number' ,
default : 1 ,
typeOptions : {
minValue : 1 ,
} ,
description : 'How many items of this product to add/update in a deal' ,
} ,
{
displayName : 'Product Variation ID' ,
name : 'product_variation_id' ,
type : 'string' ,
default : '' ,
description : 'ID of the product variation to use' ,
} ,
] ,
} ,
// ----------------------------------
// dealProduct:remove
// ----------------------------------
{
2022-06-03 10:23:49 -07:00
displayName : 'Deal Name or ID' ,
2021-08-01 12:19:41 -07:00
name : 'dealId' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getDeals' ,
} ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'remove' ] ,
resource : [ 'dealProduct' ] ,
2021-08-01 12:19:41 -07:00
} ,
} ,
2022-08-17 08:50:24 -07:00
description :
'The ID of the deal whose product to remove. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-08-01 12:19:41 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Product Attachment Name or ID' ,
2021-08-01 12:19:41 -07:00
name : 'productAttachmentId' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getProductsDeal' ,
2022-08-17 08:50:24 -07:00
loadOptionsDependsOn : [ 'dealId' ] ,
2021-08-01 12:19:41 -07:00
} ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'remove' ] ,
resource : [ 'dealProduct' ] ,
2021-08-01 12:19:41 -07:00
} ,
} ,
2022-08-17 08:50:24 -07:00
description :
'ID of the deal-product (the ID of the product attached to the deal). Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-08-01 12:19:41 -07:00
} ,
// ----------------------------------
// dealProduct:getAll
// ----------------------------------
{
2022-06-03 10:23:49 -07:00
displayName : 'Deal Name or ID' ,
2021-08-01 12:19:41 -07:00
name : 'dealId' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getDeals' ,
} ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getAll' ] ,
resource : [ 'dealProduct' ] ,
2021-08-01 12:19:41 -07:00
} ,
} ,
2022-08-17 08:50:24 -07:00
description :
'The ID of the deal whose products to retrieve. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-08-01 12:19:41 -07:00
} ,
2021-06-06 11:54:49 -07:00
// ----------------------------------
// deal:search
// ----------------------------------
{
displayName : 'Term' ,
name : 'term' ,
type : 'string' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'search' ] ,
resource : [ 'deal' ] ,
2021-06-06 11:54:49 -07:00
} ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'The search term to look for. Minimum 2 characters (or 1 if using exact_match).' ,
2021-06-06 11:54:49 -07:00
} ,
{
displayName : 'Exact Match' ,
name : 'exactMatch' ,
type : 'boolean' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'search' ] ,
resource : [ 'deal' ] ,
2021-06-06 11:54:49 -07:00
} ,
} ,
default : false ,
2022-08-17 08:50:24 -07:00
description :
'Whether only full exact matches against the given term are returned. It is not case sensitive.' ,
2021-06-06 11:54:49 -07:00
} ,
{
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'search' ] ,
2021-06-06 11:54:49 -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' ,
2021-06-06 11:54:49 -07:00
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'search' ] ,
returnAll : [ false ] ,
2021-06-06 11:54:49 -07:00
} ,
} ,
typeOptions : {
minValue : 1 ,
maxValue : 500 ,
} ,
default : 100 ,
2022-05-06 14:01:25 -07:00
description : 'Max number of results to return' ,
2021-08-13 01:22:00 -07:00
} ,
{
2021-06-06 11:54:49 -07:00
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'search' ] ,
resource : [ 'deal' ] ,
2021-06-06 11:54:49 -07:00
} ,
} ,
default : { } ,
options : [
{
displayName : 'Include Fields' ,
name : 'includeFields' ,
type : 'string' ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'Supports including optional fields in the results which are not provided by default. Example: deal.cc_email.' ,
2021-06-06 11:54:49 -07:00
} ,
{
displayName : 'Organization ID' ,
name : 'organizationId' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Will filter Deals by the provided Organization ID' ,
2021-06-06 11:54:49 -07:00
} ,
{
displayName : 'Person ID' ,
name : 'personId' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Will filter Deals by the provided Person ID' ,
2021-06-06 11:54:49 -07:00
} ,
{
displayName : 'Search Fields' ,
name : 'fields' ,
type : 'multiOptions' ,
options : [
{
name : 'Custom Fields' ,
value : 'custom_fields' ,
} ,
{
name : 'Notes' ,
value : 'notes' ,
} ,
{
name : 'Title' ,
value : 'title' ,
} ,
] ,
2022-08-17 08:50:24 -07:00
default : [ 'custom_fields' , 'notes' , 'title' ] ,
description :
'A comma-separated string array. The fields to perform the search from. Defaults to all of them.' ,
2021-06-06 11:54:49 -07:00
} ,
{
displayName : 'Status' ,
name : 'status' ,
type : 'options' ,
options : [
{
name : 'Open' ,
value : 'open' ,
} ,
{
name : 'Won' ,
value : 'won' ,
} ,
{
name : 'Lost' ,
value : 'lost' ,
} ,
] ,
default : 'open' ,
2022-08-17 08:50:24 -07:00
description :
'The status of the deal. If not provided it will automatically be set to "open".' ,
2021-06-06 11:54:49 -07:00
} ,
] ,
} ,
2019-07-09 23:40:59 -07:00
2019-09-03 14:06:03 -07:00
// ----------------------------------
// file
// ----------------------------------
// ----------------------------------
// file:create
// ----------------------------------
{
2024-01-03 03:08:16 -08:00
displayName : 'Input Binary Field' ,
2019-09-03 14:06:03 -07:00
name : 'binaryPropertyName' ,
type : 'string' ,
default : 'data' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'create' ] ,
resource : [ 'file' ] ,
2019-09-03 14:06:03 -07:00
} ,
} ,
placeholder : '' ,
2024-01-03 03:08:16 -08:00
hint : 'The name of the input binary field containing the file to be written' ,
2019-09-03 14:06:03 -07:00
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'create' ] ,
resource : [ 'file' ] ,
2019-09-03 14:06:03 -07:00
} ,
} ,
default : { } ,
options : [
{
displayName : 'Activity ID' ,
name : 'activity_id' ,
type : 'number' ,
default : 0 ,
2022-05-06 14:01:25 -07:00
description : 'ID of the activite this file will be associated with' ,
2019-09-03 14:06:03 -07:00
} ,
{
displayName : 'Deal ID' ,
name : 'deal_id' ,
type : 'number' ,
default : 0 ,
description : 'ID of the deal this file will be associated with' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Organization Name or ID' ,
2019-09-03 14:06:03 -07:00
name : 'org_id' ,
2021-06-06 11:54:49 -07:00
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getOrganizationIds' ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'ID of the organization this deal will be associated with. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2019-09-03 14:06:03 -07:00
} ,
{
displayName : 'Person ID' ,
name : 'person_id' ,
type : 'number' ,
default : 0 ,
2022-05-06 14:01:25 -07:00
description : 'ID of the person this file will be associated with' ,
2019-09-03 14:06:03 -07:00
} ,
{
displayName : 'Product ID' ,
name : 'product_id' ,
type : 'number' ,
default : 0 ,
2022-05-06 14:01:25 -07:00
description : 'ID of the person this file will be associated with' ,
2019-09-03 14:06:03 -07:00
} ,
] ,
} ,
// ----------------------------------
// file:delete
// ----------------------------------
{
displayName : 'File ID' ,
name : 'fileId' ,
type : 'number' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'delete' ] ,
resource : [ 'file' ] ,
2019-09-03 14:06:03 -07:00
} ,
} ,
default : 0 ,
required : true ,
2022-05-06 14:01:25 -07:00
description : 'ID of the file to delete' ,
2019-09-03 14:06:03 -07:00
} ,
// ----------------------------------
// file:download
// ----------------------------------
{
displayName : 'File ID' ,
name : 'fileId' ,
type : 'number' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'download' ] ,
resource : [ 'file' ] ,
2019-09-03 14:06:03 -07:00
} ,
} ,
default : 0 ,
required : true ,
2022-05-06 14:01:25 -07:00
description : 'ID of the file to download' ,
2019-09-03 14:06:03 -07:00
} ,
{
2024-01-03 03:08:16 -08:00
displayName : 'Put Output File in Field' ,
2019-09-03 14:06:03 -07:00
name : 'binaryPropertyName' ,
type : 'string' ,
required : true ,
default : 'data' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'download' ] ,
resource : [ 'file' ] ,
2019-09-03 14:06:03 -07:00
} ,
} ,
2024-01-03 03:08:16 -08:00
hint : 'The name of the output binary field to put the file in' ,
2019-09-03 14:06:03 -07:00
} ,
// ----------------------------------
// file:get
// ----------------------------------
{
displayName : 'File ID' ,
name : 'fileId' ,
type : 'number' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'get' ] ,
resource : [ 'file' ] ,
2019-09-03 14:06:03 -07:00
} ,
} ,
default : 0 ,
required : true ,
2021-07-20 06:53:10 -07:00
description : 'ID of the file to get' ,
} ,
2023-08-09 02:54:20 -07:00
// ----------------------------------
// file:update
// ----------------------------------
{
displayName : 'File ID' ,
name : 'fileId' ,
type : 'number' ,
displayOptions : {
show : {
operation : [ 'update' ] ,
resource : [ 'file' ] ,
} ,
} ,
default : 0 ,
required : true ,
description : 'ID of the file to update' ,
} ,
{
displayName : 'Update Fields' ,
name : 'updateFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
operation : [ 'update' ] ,
resource : [ 'file' ] ,
} ,
} ,
default : { } ,
options : [
{
displayName : 'Name' ,
name : 'name' ,
type : 'string' ,
default : '' ,
description : 'The updated visible name of the file' ,
} ,
{
displayName : 'Description' ,
name : 'description' ,
type : 'string' ,
default : '' ,
description : 'The updated description of the file' ,
} ,
] ,
} ,
// ----------------------------------
// lead
// ----------------------------------
2021-07-20 06:53:10 -07:00
// ----------------------------------------
// lead: create
// ----------------------------------------
{
displayName : 'Title' ,
name : 'title' ,
description : 'Name of the lead to create' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'lead' ] ,
operation : [ 'create' ] ,
2021-07-20 06:53:10 -07:00
} ,
} ,
} ,
{
displayName : 'Associate With' ,
name : 'associateWith' ,
type : 'options' ,
options : [
{
name : 'Organization' ,
value : 'organization' ,
} ,
{
name : 'Person' ,
value : 'person' ,
} ,
] ,
default : 'organization' ,
description : 'Type of entity to link to this lead' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'lead' ] ,
operation : [ 'create' ] ,
2021-07-20 06:53:10 -07:00
} ,
} ,
} ,
{
displayName : 'Organization ID' ,
name : 'organization_id' ,
type : 'number' ,
default : 0 ,
description : 'ID of the organization to link to this lead' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'lead' ] ,
operation : [ 'create' ] ,
associateWith : [ 'organization' ] ,
2021-07-20 06:53:10 -07:00
} ,
} ,
} ,
{
displayName : 'Person ID' ,
name : 'person_id' ,
type : 'number' ,
default : 0 ,
description : 'ID of the person to link to this lead' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'lead' ] ,
operation : [ 'create' ] ,
associateWith : [ 'person' ] ,
2021-07-20 06:53:10 -07:00
} ,
} ,
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'lead' ] ,
operation : [ 'create' ] ,
2021-07-20 06:53:10 -07:00
} ,
} ,
options : [
{
displayName : 'Expected Close Date' ,
name : 'expected_close_date' ,
type : 'dateTime' ,
default : '' ,
description : 'Date when the lead’ s deal is expected to be closed, in ISO-8601 format' ,
} ,
{
2022-06-20 07:54:01 -07:00
displayName : 'Label Names or IDs' ,
2021-07-20 06:53:10 -07:00
name : 'label_ids' ,
type : 'multiOptions' ,
typeOptions : {
loadOptionsMethod : 'getLeadLabels' ,
} ,
default : [ ] ,
2022-08-17 08:50:24 -07:00
description :
'ID of the labels to attach to the lead to create. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-07-20 06:53:10 -07:00
} ,
{
displayName : 'Organization ID' ,
name : 'organization_id' ,
type : 'number' ,
default : 0 ,
description : 'ID of the organization to link to this lead' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
'/associateWith' : [ 'person' ] ,
2021-07-20 06:53:10 -07:00
} ,
} ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Owner Name or ID' ,
2021-07-20 06:53:10 -07:00
name : 'owner_id' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getUserIds' ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'ID of the user who will own the lead to create. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-07-20 06:53:10 -07:00
} ,
{
displayName : 'Person ID' ,
name : 'person_id' ,
type : 'number' ,
default : 0 ,
description : 'ID of the person to link to this lead' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
'/associateWith' : [ 'organization' ] ,
2021-07-20 06:53:10 -07:00
} ,
} ,
} ,
{
displayName : 'Value' ,
name : 'value' ,
type : 'fixedCollection' ,
description : 'Potential monetary value associated with the lead' ,
default : { } ,
options : [
{
displayName : 'Value Properties' ,
name : 'valueProperties' ,
values : [
{
displayName : 'Amount' ,
name : 'amount' ,
type : 'number' ,
default : '' ,
} ,
{
displayName : 'Currency' ,
name : 'currency' ,
type : 'options' ,
default : 'USD' ,
options : currencies.sort ( ( a , b ) = > a . name . localeCompare ( b . name ) ) ,
} ,
] ,
} ,
] ,
} ,
] ,
} ,
// ----------------------------------------
// lead: delete
// ----------------------------------------
{
displayName : 'Lead ID' ,
name : 'leadId' ,
description : 'ID of the lead to delete' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'lead' ] ,
operation : [ 'delete' ] ,
2021-07-20 06:53:10 -07:00
} ,
} ,
} ,
// ----------------------------------------
// lead: get
// ----------------------------------------
{
displayName : 'Lead ID' ,
name : 'leadId' ,
description : 'ID of the lead to retrieve' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'lead' ] ,
operation : [ 'get' ] ,
2021-07-20 06:53:10 -07:00
} ,
} ,
} ,
// ----------------------------------------
// lead: update
// ----------------------------------------
{
displayName : 'Lead ID' ,
name : 'leadId' ,
description : 'ID of the lead to update' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'lead' ] ,
operation : [ 'update' ] ,
2021-07-20 06:53:10 -07:00
} ,
} ,
} ,
{
displayName : 'Update Fields' ,
name : 'updateFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'lead' ] ,
operation : [ 'update' ] ,
2021-07-20 06:53:10 -07:00
} ,
} ,
options : [
{
displayName : 'Title' ,
name : 'title' ,
type : 'string' ,
default : '' ,
description : 'Name of the lead to update' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Owner Name or ID' ,
2021-07-20 06:53:10 -07:00
name : 'owner_id' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getUserIds' ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'ID of the user who will own the lead to update. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-07-20 06:53:10 -07:00
} ,
{
2022-06-20 07:54:01 -07:00
displayName : 'Label Names or IDs' ,
2021-07-20 06:53:10 -07:00
name : 'label_ids' ,
type : 'multiOptions' ,
typeOptions : {
loadOptionsMethod : 'getLeadLabels' ,
} ,
default : [ ] ,
2022-08-17 08:50:24 -07:00
description :
'ID of the labels to attach to the lead to update. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-07-20 06:53:10 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Person Name or ID' ,
2021-07-20 06:53:10 -07:00
name : 'person_id' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getPersons' ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'ID of the person to link to this lead. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-07-20 06:53:10 -07:00
} ,
{
displayName : 'Value' ,
name : 'value' ,
type : 'fixedCollection' ,
description : 'Potential monetary value associated with the lead' ,
default : { } ,
options : [
{
displayName : 'Value Properties' ,
name : 'valueProperties' ,
values : [
{
displayName : 'Amount' ,
name : 'amount' ,
type : 'number' ,
default : '' ,
} ,
{
displayName : 'Currency' ,
name : 'currency' ,
type : 'options' ,
default : 'USD' ,
options : currencies.sort ( ( a , b ) = > a . name . localeCompare ( b . name ) ) ,
} ,
] ,
} ,
] ,
} ,
{
displayName : 'Expected Close Date' ,
name : 'expected_close_date' ,
type : 'dateTime' ,
default : '' ,
description : 'Date when the lead’ s deal is expected to be closed, in ISO-8601 format' ,
} ,
] ,
2019-09-03 14:06:03 -07:00
} ,
2019-09-02 13:26:42 -07:00
// ----------------------------------
// note
// ----------------------------------
// ----------------------------------
// note:create
// ----------------------------------
{
displayName : 'Content' ,
name : 'content' ,
typeOptions : {
rows : 5 ,
} ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'create' ] ,
resource : [ 'note' ] ,
2019-09-02 13:26:42 -07:00
} ,
} ,
description : 'The content of the note to create' ,
} ,
2021-06-06 11:54:49 -07:00
// {
// displayName: 'Additional Fields',
// name: 'additionalFields',
// type: 'collection',
// placeholder: 'Add Field',
// displayOptions: {
// show: {
// operation: [
// 'create',
// 'getAll',
// ],
// resource: [
// 'note',
// ],
// },
// },
// default: {},
// options: [
// {
// displayName: 'Deal ID',
// name: 'deal_id',
// type: 'number',
// default: 0,
// description: 'ID of the deal this note will be associated with',
// },
// {
// displayName: 'Organization ID',
// name: 'org_id',
// type: 'options',
// typeOptions: {
// loadOptionsMethod: 'getOrganizationIds',
// },
// default: '',
// description: 'ID of the organization this deal will be associated with.',
// },
// {
// displayName: 'Person ID',
// name: 'person_id',
// type: 'number',
// default: 0,
// description: 'ID of the person this note will be associated with.',
// },
// ],
// },
2019-09-02 13:26:42 -07:00
// ----------------------------------
// note:delete
// ----------------------------------
{
displayName : 'Note ID' ,
name : 'noteId' ,
type : 'number' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'delete' ] ,
resource : [ 'note' ] ,
2019-09-02 13:26:42 -07:00
} ,
} ,
default : 0 ,
required : true ,
2022-05-06 14:01:25 -07:00
description : 'ID of the note to delete' ,
2019-09-02 13:26:42 -07:00
} ,
// ----------------------------------
// note:get
// ----------------------------------
{
displayName : 'Note ID' ,
name : 'noteId' ,
type : 'number' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'get' ] ,
resource : [ 'note' ] ,
2019-09-02 13:26:42 -07:00
} ,
} ,
default : 0 ,
required : true ,
2022-05-06 14:01:25 -07:00
description : 'ID of the note to get' ,
2019-09-02 13:26:42 -07:00
} ,
// ----------------------------------
// note:update
// ----------------------------------
{
displayName : 'Note ID' ,
name : 'noteId' ,
type : 'number' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'update' ] ,
resource : [ 'note' ] ,
2019-09-02 13:26:42 -07:00
} ,
} ,
default : 0 ,
required : true ,
2022-05-06 14:01:25 -07:00
description : 'ID of the note to update' ,
2019-09-02 13:26:42 -07:00
} ,
{
displayName : 'Update Fields' ,
name : 'updateFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'update' ] ,
resource : [ 'note' ] ,
2019-09-02 13:26:42 -07:00
} ,
} ,
default : { } ,
options : [
{
displayName : 'Content' ,
name : 'content' ,
typeOptions : {
rows : 5 ,
} ,
type : 'string' ,
default : '' ,
description : 'The content of the note' ,
} ,
{
displayName : 'Deal ID' ,
name : 'deal_id' ,
type : 'number' ,
default : 0 ,
description : 'ID of the deal this note will be associated with' ,
} ,
2021-09-15 02:02:36 -07:00
{
displayName : 'Lead ID' ,
name : 'lead_id' ,
type : 'number' ,
default : 0 ,
description : 'ID of the lead this note will be associated with' ,
} ,
2019-09-02 13:26:42 -07:00
{
2022-06-03 10:23:49 -07:00
displayName : 'Organization Name or ID' ,
2019-09-02 13:26:42 -07:00
name : 'org_id' ,
2021-06-06 11:54:49 -07:00
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getOrganizationIds' ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'ID of the organization this deal will be associated with. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2019-09-02 13:26:42 -07:00
} ,
{
displayName : 'Person ID' ,
name : 'person_id' ,
type : 'number' ,
default : 0 ,
2022-05-06 14:01:25 -07:00
description : 'ID of the person this note will be associated with' ,
2019-09-02 13:26:42 -07:00
} ,
] ,
} ,
2019-06-23 12:21:44 -07:00
// ----------------------------------
2019-07-14 08:57:08 -07:00
// organization
2019-06-23 12:21:44 -07:00
// ----------------------------------
// ----------------------------------
2019-07-14 08:57:08 -07:00
// organization:create
2019-06-23 12:21:44 -07:00
// ----------------------------------
{
2019-07-14 08:57:08 -07:00
displayName : 'Name' ,
name : 'name' ,
type : 'string' ,
default : '' ,
required : true ,
2019-06-23 12:21:44 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'create' ] ,
resource : [ 'organization' ] ,
2019-06-23 12:21:44 -07:00
} ,
} ,
2019-07-14 08:57:08 -07:00
description : 'The name of the organization to create' ,
2019-06-23 12:21:44 -07:00
} ,
{
2019-07-14 08:57:08 -07:00
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
2019-06-23 12:21:44 -07:00
type : 'collection' ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'create' ] ,
resource : [ 'organization' ] ,
2019-06-23 12:21:44 -07:00
} ,
} ,
default : { } ,
options : [
2019-07-10 01:16:48 -07:00
{
displayName : 'Custom Properties' ,
name : 'customProperties' ,
placeholder : 'Add Custom Property' ,
2022-05-06 14:01:25 -07:00
description : 'Adds a custom property to set also values which have not been predefined' ,
2019-07-10 01:16:48 -07:00
type : 'fixedCollection' ,
typeOptions : {
multipleValues : true ,
} ,
default : { } ,
options : [
{
name : 'property' ,
displayName : 'Property' ,
values : [
{
displayName : 'Property Name' ,
name : 'name' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Name of the property to set' ,
2019-07-10 01:16:48 -07:00
} ,
{
displayName : 'Property Value' ,
name : 'value' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Value of the property to set' ,
2019-07-10 01:16:48 -07:00
} ,
2020-10-22 06:46:03 -07:00
] ,
2019-07-10 01:16:48 -07:00
} ,
] ,
} ,
2020-12-07 14:44:10 -08:00
{
2022-06-03 10:23:49 -07:00
displayName : 'Label Name or ID' ,
2020-12-07 14:44:10 -08:00
name : 'label' ,
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-12-07 14:44:10 -08:00
typeOptions : {
loadOptionsMethod : 'getOrganizationLabels' ,
} ,
default : '' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Visible To' ,
2020-12-07 14:44:10 -08:00
name : 'visible_to' ,
type : 'options' ,
options : [
{
2022-06-03 10:23:49 -07:00
name : 'Owner & Followers (Private)' ,
2020-12-07 14:44:10 -08:00
value : '1' ,
} ,
{
2022-06-03 10:23:49 -07:00
name : 'Entire Company (Shared)' ,
2020-12-07 14:44:10 -08:00
value : '3' ,
} ,
] ,
default : '3' ,
2022-08-17 08:50:24 -07:00
description :
'Visibility of the person. If omitted, visibility will be set to the default visibility setting of this item type for the authorized user.' ,
2020-12-07 14:44:10 -08:00
} ,
2019-07-14 08:57:08 -07:00
] ,
} ,
// ----------------------------------
// organization:delete
// ----------------------------------
{
displayName : 'Organization ID' ,
name : 'organizationId' ,
type : 'number' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'delete' ] ,
resource : [ 'organization' ] ,
2019-07-14 08:57:08 -07:00
} ,
} ,
default : 0 ,
required : true ,
2022-05-06 14:01:25 -07:00
description : 'ID of the organization to delete' ,
2019-07-14 08:57:08 -07:00
} ,
// ----------------------------------
// organization:get
// ----------------------------------
{
displayName : 'Organization ID' ,
name : 'organizationId' ,
type : 'number' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'get' ] ,
resource : [ 'organization' ] ,
2019-07-14 08:57:08 -07:00
} ,
} ,
default : 0 ,
required : true ,
2022-05-06 14:01:25 -07:00
description : 'ID of the organization to get' ,
2019-07-14 08:57:08 -07:00
} ,
2021-07-24 01:34:29 -07:00
// ----------------------------------
// organization:search
// ----------------------------------
{
displayName : 'Term' ,
name : 'term' ,
type : 'string' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'search' ] ,
resource : [ 'organization' ] ,
2021-07-24 01:34:29 -07:00
} ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'The search term to look for. Minimum 2 characters (or 1 if using exact_match).' ,
2021-07-24 01:34:29 -07:00
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'search' ] ,
resource : [ 'organization' ] ,
2021-07-24 01:34:29 -07:00
} ,
} ,
default : { } ,
options : [
{
displayName : 'Exact Match' ,
name : 'exactMatch' ,
type : 'boolean' ,
default : false ,
2022-08-17 08:50:24 -07:00
description :
'Whether only full exact matches against the given term are returned. It is not case sensitive.' ,
2021-07-24 01:34:29 -07:00
} ,
{
displayName : 'Fields' ,
name : 'fields' ,
type : 'multiOptions' ,
default : [ ] ,
description : 'Fields to the search in. Defaults to all of them.' ,
options : [
{
name : 'Address' ,
value : 'address' ,
} ,
{
name : 'Custom Fields' ,
value : 'custom_fields' ,
} ,
{
name : 'Name' ,
value : 'name' ,
} ,
{
name : 'Notes' ,
value : 'notes' ,
} ,
] ,
} ,
{
displayName : 'RAW Data' ,
name : 'rawData' ,
type : 'boolean' ,
default : false ,
2022-08-17 08:50:24 -07:00
description :
'Whether to return the data exactly in the way it got received from the API' ,
2021-07-24 01:34:29 -07:00
} ,
] ,
} ,
2019-06-23 12:21:44 -07:00
// ----------------------------------
2020-12-07 14:44:10 -08:00
// organization:update
2019-06-23 12:21:44 -07:00
// ----------------------------------
{
2020-12-07 14:44:10 -08:00
displayName : 'Organization ID' ,
name : 'organizationId' ,
type : 'number' ,
2019-07-14 08:57:08 -07:00
default : '' ,
required : true ,
2019-06-23 12:21:44 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'update' ] ,
resource : [ 'organization' ] ,
2019-06-23 12:21:44 -07:00
} ,
} ,
2020-12-07 14:44:10 -08:00
description : 'The ID of the organization to create' ,
2019-06-23 12:21:44 -07:00
} ,
{
2020-12-07 14:44:10 -08:00
displayName : 'Update Fields' ,
name : 'updateFields' ,
2019-06-23 12:21:44 -07:00
type : 'collection' ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'update' ] ,
resource : [ 'organization' ] ,
2019-06-23 12:21:44 -07:00
} ,
} ,
default : { } ,
options : [
{
2020-12-07 14:44:10 -08:00
displayName : 'Custom Properties' ,
name : 'customProperties' ,
placeholder : 'Add Custom Property' ,
2022-05-06 14:01:25 -07:00
description : 'Adds a custom property to set also values which have not been predefined' ,
2020-12-07 14:44:10 -08:00
type : 'fixedCollection' ,
2019-07-14 08:57:08 -07:00
typeOptions : {
multipleValues : true ,
} ,
2020-12-07 14:44:10 -08:00
default : { } ,
options : [
{
name : 'property' ,
displayName : 'Property' ,
values : [
{
displayName : 'Property Name' ,
name : 'name' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Name of the property to set' ,
2020-12-07 14:44:10 -08:00
} ,
{
displayName : 'Property Value' ,
name : 'value' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Value of the property to set' ,
2020-12-07 14:44:10 -08:00
} ,
] ,
} ,
] ,
2019-06-23 12:21:44 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Label Name or ID' ,
2020-12-07 14:44:10 -08:00
name : 'label' ,
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-12-07 14:44:10 -08:00
typeOptions : {
loadOptionsMethod : 'getOrganizationLabels' ,
} ,
default : '' ,
2019-06-23 12:21:44 -07:00
} ,
{
2020-12-07 14:44:10 -08:00
displayName : 'Name' ,
name : 'name' ,
2019-07-14 08:57:08 -07:00
type : 'string' ,
2019-06-23 12:21:44 -07:00
default : '' ,
2020-12-07 14:44:10 -08:00
description : 'Organization name' ,
} ,
{
displayName : 'Owner ID' ,
name : 'owner_id' ,
type : 'number' ,
default : 0 ,
2022-08-17 08:50:24 -07:00
description :
'The ID of the user who will be marked as the owner of this Organization. When omitted, the authorized User ID will be used.' ,
2019-06-23 12:21:44 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Visible To' ,
2019-06-23 12:21:44 -07:00
name : 'visible_to' ,
type : 'options' ,
options : [
{
2022-06-03 10:23:49 -07:00
name : 'Owner & Followers (Private)' ,
2019-06-23 12:21:44 -07:00
value : '1' ,
} ,
{
2022-06-03 10:23:49 -07:00
name : 'Entire Company (Shared)' ,
2019-06-23 12:21:44 -07:00
value : '3' ,
} ,
] ,
default : '3' ,
2022-08-17 08:50:24 -07:00
description :
'Visibility of the person. If omitted, visibility will be set to the default visibility setting of this item type for the authorized user.' ,
2019-06-23 12:21:44 -07:00
} ,
2020-12-07 14:44:10 -08:00
] ,
} ,
// ----------------------------------
// person
// ----------------------------------
// ----------------------------------
// person:create
// ----------------------------------
{
displayName : 'Name' ,
name : 'name' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'create' ] ,
resource : [ 'person' ] ,
2020-12-07 14:44:10 -08:00
} ,
} ,
description : 'The name of the person to create' ,
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'create' ] ,
resource : [ 'person' ] ,
2020-12-07 14:44:10 -08:00
} ,
} ,
default : { } ,
options : [
2019-07-10 01:16:48 -07:00
{
displayName : 'Custom Properties' ,
name : 'customProperties' ,
placeholder : 'Add Custom Property' ,
2022-05-06 14:01:25 -07:00
description : 'Adds a custom property to set also values which have not been predefined' ,
2019-07-10 01:16:48 -07:00
type : 'fixedCollection' ,
typeOptions : {
multipleValues : true ,
} ,
default : { } ,
options : [
{
name : 'property' ,
displayName : 'Property' ,
values : [
{
2022-06-03 10:23:49 -07:00
displayName : 'Property Name or ID' ,
2019-07-10 01:16:48 -07:00
name : 'name' ,
2021-06-06 11:54:49 -07:00
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getPersonCustomFields' ,
} ,
2019-07-10 01:16:48 -07:00
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'Name of the custom field to set. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2019-07-10 01:16:48 -07:00
} ,
{
displayName : 'Property Value' ,
name : 'value' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Value of the property to set' ,
2019-07-10 01:16:48 -07:00
} ,
2020-10-22 06:46:03 -07:00
] ,
2019-07-10 01:16:48 -07:00
} ,
] ,
} ,
2020-12-07 14:44:10 -08:00
{
displayName : 'Email' ,
name : 'email' ,
type : 'string' ,
2022-06-20 07:54:01 -07:00
placeholder : 'name@email.com' ,
2020-12-07 14:44:10 -08:00
typeOptions : {
multipleValues : true ,
} ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Email of the person' ,
2020-12-07 14:44:10 -08:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Label Name or ID' ,
2020-12-07 14:44:10 -08:00
name : 'label' ,
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-12-07 14:44:10 -08:00
typeOptions : {
loadOptionsMethod : 'getPersonLabels' ,
} ,
default : '' ,
} ,
2022-02-14 14:08:55 -08:00
{
displayName : 'Marketing Status' ,
name : 'marketing_status' ,
type : 'options' ,
options : [
{
name : 'No Consent' ,
value : 'no_consent' ,
} ,
{
name : 'Unsubscribed' ,
value : 'unsubscribed' ,
} ,
{
name : 'Subscribed' ,
value : 'subscribed' ,
} ,
{
name : 'Archived' ,
value : 'archived' ,
} ,
] ,
default : 'subscribed' ,
2022-08-17 08:50:24 -07:00
description :
'Please be aware that it is only allowed once to change the marketing status from an old status to a new one' ,
2022-02-14 14:08:55 -08:00
} ,
2020-12-07 14:44:10 -08:00
{
2022-06-03 10:23:49 -07:00
displayName : 'Organization Name or ID' ,
2020-12-07 14:44:10 -08:00
name : 'org_id' ,
2021-06-06 11:54:49 -07:00
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getOrganizationIds' ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'ID of the organization this deal will be associated with. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2020-12-07 14:44:10 -08:00
} ,
{
displayName : 'Phone' ,
name : 'phone' ,
type : 'string' ,
typeOptions : {
multipleValues : true ,
} ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Phone number of the person' ,
2020-12-07 14:44:10 -08:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Visible To' ,
2020-12-07 14:44:10 -08:00
name : 'visible_to' ,
type : 'options' ,
options : [
{
2022-06-03 10:23:49 -07:00
name : 'Owner & Followers (Private)' ,
2020-12-07 14:44:10 -08:00
value : '1' ,
} ,
{
2022-06-03 10:23:49 -07:00
name : 'Entire Company (Shared)' ,
2020-12-07 14:44:10 -08:00
value : '3' ,
} ,
] ,
default : '3' ,
2022-08-17 08:50:24 -07:00
description :
'Visibility of the person. If omitted, visibility will be set to the default visibility setting of this item type for the authorized user.' ,
2020-12-07 14:44:10 -08:00
} ,
2022-02-14 14:08:55 -08:00
{
2022-06-03 10:23:49 -07:00
displayName : 'User Name or ID' ,
2022-02-14 14:08:55 -08:00
name : 'owner_id' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getUserIds' ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'ID of the User this deal will be associated with. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2022-02-14 14:08:55 -08:00
} ,
2019-06-23 12:21:44 -07:00
] ,
} ,
2019-07-14 08:57:08 -07:00
// ----------------------------------
// person:delete
// ----------------------------------
{
displayName : 'Person ID' ,
name : 'personId' ,
type : 'number' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'delete' ] ,
resource : [ 'person' ] ,
2019-07-14 08:57:08 -07:00
} ,
} ,
default : 0 ,
required : true ,
2022-05-06 14:01:25 -07:00
description : 'ID of the person to delete' ,
2019-07-14 08:57:08 -07:00
} ,
// ----------------------------------
// person:get
// ----------------------------------
{
displayName : 'Person ID' ,
name : 'personId' ,
type : 'number' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'get' ] ,
resource : [ 'person' ] ,
2019-07-14 08:57:08 -07:00
} ,
} ,
default : 0 ,
required : true ,
2022-05-06 14:01:25 -07:00
description : 'ID of the person to get' ,
2019-07-14 08:57:08 -07:00
} ,
2019-06-23 12:21:44 -07:00
// ----------------------------------
2019-07-14 08:57:08 -07:00
// person:update
2019-06-23 12:21:44 -07:00
// ----------------------------------
{
displayName : 'Person ID' ,
name : 'personId' ,
type : 'number' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'update' ] ,
resource : [ 'person' ] ,
2019-06-23 12:21:44 -07:00
} ,
} ,
default : 0 ,
required : true ,
2022-05-06 14:01:25 -07:00
description : 'ID of the person to update' ,
2019-06-23 12:21:44 -07:00
} ,
{
displayName : 'Update Fields' ,
name : 'updateFields' ,
type : 'collection' ,
2022-05-06 14:01:25 -07:00
description : 'The fields to update' ,
2019-06-23 12:21:44 -07:00
placeholder : 'Add Field' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'update' ] ,
resource : [ 'person' ] ,
2019-06-23 12:21:44 -07:00
} ,
} ,
default : { } ,
options : [
2020-12-07 14:44:10 -08:00
{
displayName : 'Custom Properties' ,
name : 'customProperties' ,
placeholder : 'Add Custom Property' ,
2022-05-06 14:01:25 -07:00
description : 'Adds a custom property to set also values which have not been predefined' ,
2020-12-07 14:44:10 -08:00
type : 'fixedCollection' ,
typeOptions : {
multipleValues : true ,
} ,
default : { } ,
options : [
{
name : 'property' ,
displayName : 'Property' ,
values : [
{
2022-06-03 10:23:49 -07:00
displayName : 'Property Name or ID' ,
2020-12-07 14:44:10 -08:00
name : 'name' ,
2021-06-06 11:54:49 -07:00
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getPersonCustomFields' ,
} ,
2020-12-07 14:44:10 -08:00
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'Name of the custom field to set. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2020-12-07 14:44:10 -08:00
} ,
{
displayName : 'Property Value' ,
name : 'value' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Value of the property to set' ,
2020-12-07 14:44:10 -08:00
} ,
] ,
} ,
] ,
} ,
2019-06-23 12:21:44 -07:00
{
displayName : 'Email' ,
name : 'email' ,
type : 'string' ,
2022-06-20 07:54:01 -07:00
placeholder : 'name@email.com' ,
2019-06-23 12:21:44 -07:00
typeOptions : {
multipleValues : true ,
} ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Email of the person' ,
2019-06-23 12:21:44 -07:00
} ,
2020-12-07 14:44:10 -08:00
{
2022-06-03 10:23:49 -07:00
displayName : 'Label Name or ID' ,
2020-12-07 14:44:10 -08:00
name : 'label' ,
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-12-07 14:44:10 -08:00
typeOptions : {
loadOptionsMethod : 'getPersonLabels' ,
} ,
default : '' ,
} ,
2022-02-26 04:15:10 -08:00
{
displayName : 'Marketing Status' ,
name : 'marketing_status' ,
type : 'options' ,
options : [
{
name : 'No Consent' ,
value : 'no_consent' ,
} ,
{
name : 'Unsubscribed' ,
value : 'unsubscribed' ,
} ,
{
name : 'Subscribed' ,
value : 'subscribed' ,
} ,
{
name : 'Archived' ,
value : 'archived' ,
} ,
] ,
default : 'subscribed' ,
2022-08-17 08:50:24 -07:00
description :
'Please be aware that it is only allowed once to change the marketing status from an old status to a new one' ,
2022-02-26 04:15:10 -08:00
} ,
2019-06-23 12:21:44 -07:00
{
displayName : 'Name' ,
name : 'name' ,
type : 'string' ,
default : '' ,
description : 'The name of the person' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Organization Name or ID' ,
2019-06-23 12:21:44 -07:00
name : 'org_id' ,
2021-06-06 11:54:49 -07:00
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getOrganizationIds' ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'ID of the organization this deal will be associated with. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2019-06-23 12:21:44 -07:00
} ,
{
displayName : 'Phone' ,
name : 'phone' ,
type : 'string' ,
typeOptions : {
multipleValues : true ,
} ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Phone number of the person' ,
2019-06-23 12:21:44 -07:00
} ,
2022-02-26 04:15:10 -08:00
{
2022-06-03 10:23:49 -07:00
displayName : 'User Name or ID' ,
2022-02-26 04:15:10 -08:00
name : 'owner_id' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getUserIds' ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'ID of the User this person will be associated with. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2022-02-26 04:15:10 -08:00
} ,
2019-06-23 12:21:44 -07:00
{
2022-06-03 10:23:49 -07:00
displayName : 'Visible To' ,
2019-06-23 12:21:44 -07:00
name : 'visible_to' ,
type : 'options' ,
options : [
{
2022-06-03 10:23:49 -07:00
name : 'Owner & Followers (Private)' ,
2019-06-23 12:21:44 -07:00
value : '1' ,
} ,
{
2022-06-03 10:23:49 -07:00
name : 'Entire Company (Shared)' ,
2019-06-23 12:21:44 -07:00
value : '3' ,
} ,
] ,
default : '3' ,
2022-08-17 08:50:24 -07:00
description :
'Visibility of the deal. If omitted, visibility will be set to the default visibility setting of this item type for the authorized user.' ,
2019-06-23 12:21:44 -07:00
} ,
] ,
} ,
2019-07-14 08:57:08 -07:00
// ----------------------------------
2019-09-02 13:26:42 -07:00
// activity / deal / note / organization / person / product
2019-07-14 08:57:08 -07:00
// ----------------------------------
2019-08-27 23:20:53 -07:00
{
displayName : 'Resolve Properties' ,
name : 'resolveProperties' ,
type : 'boolean' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'activity' , 'deal' , 'organization' , 'person' , 'product' ] ,
operation : [ 'get' , 'getAll' ] ,
2019-08-27 23:20:53 -07:00
} ,
} ,
default : false ,
2022-06-20 07:54:01 -07:00
// eslint-disable-next-line n8n-nodes-base/node-param-description-boolean-without-whether
2022-08-17 08:50:24 -07:00
description :
'By default do custom properties get returned only as ID instead of their actual name. Also option fields contain only the ID instead of their actual value. If this option gets set they get automatically resolved.' ,
2019-08-27 23:20:53 -07:00
} ,
2019-10-22 02:30:35 -07:00
{
displayName : 'Encode Properties' ,
name : 'encodeProperties' ,
type : 'boolean' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'activity' , 'deal' , 'organization' , 'person' , 'product' ] ,
operation : [ 'update' ] ,
2019-10-22 02:30:35 -07:00
} ,
} ,
default : false ,
2022-06-20 07:54:01 -07:00
// eslint-disable-next-line n8n-nodes-base/node-param-description-boolean-without-whether
2022-08-17 08:50:24 -07:00
description :
'By default do custom properties have to be set as ID instead of their actual name. Also option fields have to be set as ID instead of their actual value. If this option gets set they get automatically encoded.' ,
2019-10-22 02:30:35 -07:00
} ,
2019-07-14 08:57:08 -07:00
{
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getAll' ] ,
2019-07-14 08:57:08 -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' ,
2019-07-14 08:57:08 -07:00
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getAll' ] ,
returnAll : [ false ] ,
2019-07-14 08:57:08 -07:00
} ,
} ,
typeOptions : {
minValue : 1 ,
maxValue : 500 ,
} ,
default : 100 ,
2022-05-06 14:01:25 -07:00
description : 'Max number of results to return' ,
2019-07-14 08:57:08 -07:00
} ,
2021-09-16 10:09:19 -07:00
// ----------------------------------
// dealActivities:getAll
// ----------------------------------
{
2022-06-03 10:23:49 -07:00
displayName : 'Deal Name or ID' ,
2021-09-16 10:09:19 -07:00
name : 'dealId' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getDeals' ,
} ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getAll' ] ,
resource : [ 'dealActivity' ] ,
2021-09-16 10:09:19 -07:00
} ,
} ,
2022-08-17 08:50:24 -07:00
description :
'The ID of the deal whose activity to retrieve. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-09-16 10:09:19 -07:00
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getAll' ] ,
resource : [ 'dealActivity' ] ,
2021-09-16 10:09:19 -07:00
} ,
} ,
default : { } ,
options : [
{
displayName : 'Done' ,
name : 'done' ,
2021-10-09 12:32:51 -07:00
type : 'boolean' ,
default : false ,
2022-05-06 14:01:25 -07:00
description : 'Whether the activity is done or not' ,
2021-09-16 10:09:19 -07:00
} ,
{
2021-10-09 12:32:51 -07:00
displayName : 'Exclude Activity IDs' ,
2021-09-16 10:09:19 -07:00
name : 'exclude' ,
type : 'string' ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'A comma-separated Activity IDs, to exclude from result. Ex. 4, 9, 11, ...' ,
2021-09-16 10:09:19 -07:00
} ,
] ,
} ,
2021-10-09 12:32:51 -07:00
2021-07-20 06:53:10 -07:00
// ----------------------------------------
// lead: getAll
// ----------------------------------------
{
displayName : 'Filters' ,
name : 'filters' ,
type : 'collection' ,
placeholder : 'Add Filter' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'lead' ] ,
operation : [ 'getAll' ] ,
2021-07-20 06:53:10 -07:00
} ,
} ,
options : [
{
displayName : 'Archived Status' ,
name : 'archived_status' ,
type : 'options' ,
default : 'all' ,
options : [
{
name : 'Archived' ,
value : 'archived' ,
} ,
{
name : 'All' ,
value : 'all' ,
} ,
{
name : 'Not Archived' ,
value : 'not_archived' ,
} ,
] ,
} ,
] ,
} ,
2022-05-06 08:42:26 -07:00
// ----------------------------------
// organization:getAll
// ----------------------------------
{
displayName : 'Filters' ,
name : 'filters' ,
type : 'collection' ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getAll' ] ,
resource : [ 'organization' ] ,
2022-05-06 08:42:26 -07:00
} ,
} ,
default : { } ,
options : [
{
displayName : 'First Char' ,
name : 'firstChar' ,
type : 'string' ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'If supplied, only organizations whose name starts with the specified letter will be returned' ,
2022-05-06 08:42:26 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Predefined Filter Name or ID' ,
2022-05-06 08:42:26 -07:00
name : 'filterId' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getFilters' ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'ID of the filter to use. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2022-05-06 08:42:26 -07:00
} ,
] ,
} ,
2020-07-23 13:51:05 -07:00
// ----------------------------------
// person:getAll
// ----------------------------------
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getAll' ] ,
resource : [ 'person' ] ,
2020-07-23 13:51:05 -07:00
} ,
} ,
default : { } ,
options : [
{
2022-06-03 10:23:49 -07:00
displayName : 'Predefined Filter Name or ID' ,
2020-07-23 13:51:05 -07:00
name : 'filterId' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getFilters' ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'ID of the filter to use. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2020-07-23 13:51:05 -07:00
} ,
{
displayName : 'First Char' ,
name : 'firstChar' ,
type : 'string' ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'If supplied, only persons whose name starts with the specified letter will be returned' ,
2020-07-23 13:51:05 -07:00
} ,
] ,
} ,
// ----------------------------------
// person:search
// ----------------------------------
{
displayName : 'Term' ,
name : 'term' ,
type : 'string' ,
2020-07-23 14:10:20 -07:00
required : true ,
2020-07-23 13:51:05 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'search' ] ,
resource : [ 'person' ] ,
2020-07-23 13:51:05 -07:00
} ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'The search term to look for. Minimum 2 characters (or 1 if using exact_match).' ,
2020-07-23 13:51:05 -07:00
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'search' ] ,
resource : [ 'person' ] ,
2020-07-23 13:51:05 -07:00
} ,
} ,
default : { } ,
options : [
{
displayName : 'Exact Match' ,
name : 'exactMatch' ,
type : 'boolean' ,
default : false ,
2022-08-17 08:50:24 -07:00
description :
'Whether only full exact matches against the given term are returned. It is not case sensitive.' ,
2020-07-23 13:51:05 -07:00
} ,
{
displayName : 'Fields' ,
name : 'fields' ,
type : 'string' ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'A comma-separated string array. The fields to perform the search from. Defaults to all of them.' ,
2020-07-23 13:51:05 -07:00
} ,
{
displayName : 'Include Fields' ,
name : 'includeFields' ,
type : 'string' ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'Supports including optional fields in the results which are not provided by default' ,
2020-07-23 13:51:05 -07:00
} ,
{
displayName : 'Organization ID' ,
name : 'organizationId' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Will filter Deals by the provided Organization ID' ,
2020-07-23 13:51:05 -07:00
} ,
{
displayName : 'RAW Data' ,
name : 'rawData' ,
type : 'boolean' ,
default : false ,
2022-08-17 08:50:24 -07:00
description :
'Whether to return the data exactly in the way it got received from the API' ,
2020-07-23 13:51:05 -07:00
} ,
] ,
} ,
2020-10-13 14:07:45 -07:00
// ----------------------------------
// note:create/getAll
// ----------------------------------
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'create' , 'getAll' ] ,
resource : [ 'note' ] ,
2020-10-13 14:07:45 -07:00
} ,
} ,
default : { } ,
options : [
{
displayName : 'Deal ID' ,
name : 'deal_id' ,
type : 'number' ,
default : 0 ,
description : 'ID of the deal this note will be associated with' ,
} ,
2021-09-15 02:02:36 -07:00
{
displayName : 'Lead ID' ,
name : 'lead_id' ,
type : 'number' ,
default : 0 ,
description : 'ID of the lead this note will be associated with' ,
} ,
2020-10-13 14:07:45 -07:00
{
2022-06-03 10:23:49 -07:00
displayName : 'Organization Name or ID' ,
2020-10-13 14:07:45 -07:00
name : 'org_id' ,
2021-06-06 11:54:49 -07:00
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getOrganizationIds' ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'ID of the organization this deal will be associated with. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2020-10-13 14:07:45 -07:00
} ,
{
displayName : 'Person ID' ,
name : 'person_id' ,
type : 'number' ,
default : 0 ,
2022-05-06 14:01:25 -07:00
description : 'ID of the person this note will be associated with' ,
2020-10-13 14:07:45 -07:00
} ,
] ,
} ,
2021-06-06 11:54:49 -07:00
// ----------------------------------
// activity:getAll
// ----------------------------------
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getAll' ] ,
resource : [ 'activity' ] ,
2021-06-06 11:54:49 -07:00
} ,
} ,
default : { } ,
options : [
{
displayName : 'Done' ,
name : 'done' ,
type : 'boolean' ,
default : false ,
2022-08-17 08:50:24 -07:00
description :
'Whether the Activity is done or not. 0 = Not done, 1 = Done. If omitted returns both Done and Not done activities.' ,
2021-06-06 11:54:49 -07:00
} ,
{
displayName : 'End Date' ,
name : 'end_date' ,
type : 'dateTime' ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'Use the Activity due date where you wish to stop fetching Activities from. Insert due date in YYYY-MM-DD format.' ,
2021-06-06 11:54:49 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Predefined Filter Name or ID' ,
2021-06-06 11:54:49 -07:00
name : 'filterId' ,
2021-08-13 01:22:00 -07:00
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getFilters' ,
} ,
2021-06-06 11:54:49 -07:00
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'The ID of the Filter to use (will narrow down results if used together with user_id parameter). Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-06-06 11:54:49 -07:00
} ,
{
displayName : 'Star Date' ,
name : 'start_date' ,
type : 'dateTime' ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'Use the Activity due date where you wish to begin fetching Activities from. Insert due date in YYYY-MM-DD format.' ,
2021-06-06 11:54:49 -07:00
} ,
{
2022-06-20 07:54:01 -07:00
displayName : 'Type Names or IDs' ,
2021-06-06 11:54:49 -07:00
name : 'type' ,
type : 'multiOptions' ,
typeOptions : {
loadOptionsMethod : 'getActivityTypes' ,
} ,
default : [ ] ,
2022-08-17 08:50:24 -07:00
description :
'Type of the Activity. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-06-06 11:54:49 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'User Name or ID' ,
2021-06-06 11:54:49 -07:00
name : 'user_id' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getUserIds' ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'The ID of the User whose Activities will be fetched. If omitted, the User associated with the API token will be used. If 0, Activities for all company Users will be fetched based on the permission sets. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-06-06 11:54:49 -07:00
} ,
] ,
} ,
2021-08-13 01:22:00 -07:00
// ----------------------------------
// deal: getAll
// ----------------------------------
{
displayName : 'Filters' ,
name : 'filters' ,
type : 'collection' ,
placeholder : 'Add Filter' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'getAll' ] ,
resource : [ 'deal' ] ,
2021-08-13 01:22:00 -07:00
} ,
} ,
default : { } ,
options : [
{
2022-06-03 10:23:49 -07:00
displayName : 'Predefined Filter Name or ID' ,
2021-08-13 01:22:00 -07:00
name : 'filter_id' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getFilters' ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'Predefined filter to apply to the deals to retrieve. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-08-13 01:22:00 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Stage Name or ID' ,
2021-08-13 01:22:00 -07:00
name : 'stage_id' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getStageIds' ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'ID of the stage to filter deals by. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-08-13 01:22:00 -07:00
} ,
{
displayName : 'Status' ,
name : 'status' ,
type : 'options' ,
options : [
{
name : 'All Not Deleted' ,
value : 'all_not_deleted' ,
} ,
{
name : 'Deleted' ,
value : 'deleted' ,
} ,
{
name : 'Lost' ,
value : 'lost' ,
} ,
{
name : 'Open' ,
value : 'open' ,
} ,
{
name : 'Won' ,
value : 'won' ,
} ,
] ,
default : 'all_not_deleted' ,
description : 'Status to filter deals by. Defaults to <code>all_not_deleted</code>' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'User Name or ID' ,
2021-08-13 01:22:00 -07:00
name : 'user_id' ,
type : 'options' ,
typeOptions : {
loadOptionsMethod : 'getUserIds' ,
} ,
default : '' ,
2022-08-17 08:50:24 -07:00
description :
'ID of the user to filter deals by. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-08-13 01:22:00 -07:00
} ,
] ,
} ,
2019-06-23 12:21:44 -07:00
] ,
} ;
2020-07-23 13:51:05 -07:00
methods = {
loadOptions : {
2023-04-19 07:00:49 -07:00
// Get all Organizations to display them to user so that they can
2021-06-06 11:54:49 -07:00
// select them easily
async getActivityTypes ( this : ILoadOptionsFunctions ) : Promise < INodePropertyOptions [ ] > {
const returnData : INodePropertyOptions [ ] = [ ] ;
const { data } = await pipedriveApiRequest . call ( this , 'GET' , '/activityTypes' , { } ) ;
for ( const activity of data ) {
returnData . push ( {
name : activity.name ,
value : activity.key_string ,
} ) ;
}
2021-10-09 12:20:04 -07:00
return sortOptionParameters ( returnData ) ;
2021-06-06 11:54:49 -07:00
} ,
2023-04-19 07:00:49 -07:00
// Get all Filters to display them to user so that they can
2021-08-13 01:22:00 -07:00
// select them easily
async getFilters ( this : ILoadOptionsFunctions ) : Promise < INodePropertyOptions [ ] > {
const returnData : INodePropertyOptions [ ] = [ ] ;
const resource = this . getNodeParameter ( 'resource' ) as string ;
const type = {
2022-08-17 08:50:24 -07:00
deal : 'deals' ,
activity : 'activity' ,
person : 'people' ,
organization : 'org' ,
2021-08-13 01:22:00 -07:00
} as { [ id : string ] : string } ;
2022-08-17 08:50:24 -07:00
const { data } = await pipedriveApiRequest . call (
this ,
'GET' ,
'/filters' ,
{ } ,
2022-12-02 12:54:28 -08:00
{ type : type [ resource ] } ,
2022-08-17 08:50:24 -07:00
) ;
2021-08-13 01:22:00 -07:00
for ( const filter of data ) {
returnData . push ( {
name : filter.name ,
value : filter.id ,
} ) ;
}
2021-10-09 12:20:04 -07:00
return sortOptionParameters ( returnData ) ;
2021-08-13 01:22:00 -07:00
} ,
2023-04-19 07:00:49 -07:00
// Get all Organizations to display them to user so that they can
2021-06-06 11:54:49 -07:00
// select them easily
async getOrganizationIds ( this : ILoadOptionsFunctions ) : Promise < INodePropertyOptions [ ] > {
const returnData : INodePropertyOptions [ ] = [ ] ;
const { data } = await pipedriveApiRequest . call ( this , 'GET' , '/organizations' , { } ) ;
for ( const org of data ) {
returnData . push ( {
name : org.name ,
value : org.id ,
} ) ;
}
2021-10-09 12:20:04 -07:00
return sortOptionParameters ( returnData ) ;
2021-06-06 11:54:49 -07:00
} ,
2023-04-19 07:00:49 -07:00
// Get all Users to display them to user so that they can
2021-06-06 11:54:49 -07:00
// select them easily
async getUserIds ( this : ILoadOptionsFunctions ) : Promise < INodePropertyOptions [ ] > {
const returnData : INodePropertyOptions [ ] = [ ] ;
2021-10-18 21:02:52 -07:00
const resource = this . getCurrentNodeParameter ( 'resource' ) ;
2021-06-06 11:54:49 -07:00
const { data } = await pipedriveApiRequest . call ( this , 'GET' , '/users' , { } ) ;
for ( const user of data ) {
if ( user . active_flag === true ) {
returnData . push ( {
name : user.name ,
value : user.id ,
} ) ;
}
}
2022-08-17 08:50:24 -07:00
if ( resource === 'activity' ) {
2021-10-18 21:02:52 -07:00
returnData . push ( {
name : 'All Users' ,
value : 0 ,
} ) ;
}
2021-10-09 12:20:04 -07:00
return sortOptionParameters ( returnData ) ;
2021-06-06 11:54:49 -07:00
} ,
2023-04-19 07:00:49 -07:00
// Get all Deals to display them to user so that they can
2021-08-01 12:19:41 -07:00
// select them easily
async getDeals ( this : ILoadOptionsFunctions ) : Promise < INodePropertyOptions [ ] > {
2022-08-17 08:50:24 -07:00
const { data } = ( await pipedriveApiRequest . call ( this , 'GET' , '/deals' , { } ) ) as {
data : Array < { id : string ; title : string } > ;
2021-08-01 12:19:41 -07:00
} ;
2021-10-09 12:20:04 -07:00
return sortOptionParameters ( data . map ( ( { id , title } ) = > ( { value : id , name : title } ) ) ) ;
2021-08-01 12:19:41 -07:00
} ,
2023-04-19 07:00:49 -07:00
// Get all Products to display them to user so that they can
2021-08-01 12:19:41 -07:00
// select them easily
async getProducts ( this : ILoadOptionsFunctions ) : Promise < INodePropertyOptions [ ] > {
2022-08-17 08:50:24 -07:00
const { data } = ( await pipedriveApiRequest . call ( this , 'GET' , '/products' , { } ) ) as {
data : Array < { id : string ; name : string } > ;
2021-08-01 12:19:41 -07:00
} ;
2021-10-09 12:20:04 -07:00
return sortOptionParameters ( data . map ( ( { id , name } ) = > ( { value : id , name } ) ) ) ;
2021-08-01 12:19:41 -07:00
} ,
2023-04-19 07:00:49 -07:00
// Get all Products related to a deal and display them to user so that they can
2021-08-01 12:19:41 -07:00
// select them easily
async getProductsDeal ( this : ILoadOptionsFunctions ) : Promise < INodePropertyOptions [ ] > {
const dealId = this . getCurrentNodeParameter ( 'dealId' ) ;
2022-08-17 08:50:24 -07:00
const { data } = ( await pipedriveApiRequest . call (
this ,
'GET' ,
` /deals/ ${ dealId } /products ` ,
{ } ,
) ) as {
data : Array < { id : string ; name : string } > ;
2021-08-01 12:19:41 -07:00
} ;
2021-10-09 12:20:04 -07:00
return sortOptionParameters ( data . map ( ( { id , name } ) = > ( { value : id , name } ) ) ) ;
2021-08-01 12:19:41 -07:00
} ,
2023-04-19 07:00:49 -07:00
// Get all Stages to display them to user so that they can
2021-06-06 11:54:49 -07:00
// select them easily
async getStageIds ( this : ILoadOptionsFunctions ) : Promise < INodePropertyOptions [ ] > {
const returnData : INodePropertyOptions [ ] = [ ] ;
const { data } = await pipedriveApiRequest . call ( this , 'GET' , '/stages' , { } ) ;
for ( const stage of data ) {
returnData . push ( {
name : ` ${ stage . pipeline_name } > ${ stage . name } ` ,
value : stage.id ,
} ) ;
}
2021-10-09 12:20:04 -07:00
return sortOptionParameters ( returnData ) ;
2021-06-06 11:54:49 -07:00
} ,
2023-04-19 07:00:49 -07:00
// Get all the Organization Custom Fields to display them to user so that they can
2021-06-06 11:54:49 -07:00
// select them easily
2022-08-17 08:50:24 -07:00
async getOrganizationCustomFields (
this : ILoadOptionsFunctions ,
) : Promise < INodePropertyOptions [ ] > {
2021-06-06 11:54:49 -07:00
const returnData : INodePropertyOptions [ ] = [ ] ;
const { data } = await pipedriveApiRequest . call ( this , 'GET' , '/organizationFields' , { } ) ;
for ( const field of data ) {
if ( field . key . length === 40 ) {
returnData . push ( {
name : field.name ,
value : field.key ,
} ) ;
}
}
2021-10-09 12:20:04 -07:00
return sortOptionParameters ( returnData ) ;
2021-06-06 11:54:49 -07:00
} ,
2023-04-19 07:00:49 -07:00
// Get all the Deal Custom Fields to display them to user so that they can
2021-06-06 11:54:49 -07:00
// select them easily
async getDealCustomFields ( this : ILoadOptionsFunctions ) : Promise < INodePropertyOptions [ ] > {
const returnData : INodePropertyOptions [ ] = [ ] ;
const { data } = await pipedriveApiRequest . call ( this , 'GET' , '/dealFields' , { } ) ;
for ( const field of data ) {
if ( field . key . length === 40 ) {
returnData . push ( {
name : field.name ,
value : field.key ,
} ) ;
}
}
2021-10-09 12:20:04 -07:00
return sortOptionParameters ( returnData ) ;
2021-06-06 11:54:49 -07:00
} ,
2023-04-19 07:00:49 -07:00
// Get all the Person Custom Fields to display them to user so that they can
2021-06-06 11:54:49 -07:00
// select them easily
async getPersonCustomFields ( this : ILoadOptionsFunctions ) : Promise < INodePropertyOptions [ ] > {
const returnData : INodePropertyOptions [ ] = [ ] ;
const { data } = await pipedriveApiRequest . call ( this , 'GET' , '/personFields' , { } ) ;
for ( const field of data ) {
if ( field . key . length === 40 ) {
returnData . push ( {
name : field.name ,
value : field.key ,
} ) ;
}
}
2021-10-09 12:20:04 -07:00
return sortOptionParameters ( returnData ) ;
2021-06-06 11:54:49 -07:00
} ,
2023-04-19 07:00:49 -07:00
// Get all the person labels to display them to user so that they can
2020-12-07 14:44:10 -08:00
// select them easily
async getPersonLabels ( this : ILoadOptionsFunctions ) : Promise < INodePropertyOptions [ ] > {
const returnData : INodePropertyOptions [ ] = [ ] ;
const operation = this . getCurrentNodeParameter ( 'operation' ) as string ;
const { data } = await pipedriveApiRequest . call ( this , 'GET' , '/personFields' , { } ) ;
for ( const field of data ) {
if ( field . key === 'label' ) {
if ( field . options ) {
for ( const option of field . options ) {
returnData . push ( {
name : option.label ,
value : option.id ,
} ) ;
}
}
}
}
2021-06-06 11:54:49 -07:00
2021-10-09 12:20:04 -07:00
sortOptionParameters ( returnData ) ;
2021-06-06 11:54:49 -07:00
2020-12-07 14:44:10 -08:00
if ( operation === 'update' ) {
returnData . push ( {
name : 'No Label' ,
value : 'null' ,
} ) ;
}
return returnData ;
} ,
2023-04-19 07:00:49 -07:00
// Get all the labels to display them to user so that they can
2020-12-07 14:44:10 -08:00
// select them easily
async getOrganizationLabels ( this : ILoadOptionsFunctions ) : Promise < INodePropertyOptions [ ] > {
const returnData : INodePropertyOptions [ ] = [ ] ;
const operation = this . getCurrentNodeParameter ( 'operation' ) as string ;
const { data } = await pipedriveApiRequest . call ( this , 'GET' , '/organizationFields' , { } ) ;
for ( const field of data ) {
if ( field . key === 'label' ) {
if ( field . options ) {
for ( const option of field . options ) {
returnData . push ( {
name : option.label ,
value : option.id ,
} ) ;
}
}
}
}
2021-06-06 11:54:49 -07:00
2021-10-09 12:20:04 -07:00
sortOptionParameters ( returnData ) ;
2021-06-06 11:54:49 -07:00
2020-12-07 14:44:10 -08:00
if ( operation === 'update' ) {
returnData . push ( {
name : 'No Label' ,
value : 'null' ,
} ) ;
}
return returnData ;
} ,
2021-07-20 06:53:10 -07:00
2023-04-19 07:00:49 -07:00
// Get all the persons to display them to user so that they can
2021-07-20 06:53:10 -07:00
// select them easily
async getPersons ( this : ILoadOptionsFunctions ) : Promise < INodePropertyOptions [ ] > {
2022-08-17 08:50:24 -07:00
const { data } = ( await pipedriveApiRequest . call ( this , 'GET' , '/persons' , { } ) ) as {
data : Array < { id : string ; name : string } > ;
2021-07-20 06:53:10 -07:00
} ;
2021-10-09 12:20:04 -07:00
return sortOptionParameters ( data . map ( ( { id , name } ) = > ( { value : id , name } ) ) ) ;
2021-07-20 06:53:10 -07:00
} ,
2023-04-19 07:00:49 -07:00
// Get all the lead labels to display them to user so that they can
2021-07-20 06:53:10 -07:00
// select them easily
async getLeadLabels ( this : ILoadOptionsFunctions ) : Promise < INodePropertyOptions [ ] > {
2022-08-17 08:50:24 -07:00
const { data } = ( await pipedriveApiRequest . call ( this , 'GET' , '/leadLabels' , { } ) ) as {
data : Array < { id : string ; name : string } > ;
2021-07-20 06:53:10 -07:00
} ;
2021-10-09 12:20:04 -07:00
return sortOptionParameters ( data . map ( ( { id , name } ) = > ( { value : id , name } ) ) ) ;
2021-07-20 06:53:10 -07:00
} ,
2023-04-19 07:00:49 -07:00
// Get all the labels to display them to user so that they can
2020-12-07 14:44:10 -08:00
// select them easily
async getDealLabels ( this : ILoadOptionsFunctions ) : Promise < INodePropertyOptions [ ] > {
const returnData : INodePropertyOptions [ ] = [ ] ;
const operation = this . getCurrentNodeParameter ( 'operation' ) as string ;
const { data } = await pipedriveApiRequest . call ( this , 'GET' , '/dealFields' , { } ) ;
for ( const field of data ) {
if ( field . key === 'label' ) {
if ( field . options ) {
for ( const option of field . options ) {
returnData . push ( {
name : option.label ,
value : option.id ,
} ) ;
}
}
}
}
2021-06-06 11:54:49 -07:00
2021-10-09 12:20:04 -07:00
sortOptionParameters ( returnData ) ;
2021-06-06 11:54:49 -07:00
2020-12-07 14:44:10 -08:00
if ( operation === 'update' ) {
returnData . push ( {
name : 'No Label' ,
value : 'null' ,
} ) ;
}
return returnData ;
} ,
2020-10-22 06:46:03 -07:00
} ,
2020-07-23 13:51:05 -07:00
} ;
2019-06-23 12:21:44 -07:00
async execute ( this : IExecuteFunctions ) : Promise < INodeExecutionData [ ] [ ] > {
const items = this . getInputData ( ) ;
2022-08-30 08:55:33 -07:00
const returnData : INodeExecutionData [ ] = [ ] ;
2019-06-23 12:21:44 -07:00
// For Post
let body : IDataObject ;
2019-09-03 14:06:03 -07:00
// For FormData
let formData : IDataObject ;
2019-06-23 12:21:44 -07:00
// For Query string
let qs : IDataObject ;
2019-09-03 14:06:03 -07:00
let downloadFile : boolean ;
2024-02-14 07:29:09 -08:00
let requestMethod : IHttpRequestMethods ;
2019-06-23 12:21:44 -07:00
let endpoint : string ;
let returnAll = false ;
2022-12-02 03:53:59 -08:00
const resource = this . getNodeParameter ( 'resource' , 0 ) ;
const operation = this . getNodeParameter ( 'operation' , 0 ) ;
2019-08-27 23:20:53 -07:00
2019-10-22 02:30:35 -07:00
let customProperties : ICustomProperties | undefined ;
2022-08-17 08:50:24 -07:00
if (
[ 'get' , 'getAll' , 'update' ] . includes ( operation ) &&
[ 'activity' , 'deal' , 'organization' , 'person' , 'product' ] . includes ( resource )
) {
2019-10-22 02:30:35 -07:00
// Request the custom properties once in the beginning to not query it multiple
// times if multiple items get updated
let getCustomProperties = false ;
if ( [ 'update' ] . includes ( operation ) ) {
getCustomProperties = this . getNodeParameter ( 'encodeProperties' , 0 , false ) as boolean ;
} else {
getCustomProperties = this . getNodeParameter ( 'resolveProperties' , 0 , false ) as boolean ;
}
2022-12-02 12:54:28 -08:00
if ( getCustomProperties ) {
2019-10-22 02:30:35 -07:00
customProperties = await pipedriveGetCustomProperties . call ( this , resource ) ;
}
}
2019-06-23 12:21:44 -07:00
for ( let i = 0 ; i < items . length ; i ++ ) {
requestMethod = 'GET' ;
endpoint = '' ;
2019-09-03 14:06:03 -07:00
downloadFile = false ;
2019-06-23 12:21:44 -07:00
body = { } ;
2019-09-03 14:06:03 -07:00
formData = { } ;
2019-06-23 12:21:44 -07:00
qs = { } ;
2021-07-19 23:58:54 -07:00
try {
if ( resource === 'activity' ) {
if ( operation === 'create' ) {
// ----------------------------------
// activity:create
// ----------------------------------
2019-06-23 12:21:44 -07:00
2021-07-19 23:58:54 -07:00
requestMethod = 'POST' ;
endpoint = '/activities' ;
2019-06-23 12:21:44 -07:00
2021-07-19 23:58:54 -07:00
body . subject = this . getNodeParameter ( 'subject' , i ) as string ;
body . done = this . getNodeParameter ( 'done' , i ) as string ;
body . type = this . getNodeParameter ( 'type' , i ) as string ;
2022-11-18 07:29:44 -08:00
const additionalFields = this . getNodeParameter ( 'additionalFields' , i ) ;
2021-07-19 23:58:54 -07:00
addAdditionalFields ( body , additionalFields ) ;
} else if ( operation === 'delete' ) {
// ----------------------------------
// activity:delete
// ----------------------------------
2019-06-23 12:21:44 -07:00
2021-07-19 23:58:54 -07:00
requestMethod = 'DELETE' ;
2019-06-23 12:21:44 -07:00
2021-07-19 23:58:54 -07:00
const activityId = this . getNodeParameter ( 'activityId' , i ) as number ;
endpoint = ` /activities/ ${ activityId } ` ;
} else if ( operation === 'get' ) {
// ----------------------------------
// activity:get
// ----------------------------------
2019-07-10 01:16:48 -07:00
2021-07-19 23:58:54 -07:00
requestMethod = 'GET' ;
2019-07-10 01:16:48 -07:00
2021-07-19 23:58:54 -07:00
const activityId = this . getNodeParameter ( 'activityId' , i ) as number ;
2019-07-10 01:16:48 -07:00
2021-07-19 23:58:54 -07:00
endpoint = ` /activities/ ${ activityId } ` ;
} else if ( operation === 'getAll' ) {
// ----------------------------------
// activity:getAll
// ----------------------------------
2019-06-23 12:21:44 -07:00
2021-07-19 23:58:54 -07:00
requestMethod = 'GET' ;
2019-08-27 23:20:53 -07:00
2022-11-18 05:31:38 -08:00
returnAll = this . getNodeParameter ( 'returnAll' , i ) ;
2022-12-02 12:54:28 -08:00
if ( ! returnAll ) {
2022-11-18 06:26:22 -08:00
qs . limit = this . getNodeParameter ( 'limit' , i ) ;
2021-07-19 23:58:54 -07:00
}
2019-08-27 23:20:53 -07:00
2022-11-18 07:29:44 -08:00
const additionalFields = this . getNodeParameter ( 'additionalFields' , i ) ;
2021-07-19 23:58:54 -07:00
addAdditionalFields ( qs , additionalFields ) ;
2019-08-27 23:20:53 -07:00
2021-08-13 01:22:00 -07:00
if ( qs . filterId ) {
qs . filter_id = qs . filterId ;
delete qs . filterId ;
}
2021-07-19 23:58:54 -07:00
if ( qs . type ) {
qs . type = ( qs . type as string [ ] ) . join ( ',' ) ;
}
2021-06-06 11:54:49 -07:00
2022-12-29 03:20:43 -08:00
endpoint = '/activities' ;
2021-07-19 23:58:54 -07:00
} else if ( operation === 'update' ) {
// ----------------------------------
// activity:update
// ----------------------------------
2019-08-27 23:20:53 -07:00
2021-07-19 23:58:54 -07:00
requestMethod = 'PUT' ;
2019-06-23 12:21:44 -07:00
2021-07-19 23:58:54 -07:00
const activityId = this . getNodeParameter ( 'activityId' , i ) as number ;
endpoint = ` /activities/ ${ activityId } ` ;
2019-06-23 12:21:44 -07:00
2022-11-18 07:29:44 -08:00
const updateFields = this . getNodeParameter ( 'updateFields' , i ) ;
2021-07-19 23:58:54 -07:00
addAdditionalFields ( body , updateFields ) ;
}
} else if ( resource === 'deal' ) {
if ( operation === 'create' ) {
// ----------------------------------
// deal:create
// ----------------------------------
2019-06-23 12:21:44 -07:00
2021-07-19 23:58:54 -07:00
requestMethod = 'POST' ;
endpoint = '/deals' ;
2019-06-23 12:21:44 -07:00
2021-07-19 23:58:54 -07:00
body . title = this . getNodeParameter ( 'title' , i ) as string ;
2021-07-20 06:53:10 -07:00
2022-08-17 08:50:24 -07:00
const associateWith = this . getNodeParameter ( 'associateWith' , i ) as
| 'organization'
| 'person' ;
2021-07-20 06:53:10 -07:00
if ( associateWith === 'organization' ) {
body . org_id = this . getNodeParameter ( 'org_id' , i ) as string ;
} else {
body . person_id = this . getNodeParameter ( 'person_id' , i ) as string ;
}
2022-11-18 07:29:44 -08:00
const additionalFields = this . getNodeParameter ( 'additionalFields' , i ) ;
2021-07-19 23:58:54 -07:00
addAdditionalFields ( body , additionalFields ) ;
} else if ( operation === 'delete' ) {
// ----------------------------------
// deal:delete
// ----------------------------------
2019-06-23 12:21:44 -07:00
2021-07-19 23:58:54 -07:00
requestMethod = 'DELETE' ;
2019-06-23 12:21:44 -07:00
2021-07-19 23:58:54 -07:00
const dealId = this . getNodeParameter ( 'dealId' , i ) as number ;
endpoint = ` /deals/ ${ dealId } ` ;
} else if ( operation === 'duplicate' ) {
// ----------------------------------
// deal:duplicate
// ----------------------------------
2019-07-10 01:16:48 -07:00
2021-07-19 23:58:54 -07:00
requestMethod = 'POST' ;
2019-11-02 13:41:13 -07:00
2021-07-19 23:58:54 -07:00
const dealId = this . getNodeParameter ( 'dealId' , i ) as number ;
endpoint = ` /deals/ ${ dealId } /duplicate ` ;
} else if ( operation === 'get' ) {
// ----------------------------------
// deal:get
// ----------------------------------
2019-11-02 13:41:13 -07:00
2021-07-19 23:58:54 -07:00
requestMethod = 'GET' ;
2019-07-10 01:16:48 -07:00
2021-07-19 23:58:54 -07:00
const dealId = this . getNodeParameter ( 'dealId' , i ) as number ;
endpoint = ` /deals/ ${ dealId } ` ;
} else if ( operation === 'getAll' ) {
// ----------------------------------
// deal:getAll
// ----------------------------------
2019-06-23 12:21:44 -07:00
2021-07-19 23:58:54 -07:00
requestMethod = 'GET' ;
2019-08-27 23:20:53 -07:00
2022-11-18 05:31:38 -08:00
returnAll = this . getNodeParameter ( 'returnAll' , i ) ;
2022-12-02 12:54:28 -08:00
if ( ! returnAll ) {
2022-11-18 06:26:22 -08:00
qs . limit = this . getNodeParameter ( 'limit' , i ) ;
2021-07-19 23:58:54 -07:00
}
2022-11-18 07:29:44 -08:00
const filters = this . getNodeParameter ( 'filters' , i ) ;
2021-08-13 01:22:00 -07:00
addAdditionalFields ( qs , filters ) ;
2019-08-27 23:20:53 -07:00
2022-12-29 03:20:43 -08:00
endpoint = '/deals' ;
2021-07-19 23:58:54 -07:00
} else if ( operation === 'update' ) {
// ----------------------------------
// deal:update
// ----------------------------------
2019-08-27 23:20:53 -07:00
2021-07-19 23:58:54 -07:00
requestMethod = 'PUT' ;
2019-06-23 12:21:44 -07:00
2021-07-19 23:58:54 -07:00
const dealId = this . getNodeParameter ( 'dealId' , i ) as number ;
endpoint = ` /deals/ ${ dealId } ` ;
2019-06-23 12:21:44 -07:00
2022-11-18 07:29:44 -08:00
const updateFields = this . getNodeParameter ( 'updateFields' , i ) ;
2021-07-19 23:58:54 -07:00
addAdditionalFields ( body , updateFields ) ;
2019-07-09 23:40:59 -07:00
2021-07-19 23:58:54 -07:00
if ( body . label === 'null' ) {
body . label = null ;
}
} else if ( operation === 'search' ) {
// ----------------------------------
// deal:search
// ----------------------------------
requestMethod = 'GET' ;
qs . term = this . getNodeParameter ( 'term' , i ) as string ;
2022-11-18 05:31:38 -08:00
returnAll = this . getNodeParameter ( 'returnAll' , i ) ;
2021-07-19 23:58:54 -07:00
qs . exact_match = this . getNodeParameter ( 'exactMatch' , i ) as boolean ;
2022-12-02 12:54:28 -08:00
if ( ! returnAll ) {
2022-11-18 06:26:22 -08:00
qs . limit = this . getNodeParameter ( 'limit' , i ) ;
2021-07-19 23:58:54 -07:00
}
2019-07-09 23:40:59 -07:00
2022-11-18 07:29:44 -08:00
const additionalFields = this . getNodeParameter ( 'additionalFields' , i ) ;
2021-06-06 11:54:49 -07:00
2021-07-19 23:58:54 -07:00
if ( additionalFields . fields ) {
qs . fields = ( additionalFields . fields as string [ ] ) . join ( ',' ) ;
}
2021-06-06 11:54:49 -07:00
2021-07-19 23:58:54 -07:00
if ( additionalFields . organizationId ) {
qs . organization_id = parseInt ( additionalFields . organizationId as string , 10 ) ;
}
2021-06-06 11:54:49 -07:00
2021-07-19 23:58:54 -07:00
if ( additionalFields . includeFields ) {
qs . include_fields = additionalFields . includeFields as string ;
}
2021-06-06 11:54:49 -07:00
2021-07-19 23:58:54 -07:00
if ( additionalFields . personId ) {
qs . person_id = parseInt ( additionalFields . personId as string , 10 ) ;
}
if ( additionalFields . status ) {
qs . status = additionalFields . status as string ;
}
2022-12-29 03:20:43 -08:00
endpoint = '/deals/search' ;
2021-06-06 11:54:49 -07:00
}
2021-09-16 10:09:19 -07:00
} else if ( resource === 'dealActivity' ) {
2022-08-17 08:50:24 -07:00
if ( operation === 'getAll' ) {
2021-09-16 10:09:19 -07:00
// ----------------------------------
// dealActivity: getAll
// ----------------------------------
requestMethod = 'GET' ;
const dealId = this . getNodeParameter ( 'dealId' , i ) as string ;
2022-11-18 05:31:38 -08:00
returnAll = this . getNodeParameter ( 'returnAll' , i ) ;
2021-09-16 10:09:19 -07:00
2022-12-02 12:54:28 -08:00
if ( ! returnAll ) {
2022-11-18 06:26:22 -08:00
qs . limit = this . getNodeParameter ( 'limit' , i ) ;
2021-09-16 10:09:19 -07:00
}
2022-11-18 07:29:44 -08:00
const additionalFields = this . getNodeParameter ( 'additionalFields' , i ) ;
2021-09-16 10:09:19 -07:00
if ( additionalFields . exclude ) {
2022-08-17 08:50:24 -07:00
qs . exclude = additionalFields . exclude as string ;
2021-09-16 10:09:19 -07:00
}
2022-12-02 12:54:28 -08:00
if ( additionalFields ? . done !== undefined ) {
2021-10-09 12:32:51 -07:00
qs . done = additionalFields . done === true ? 1 : 0 ;
2021-09-16 10:09:19 -07:00
}
endpoint = ` /deals/ ${ dealId } /activities ` ;
}
2021-08-01 12:19:41 -07:00
} else if ( resource === 'dealProduct' ) {
if ( operation === 'add' ) {
// ----------------------------------
// dealProduct: add
// ----------------------------------
requestMethod = 'POST' ;
const dealId = this . getNodeParameter ( 'dealId' , i ) as string ;
endpoint = ` /deals/ ${ dealId } /products ` ;
2022-08-17 08:50:24 -07:00
body . product_id = this . getNodeParameter ( 'productId' , i ) as string ;
2021-08-01 12:19:41 -07:00
body . item_price = this . getNodeParameter ( 'item_price' , i ) as string ;
body . quantity = this . getNodeParameter ( 'quantity' , i ) as string ;
2022-11-18 07:29:44 -08:00
const additionalFields = this . getNodeParameter ( 'additionalFields' , i ) ;
2021-08-01 12:19:41 -07:00
addAdditionalFields ( body , additionalFields ) ;
} else if ( operation === 'getAll' ) {
// ----------------------------------
// dealProduct: getAll
// ----------------------------------
requestMethod = 'GET' ;
const dealId = this . getNodeParameter ( 'dealId' , i ) as string ;
endpoint = ` /deals/ ${ dealId } /products ` ;
} else if ( operation === 'remove' ) {
// ----------------------------------
// dealProduct: remove
// ----------------------------------
requestMethod = 'DELETE' ;
const dealId = this . getNodeParameter ( 'dealId' , i ) as string ;
const productAttachmentId = this . getNodeParameter ( 'productAttachmentId' , i ) as string ;
endpoint = ` /deals/ ${ dealId } /products/ ${ productAttachmentId } ` ;
} else if ( operation === 'update' ) {
// ----------------------------------
// dealProduct: update
// ----------------------------------
requestMethod = 'PUT' ;
const dealId = this . getNodeParameter ( 'dealId' , i ) as string ;
const productAttachmentId = this . getNodeParameter ( 'productAttachmentId' , i ) as string ;
endpoint = ` /deals/ ${ dealId } /products/ ${ productAttachmentId } ` ;
2022-11-18 07:29:44 -08:00
const updateFields = this . getNodeParameter ( 'updateFields' , i ) ;
2021-08-01 12:19:41 -07:00
addAdditionalFields ( body , updateFields ) ;
}
2021-07-19 23:58:54 -07:00
} else if ( resource === 'file' ) {
if ( operation === 'create' ) {
// ----------------------------------
// file:create
// ----------------------------------
requestMethod = 'POST' ;
endpoint = '/files' ;
2021-06-06 11:54:49 -07:00
2023-01-06 06:09:32 -08:00
const binaryPropertyName = this . getNodeParameter ( 'binaryPropertyName' , i ) ;
2023-03-06 08:33:32 -08:00
const binaryData = this . helpers . assertBinaryData ( i , binaryPropertyName ) ;
2022-01-03 13:42:42 -08:00
const fileBufferData = await this . helpers . getBinaryDataBuffer ( i , binaryPropertyName ) ;
2019-09-03 14:06:03 -07:00
2021-07-19 23:58:54 -07:00
formData . file = {
value : fileBufferData ,
options : {
2023-03-06 08:33:32 -08:00
contentType : binaryData.mimeType ,
filename : binaryData.fileName ,
2021-07-19 23:58:54 -07:00
} ,
} ;
2019-09-03 14:06:03 -07:00
2022-11-18 07:29:44 -08:00
const additionalFields = this . getNodeParameter ( 'additionalFields' , i ) ;
2021-07-19 23:58:54 -07:00
addAdditionalFields ( formData , additionalFields ) ;
} else if ( operation === 'delete' ) {
// ----------------------------------
// file:delete
// ----------------------------------
2019-09-03 14:06:03 -07:00
2021-07-19 23:58:54 -07:00
requestMethod = 'DELETE' ;
2019-09-03 14:06:03 -07:00
2021-07-19 23:58:54 -07:00
const fileId = this . getNodeParameter ( 'fileId' , i ) as number ;
endpoint = ` /files/ ${ fileId } ` ;
} else if ( operation === 'download' ) {
// ----------------------------------
// file:download
// ----------------------------------
2019-09-03 14:06:03 -07:00
2021-07-19 23:58:54 -07:00
requestMethod = 'GET' ;
downloadFile = true ;
2019-09-03 14:06:03 -07:00
2021-07-19 23:58:54 -07:00
const fileId = this . getNodeParameter ( 'fileId' , i ) as number ;
endpoint = ` /files/ ${ fileId } /download ` ;
} else if ( operation === 'get' ) {
// ----------------------------------
// file:get
// ----------------------------------
2019-09-03 14:06:03 -07:00
2021-07-19 23:58:54 -07:00
requestMethod = 'GET' ;
2019-09-03 14:06:03 -07:00
2021-07-19 23:58:54 -07:00
const fileId = this . getNodeParameter ( 'fileId' , i ) as number ;
endpoint = ` /files/ ${ fileId } ` ;
2023-08-09 02:54:20 -07:00
} else if ( operation === 'update' ) {
// ----------------------------------
// file:update
// ----------------------------------
requestMethod = 'PUT' ;
const fileId = this . getNodeParameter ( 'fileId' , i ) as number ;
const updateFields = this . getNodeParameter ( 'updateFields' , i ) ;
endpoint = ` /files/ ${ fileId } ` ;
addAdditionalFields ( body , updateFields ) ;
2021-07-19 23:58:54 -07:00
}
} else if ( resource === 'note' ) {
if ( operation === 'create' ) {
// ----------------------------------
// note:create
// ----------------------------------
2019-09-03 14:06:03 -07:00
2021-07-19 23:58:54 -07:00
requestMethod = 'POST' ;
endpoint = '/notes' ;
2019-09-03 14:06:03 -07:00
2021-07-19 23:58:54 -07:00
body . content = this . getNodeParameter ( 'content' , i ) as string ;
2022-11-18 07:29:44 -08:00
const additionalFields = this . getNodeParameter ( 'additionalFields' , i ) ;
2021-07-19 23:58:54 -07:00
addAdditionalFields ( body , additionalFields ) ;
} else if ( operation === 'delete' ) {
// ----------------------------------
// note:delete
// ----------------------------------
2019-09-02 13:26:42 -07:00
2021-07-19 23:58:54 -07:00
requestMethod = 'DELETE' ;
2019-09-02 13:26:42 -07:00
2021-07-19 23:58:54 -07:00
const noteId = this . getNodeParameter ( 'noteId' , i ) as number ;
endpoint = ` /notes/ ${ noteId } ` ;
} else if ( operation === 'get' ) {
// ----------------------------------
// note:get
// ----------------------------------
2019-09-02 13:26:42 -07:00
2021-07-19 23:58:54 -07:00
requestMethod = 'GET' ;
2019-09-02 13:26:42 -07:00
2021-07-19 23:58:54 -07:00
const noteId = this . getNodeParameter ( 'noteId' , i ) as number ;
endpoint = ` /notes/ ${ noteId } ` ;
} else if ( operation === 'getAll' ) {
// ----------------------------------
// note:getAll
// ----------------------------------
2019-09-02 13:26:42 -07:00
2021-07-19 23:58:54 -07:00
requestMethod = 'GET' ;
2022-12-29 03:20:43 -08:00
endpoint = '/notes' ;
2019-09-02 13:26:42 -07:00
2022-11-18 05:31:38 -08:00
returnAll = this . getNodeParameter ( 'returnAll' , i ) ;
2022-12-02 12:54:28 -08:00
if ( ! returnAll ) {
2022-11-18 06:26:22 -08:00
qs . limit = this . getNodeParameter ( 'limit' , i ) ;
2021-07-19 23:58:54 -07:00
}
2022-11-18 07:29:44 -08:00
const additionalFields = this . getNodeParameter ( 'additionalFields' , i ) ;
2021-07-19 23:58:54 -07:00
addAdditionalFields ( qs , additionalFields ) ;
} else if ( operation === 'update' ) {
// ----------------------------------
// note:update
// ----------------------------------
2019-09-02 13:26:42 -07:00
2021-07-19 23:58:54 -07:00
requestMethod = 'PUT' ;
2019-09-02 13:26:42 -07:00
2021-07-19 23:58:54 -07:00
const noteId = this . getNodeParameter ( 'noteId' , i ) as number ;
endpoint = ` /notes/ ${ noteId } ` ;
2019-09-02 13:26:42 -07:00
2022-11-18 07:29:44 -08:00
const updateFields = this . getNodeParameter ( 'updateFields' , i ) ;
2021-07-19 23:58:54 -07:00
addAdditionalFields ( body , updateFields ) ;
}
2021-07-20 06:53:10 -07:00
} else if ( resource === 'lead' ) {
if ( operation === 'create' ) {
// ----------------------------------------
// lead: create
// ----------------------------------------
// https://developers.pipedrive.com/docs/api/v1/Leads#addLead
body = {
title : this.getNodeParameter ( 'title' , i ) ,
} as IDataObject ;
2022-08-17 08:50:24 -07:00
const associateWith = this . getNodeParameter ( 'associateWith' , i ) as
| 'organization'
| 'person' ;
2021-07-20 06:53:10 -07:00
if ( associateWith === 'organization' ) {
body . organization_id = this . getNodeParameter ( 'organization_id' , i ) as number ;
} else {
body . person_id = this . getNodeParameter ( 'person_id' , i ) as number ;
}
2022-08-17 08:50:24 -07:00
const { value , expected_close_date , . . . rest } = this . getNodeParameter (
'additionalFields' ,
i ,
) as {
2021-07-20 06:53:10 -07:00
value : {
valueProperties : {
amount : number ;
currency : string ;
2022-08-17 08:50:24 -07:00
} ;
2021-07-20 06:53:10 -07:00
} ;
expected_close_date : string ;
2022-08-17 08:50:24 -07:00
person_id : number ;
organization_id : number ;
2021-07-20 06:53:10 -07:00
} ;
if ( Object . keys ( rest ) . length ) {
Object . assign ( body , rest ) ;
}
if ( value ) {
Object . assign ( body , { value : value.valueProperties } ) ;
}
if ( expected_close_date ) {
body . expected_close_date = expected_close_date . split ( 'T' ) [ 0 ] ;
}
requestMethod = 'POST' ;
endpoint = '/leads' ;
} else if ( operation === 'delete' ) {
// ----------------------------------------
// lead: delete
// ----------------------------------------
// https://developers.pipedrive.com/docs/api/v1/Leads#deleteLead
const leadId = this . getNodeParameter ( 'leadId' , i ) ;
requestMethod = 'DELETE' ;
endpoint = ` /leads/ ${ leadId } ` ;
} else if ( operation === 'get' ) {
// ----------------------------------------
// lead: get
// ----------------------------------------
// https://developers.pipedrive.com/docs/api/v1/Leads#getLead
const leadId = this . getNodeParameter ( 'leadId' , i ) ;
requestMethod = 'GET' ;
endpoint = ` /leads/ ${ leadId } ` ;
} else if ( operation === 'getAll' ) {
// ----------------------------------------
// lead: getAll
// ----------------------------------------
// https://developers.pipedrive.com/docs/api/v1/Leads#getLeads
2022-11-18 05:31:38 -08:00
returnAll = this . getNodeParameter ( 'returnAll' , i ) ;
2022-12-02 12:54:28 -08:00
if ( ! returnAll ) {
2022-11-18 06:26:22 -08:00
qs . limit = this . getNodeParameter ( 'limit' , i ) ;
2022-06-13 12:39:20 -07:00
}
2022-11-18 07:29:44 -08:00
const filters = this . getNodeParameter ( 'filters' , i ) ;
2021-07-20 06:53:10 -07:00
if ( Object . keys ( filters ) . length ) {
Object . assign ( qs , filters ) ;
}
requestMethod = 'GET' ;
endpoint = '/leads' ;
} else if ( operation === 'update' ) {
// ----------------------------------------
// lead: update
// ----------------------------------------
// https://developers.pipedrive.com/docs/api/v1/Leads#updateLead
2022-08-17 08:50:24 -07:00
const { value , expected_close_date , . . . rest } = this . getNodeParameter (
'updateFields' ,
i ,
) as {
2021-07-20 06:53:10 -07:00
value : {
valueProperties : {
amount : number ;
currency : string ;
2022-08-17 08:50:24 -07:00
} ;
2021-07-20 06:53:10 -07:00
} ;
expected_close_date : string ;
} ;
if ( Object . keys ( rest ) . length ) {
Object . assign ( body , rest ) ;
}
if ( value ) {
Object . assign ( body , { value : value.valueProperties } ) ;
}
if ( expected_close_date ) {
body . expected_close_date = expected_close_date . split ( 'T' ) [ 0 ] ;
}
if ( Object . keys ( rest ) . length ) {
Object . assign ( body , rest ) ;
}
const leadId = this . getNodeParameter ( 'leadId' , i ) ;
requestMethod = 'PATCH' ;
endpoint = ` /leads/ ${ leadId } ` ;
}
2021-07-19 23:58:54 -07:00
} else if ( resource === 'organization' ) {
if ( operation === 'create' ) {
// ----------------------------------
// organization:create
// ----------------------------------
2019-09-02 13:26:42 -07:00
2021-07-19 23:58:54 -07:00
requestMethod = 'POST' ;
endpoint = '/organizations' ;
2019-09-02 13:26:42 -07:00
2021-07-19 23:58:54 -07:00
body . name = this . getNodeParameter ( 'name' , i ) as string ;
2022-11-18 07:29:44 -08:00
const additionalFields = this . getNodeParameter ( 'additionalFields' , i ) ;
2021-07-19 23:58:54 -07:00
addAdditionalFields ( body , additionalFields ) ;
} else if ( operation === 'delete' ) {
// ----------------------------------
// organization:delete
// ----------------------------------
2019-07-09 23:40:59 -07:00
2021-07-19 23:58:54 -07:00
requestMethod = 'DELETE' ;
2019-06-23 12:21:44 -07:00
2021-07-19 23:58:54 -07:00
const organizationId = this . getNodeParameter ( 'organizationId' , i ) as number ;
endpoint = ` /organizations/ ${ organizationId } ` ;
} else if ( operation === 'get' ) {
// ----------------------------------
// organization:get
// ----------------------------------
2019-06-23 12:21:44 -07:00
2021-07-19 23:58:54 -07:00
requestMethod = 'GET' ;
2019-09-03 14:06:03 -07:00
2021-07-19 23:58:54 -07:00
const organizationId = this . getNodeParameter ( 'organizationId' , i ) as number ;
endpoint = ` /organizations/ ${ organizationId } ` ;
} else if ( operation === 'getAll' ) {
// ----------------------------------
// organization:getAll
// ----------------------------------
2019-07-09 23:40:59 -07:00
2021-07-19 23:58:54 -07:00
requestMethod = 'GET' ;
2019-07-09 23:40:59 -07:00
2022-11-18 05:31:38 -08:00
returnAll = this . getNodeParameter ( 'returnAll' , i ) ;
2022-12-02 12:54:28 -08:00
if ( ! returnAll ) {
2022-11-18 06:26:22 -08:00
qs . limit = this . getNodeParameter ( 'limit' , i ) ;
2021-07-19 23:58:54 -07:00
}
2019-07-09 23:40:59 -07:00
2022-11-18 07:29:44 -08:00
const filters = this . getNodeParameter ( 'filters' , i ) ;
2022-05-06 08:42:26 -07:00
if ( filters . filterId ) {
qs . filter_id = filters . filterId as string ;
}
if ( filters . firstChar ) {
qs . first_char = filters . firstChar as string ;
qs . first_char = qs . first_char . substring ( 0 , 1 ) ;
}
2022-12-29 03:20:43 -08:00
endpoint = '/organizations' ;
2021-07-24 01:34:29 -07:00
} else if ( operation === 'update' ) {
2021-07-19 23:58:54 -07:00
// ----------------------------------
// organization:update
// ----------------------------------
2019-06-23 12:21:44 -07:00
2021-07-19 23:58:54 -07:00
const id = this . getNodeParameter ( 'organizationId' , i ) as string ;
2019-06-23 12:21:44 -07:00
2021-07-19 23:58:54 -07:00
requestMethod = 'PUT' ;
endpoint = ` /organizations/ ${ id } ` ;
2020-12-07 14:44:10 -08:00
2022-11-18 07:29:44 -08:00
const updateFields = this . getNodeParameter ( 'updateFields' , i ) ;
2021-07-19 23:58:54 -07:00
addAdditionalFields ( body , updateFields ) ;
2020-12-07 14:44:10 -08:00
2021-07-19 23:58:54 -07:00
if ( body . label === 'null' ) {
body . label = null ;
}
2021-07-24 01:34:29 -07:00
} else if ( operation === 'search' ) {
// ----------------------------------
// organization:search
// ----------------------------------
requestMethod = 'GET' ;
qs . term = this . getNodeParameter ( 'term' , i ) as string ;
2022-11-18 05:31:38 -08:00
returnAll = this . getNodeParameter ( 'returnAll' , i ) ;
2022-12-02 12:54:28 -08:00
if ( ! returnAll ) {
2022-11-18 06:26:22 -08:00
qs . limit = this . getNodeParameter ( 'limit' , i ) ;
2021-07-24 01:34:29 -07:00
}
const additionalFields = this . getNodeParameter ( 'additionalFields' , i ) as IDataObject & {
fields? : string [ ] ;
} ;
if ( additionalFields ? . fields ? . length ) {
qs . fields = additionalFields . fields . join ( ',' ) ;
}
if ( additionalFields . exactMatch ) {
qs . exact_match = additionalFields . exactMatch as boolean ;
}
2022-12-29 03:20:43 -08:00
endpoint = '/organizations/search' ;
2020-12-07 14:44:10 -08:00
}
2021-07-19 23:58:54 -07:00
} else if ( resource === 'person' ) {
if ( operation === 'create' ) {
// ----------------------------------
// person:create
// ----------------------------------
2020-12-07 14:44:10 -08:00
2021-07-19 23:58:54 -07:00
requestMethod = 'POST' ;
endpoint = '/persons' ;
2019-06-23 12:21:44 -07:00
2021-07-19 23:58:54 -07:00
body . name = this . getNodeParameter ( 'name' , i ) as string ;
2022-11-18 07:29:44 -08:00
const additionalFields = this . getNodeParameter ( 'additionalFields' , i ) ;
2021-07-19 23:58:54 -07:00
addAdditionalFields ( body , additionalFields ) ;
} else if ( operation === 'delete' ) {
// ----------------------------------
// person:delete
// ----------------------------------
2019-06-23 12:21:44 -07:00
2021-07-19 23:58:54 -07:00
requestMethod = 'DELETE' ;
2019-07-09 23:40:59 -07:00
2021-07-19 23:58:54 -07:00
const personId = this . getNodeParameter ( 'personId' , i ) as number ;
endpoint = ` /persons/ ${ personId } ` ;
} else if ( operation === 'get' ) {
// ----------------------------------
// person:get
// ----------------------------------
2019-07-09 23:40:59 -07:00
2021-07-19 23:58:54 -07:00
requestMethod = 'GET' ;
2019-06-23 12:21:44 -07:00
2021-07-19 23:58:54 -07:00
const personId = this . getNodeParameter ( 'personId' , i ) as number ;
endpoint = ` /persons/ ${ personId } ` ;
} else if ( operation === 'getAll' ) {
// ----------------------------------
2021-08-13 01:22:00 -07:00
// person:getAll
2021-07-19 23:58:54 -07:00
// ----------------------------------
2019-06-23 12:21:44 -07:00
2021-07-19 23:58:54 -07:00
requestMethod = 'GET' ;
2019-06-23 12:21:44 -07:00
2022-11-18 05:31:38 -08:00
returnAll = this . getNodeParameter ( 'returnAll' , i ) ;
2022-12-02 12:54:28 -08:00
if ( ! returnAll ) {
2022-11-18 06:26:22 -08:00
qs . limit = this . getNodeParameter ( 'limit' , i ) ;
2021-07-19 23:58:54 -07:00
}
2019-06-23 12:21:44 -07:00
2022-11-18 07:29:44 -08:00
const additionalFields = this . getNodeParameter ( 'additionalFields' , i ) ;
2019-06-23 12:21:44 -07:00
2021-07-19 23:58:54 -07:00
if ( additionalFields . filterId ) {
qs . filter_id = additionalFields . filterId as string ;
}
2020-07-23 13:51:05 -07:00
2021-07-19 23:58:54 -07:00
if ( additionalFields . firstChar ) {
qs . first_char = additionalFields . firstChar as string ;
}
2020-07-23 13:51:05 -07:00
2022-12-29 03:20:43 -08:00
endpoint = '/persons' ;
2021-07-19 23:58:54 -07:00
} else if ( operation === 'search' ) {
// ----------------------------------
// persons:search
// ----------------------------------
2019-06-23 12:21:44 -07:00
2021-07-19 23:58:54 -07:00
requestMethod = 'GET' ;
2020-07-23 13:51:05 -07:00
2021-07-19 23:58:54 -07:00
qs . term = this . getNodeParameter ( 'term' , i ) as string ;
2022-11-18 05:31:38 -08:00
returnAll = this . getNodeParameter ( 'returnAll' , i ) ;
2022-12-02 12:54:28 -08:00
if ( ! returnAll ) {
2022-11-18 06:26:22 -08:00
qs . limit = this . getNodeParameter ( 'limit' , i ) ;
2021-07-19 23:58:54 -07:00
}
2020-07-23 13:51:05 -07:00
2022-11-18 07:29:44 -08:00
const additionalFields = this . getNodeParameter ( 'additionalFields' , i ) ;
2020-07-23 13:51:05 -07:00
2021-07-19 23:58:54 -07:00
if ( additionalFields . fields ) {
qs . fields = additionalFields . fields as string ;
}
2020-07-23 13:51:05 -07:00
2021-07-19 23:58:54 -07:00
if ( additionalFields . exactMatch ) {
qs . exact_match = additionalFields . exactMatch as boolean ;
}
2020-07-23 13:51:05 -07:00
2021-07-19 23:58:54 -07:00
if ( additionalFields . organizationId ) {
qs . organization_id = parseInt ( additionalFields . organizationId as string , 10 ) ;
}
2020-07-23 13:51:05 -07:00
2021-07-19 23:58:54 -07:00
if ( additionalFields . includeFields ) {
qs . include_fields = additionalFields . includeFields as string ;
}
2020-07-23 13:51:05 -07:00
2022-12-29 03:20:43 -08:00
endpoint = '/persons/search' ;
2021-07-19 23:58:54 -07:00
} else if ( operation === 'update' ) {
// ----------------------------------
// person:update
// ----------------------------------
2020-07-23 13:51:05 -07:00
2021-07-19 23:58:54 -07:00
requestMethod = 'PUT' ;
2019-06-23 12:21:44 -07:00
2021-07-19 23:58:54 -07:00
const personId = this . getNodeParameter ( 'personId' , i ) as number ;
endpoint = ` /persons/ ${ personId } ` ;
2019-06-23 12:21:44 -07:00
2022-11-18 07:29:44 -08:00
const updateFields = this . getNodeParameter ( 'updateFields' , i ) ;
2021-07-19 23:58:54 -07:00
addAdditionalFields ( body , updateFields ) ;
2019-06-23 12:21:44 -07:00
2021-07-19 23:58:54 -07:00
if ( body . label === 'null' ) {
body . label = null ;
}
2020-12-07 14:44:10 -08:00
}
2021-07-19 23:58:54 -07:00
} else if ( resource === 'product' ) {
if ( operation === 'getAll' ) {
// ----------------------------------
// product:getAll
// ----------------------------------
2020-12-07 14:44:10 -08:00
2021-07-19 23:58:54 -07:00
requestMethod = 'GET' ;
2022-11-18 05:31:38 -08:00
returnAll = this . getNodeParameter ( 'returnAll' , i ) ;
2022-12-02 12:54:28 -08:00
if ( ! returnAll ) {
2022-11-18 06:26:22 -08:00
qs . limit = this . getNodeParameter ( 'limit' , i ) ;
2021-07-19 23:58:54 -07:00
}
2019-06-23 12:21:44 -07:00
2022-12-29 03:20:43 -08:00
endpoint = '/products' ;
2019-07-14 08:57:08 -07:00
}
2021-07-19 23:58:54 -07:00
} else {
2022-08-17 08:50:24 -07:00
throw new NodeOperationError ( this . getNode ( ) , ` The resource " ${ resource } " is not known! ` , {
itemIndex : i ,
} ) ;
2021-07-19 23:58:54 -07:00
}
2019-06-23 12:21:44 -07:00
2021-07-19 23:58:54 -07:00
let responseData ;
2022-12-02 12:54:28 -08:00
if ( returnAll ) {
2022-08-17 08:50:24 -07:00
responseData = await pipedriveApiRequestAllItems . call (
this ,
requestMethod ,
endpoint ,
body ,
qs ,
) ;
2021-07-19 23:58:54 -07:00
} else {
if ( customProperties !== undefined ) {
2022-12-02 12:54:28 -08:00
pipedriveEncodeCustomProperties ( customProperties , body ) ;
2021-07-19 23:58:54 -07:00
}
2020-07-23 13:51:05 -07:00
2022-08-17 08:50:24 -07:00
responseData = await pipedriveApiRequest . call (
this ,
requestMethod ,
endpoint ,
body ,
qs ,
formData ,
downloadFile ,
) ;
2019-10-22 02:30:35 -07:00
}
2021-07-19 23:58:54 -07:00
if ( resource === 'file' && operation === 'download' ) {
const newItem : INodeExecutionData = {
json : items [ i ] . json ,
2023-10-10 08:36:20 -07:00
pairedItem : { item : i } ,
2021-07-19 23:58:54 -07:00
binary : { } ,
} ;
2020-07-23 13:51:05 -07:00
2021-07-19 23:58:54 -07:00
if ( items [ i ] . binary !== undefined ) {
// Create a shallow copy of the binary data so that the old
// data references which do not get changed still stay behind
// but the incoming data does not get changed.
2022-08-30 08:55:33 -07:00
Object . assign ( newItem . binary ! , items [ i ] . binary ) ;
2021-07-19 23:58:54 -07:00
}
2019-06-23 12:21:44 -07:00
2021-07-19 23:58:54 -07:00
items [ i ] = newItem ;
2019-09-03 14:06:03 -07:00
2023-01-06 06:09:32 -08:00
const binaryPropertyName = this . getNodeParameter ( 'binaryPropertyName' , i ) ;
2019-09-03 14:06:03 -07:00
2022-08-17 08:50:24 -07:00
items [ i ] . binary ! [ binaryPropertyName ] = await this . helpers . prepareBinaryData (
2023-02-27 19:39:43 -08:00
responseData . data as Buffer ,
2022-08-17 08:50:24 -07:00
) ;
2021-07-19 23:58:54 -07:00
} else {
if ( responseData . data === null ) {
responseData . data = [ ] ;
}
2020-07-23 13:51:05 -07:00
2023-08-09 02:54:20 -07:00
if ( operation === 'search' && responseData . data ? . items ) {
2021-07-19 23:58:54 -07:00
responseData . data = responseData . data . items ;
2022-11-18 07:29:44 -08:00
const additionalFields = this . getNodeParameter ( 'additionalFields' , i ) ;
2021-07-19 23:58:54 -07:00
if ( additionalFields . rawData !== true ) {
2022-08-17 08:50:24 -07:00
responseData . data = responseData . data . map (
( item : { result_score : number ; item : object } ) = > {
return {
result_score : item.result_score ,
. . . item . item ,
} ;
} ,
) ;
2021-07-19 23:58:54 -07:00
}
}
2020-07-23 13:51:05 -07:00
2022-08-30 08:55:33 -07:00
responseData = responseData . data ;
if ( responseData . data === true ) {
2022-11-18 05:31:38 -08:00
responseData = { success : true } ;
2020-07-23 13:51:05 -07:00
}
2022-08-30 08:55:33 -07:00
const executionData = this . helpers . constructExecutionMetaData (
2023-02-27 19:39:43 -08:00
this . helpers . returnJsonArray ( responseData as IDataObject [ ] ) ,
2022-08-30 08:55:33 -07:00
{ itemData : { item : i } } ,
) ;
returnData . push ( . . . executionData ) ;
2020-07-23 13:51:05 -07:00
}
2021-10-09 12:32:51 -07:00
} catch ( error ) {
2021-07-19 23:58:54 -07:00
if ( this . continueOnFail ( ) ) {
if ( resource === 'file' && operation === 'download' ) {
items [ i ] . json = { error : error.message } ;
} else {
2023-10-10 08:36:20 -07:00
returnData . push ( { json : { error : error.message } , pairedItem : { item : i } } ) ;
2021-07-19 23:58:54 -07:00
}
continue ;
2019-09-03 14:06:03 -07:00
}
2021-07-19 23:58:54 -07:00
throw error ;
2019-06-23 12:21:44 -07:00
}
}
2019-10-22 02:30:35 -07:00
if ( customProperties !== undefined ) {
for ( const item of returnData ) {
2022-12-01 08:01:32 -08:00
pipedriveResolveCustomProperties ( customProperties , item ) ;
2019-08-27 23:20:53 -07:00
}
}
2019-09-03 14:06:03 -07:00
if ( resource === 'file' && operation === 'download' ) {
// For file downloads the files get attached to the existing items
2023-09-05 03:59:02 -07:00
return [ items ] ;
2019-09-03 14:06:03 -07:00
} else {
// For all other ones does the output items get replaced
2023-09-05 03:59:02 -07:00
return [ returnData ] ;
2019-09-03 14:06:03 -07:00
}
2019-06-23 12:21:44 -07:00
}
}