2023-01-27 03:22:44 -08:00
|
|
|
import type { INodeProperties } from 'n8n-workflow';
|
2019-11-21 09:39:04 -08:00
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export const companyOperations: INodeProperties[] = [
|
2019-11-21 09:39:04 -08:00
|
|
|
{
|
|
|
|
displayName: 'Operation',
|
|
|
|
name: 'operation',
|
|
|
|
type: 'options',
|
2022-05-20 14:47:24 -07:00
|
|
|
noDataExpression: true,
|
2019-11-21 09:39:04 -08:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
resource: ['company'],
|
2019-11-21 09:39:04 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Create',
|
|
|
|
value: 'create',
|
|
|
|
description: 'Create a new company',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Create a company',
|
2019-11-21 09:39:04 -08:00
|
|
|
},
|
|
|
|
{
|
2019-11-22 14:04:06 -08:00
|
|
|
name: 'Get',
|
|
|
|
value: 'get',
|
|
|
|
description: 'Get data of a company',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Get a company',
|
2019-11-21 09:39:04 -08:00
|
|
|
},
|
|
|
|
{
|
2022-09-07 07:51:14 -07:00
|
|
|
name: 'Get Many',
|
2019-11-22 14:04:06 -08:00
|
|
|
value: 'getAll',
|
2022-09-13 03:36:36 -07:00
|
|
|
description: 'Get data of many companies',
|
2022-09-08 08:10:13 -07:00
|
|
|
action: 'Get many companies',
|
2019-11-21 09:39:04 -08:00
|
|
|
},
|
|
|
|
{
|
2019-11-22 14:04:06 -08:00
|
|
|
name: 'Update',
|
|
|
|
value: 'update',
|
|
|
|
description: 'Update a company',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Update a company',
|
2019-11-21 09:39:04 -08:00
|
|
|
},
|
|
|
|
{
|
2019-11-21 09:52:57 -08:00
|
|
|
name: 'Users',
|
|
|
|
value: 'users',
|
2022-08-17 08:50:24 -07:00
|
|
|
description: "List company's users",
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'List users of a company',
|
2019-11-21 09:39:04 -08:00
|
|
|
},
|
|
|
|
],
|
2019-11-22 14:04:06 -08:00
|
|
|
default: 'create',
|
2019-11-21 09:39:04 -08:00
|
|
|
},
|
2021-12-03 00:44:16 -08:00
|
|
|
];
|
2019-11-21 09:39:04 -08:00
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export const companyFields: INodeProperties[] = [
|
2021-04-24 08:49:52 -07:00
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* company:users */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
2019-11-21 09:39:04 -08:00
|
|
|
{
|
|
|
|
displayName: 'List By',
|
|
|
|
name: 'listBy',
|
|
|
|
type: 'options',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
resource: ['company'],
|
|
|
|
operation: ['users'],
|
2019-11-21 09:39:04 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'ID',
|
|
|
|
value: 'id',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'The Intercom defined ID representing the company',
|
2019-11-21 09:39:04 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Company ID',
|
|
|
|
value: 'companyId',
|
|
|
|
description: 'The company_id you have given to the company',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Value',
|
|
|
|
name: 'value',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
resource: ['company'],
|
|
|
|
operation: ['users'],
|
2019-11-21 09:39:04 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
description: 'View by value',
|
|
|
|
},
|
2021-04-24 08:42:31 -07:00
|
|
|
{
|
|
|
|
displayName: 'Return All',
|
|
|
|
name: 'returnAll',
|
|
|
|
type: 'boolean',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
resource: ['company'],
|
|
|
|
operation: ['users'],
|
2021-04-24 08:42:31 -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-04-24 08:42:31 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Limit',
|
|
|
|
name: 'limit',
|
|
|
|
type: 'number',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
resource: ['company'],
|
|
|
|
operation: ['users'],
|
|
|
|
returnAll: [false],
|
2021-04-24 08:42:31 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 1,
|
|
|
|
maxValue: 60,
|
|
|
|
},
|
|
|
|
default: 50,
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Max number of results to return',
|
2021-04-24 08:42:31 -07:00
|
|
|
},
|
|
|
|
|
2021-04-24 08:49:52 -07:00
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* company:getAll */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
2019-11-21 09:39:04 -08:00
|
|
|
{
|
2019-11-22 14:04:06 -08:00
|
|
|
displayName: 'Return All',
|
|
|
|
name: 'returnAll',
|
|
|
|
type: 'boolean',
|
2019-11-21 09:39:04 -08:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
resource: ['company'],
|
|
|
|
operation: ['getAll'],
|
2019-11-21 09:39:04 -08:00
|
|
|
},
|
|
|
|
},
|
2019-11-22 14:04:06 -08:00
|
|
|
default: false,
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Whether to return all results or only up to a given limit',
|
2019-11-22 14:04:06 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Limit',
|
|
|
|
name: 'limit',
|
|
|
|
type: 'number',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
resource: ['company'],
|
|
|
|
operation: ['getAll'],
|
|
|
|
returnAll: [false],
|
2019-11-21 09:39:04 -08:00
|
|
|
},
|
2019-11-22 14:04:06 -08:00
|
|
|
},
|
|
|
|
typeOptions: {
|
|
|
|
minValue: 1,
|
|
|
|
maxValue: 60,
|
|
|
|
},
|
|
|
|
default: 50,
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'Max number of results to return',
|
2019-11-21 09:39:04 -08:00
|
|
|
},
|
|
|
|
{
|
2019-11-22 14:04:06 -08:00
|
|
|
displayName: 'Filters',
|
|
|
|
name: 'filters',
|
|
|
|
type: 'collection',
|
|
|
|
placeholder: 'Add Filter',
|
|
|
|
default: {},
|
2019-11-21 09:39:04 -08:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
resource: ['company'],
|
|
|
|
operation: ['getAll'],
|
2019-11-21 09:39:04 -08:00
|
|
|
},
|
|
|
|
},
|
2019-11-22 14:04:06 -08:00
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Segment ID',
|
|
|
|
name: 'segment_id',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'Segment representing the Lead',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Tag ID',
|
|
|
|
name: 'tag_id',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'Tag representing the Lead',
|
|
|
|
},
|
2020-10-22 06:46:03 -07:00
|
|
|
],
|
2019-11-21 09:39:04 -08:00
|
|
|
},
|
|
|
|
|
2021-04-24 08:49:52 -07:00
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* company:get */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
2019-11-21 09:39:04 -08:00
|
|
|
{
|
2019-11-22 14:04:06 -08:00
|
|
|
displayName: 'Select By',
|
|
|
|
name: 'selectBy',
|
2019-11-21 09:39:04 -08:00
|
|
|
type: 'options',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
resource: ['company'],
|
|
|
|
operation: ['get'],
|
2019-11-21 09:39:04 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Company ID',
|
|
|
|
value: 'companyId',
|
|
|
|
description: 'The company_id you have given to the company',
|
|
|
|
},
|
2019-11-22 14:04:06 -08:00
|
|
|
{
|
|
|
|
name: 'ID',
|
|
|
|
value: 'id',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'The Intercom defined ID representing the company',
|
2019-11-22 14:04:06 -08:00
|
|
|
},
|
2019-11-21 09:39:04 -08:00
|
|
|
{
|
|
|
|
name: 'Name',
|
|
|
|
value: 'name',
|
|
|
|
description: 'The name of the company',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'What property to use to query the company',
|
2019-11-21 09:39:04 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Value',
|
|
|
|
name: 'value',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
required: true,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
resource: ['company'],
|
|
|
|
operation: ['get'],
|
2019-11-21 09:39:04 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
description: 'View by value',
|
|
|
|
},
|
|
|
|
|
2021-04-24 08:49:52 -07:00
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* company:create/update */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
2019-11-21 09:39:04 -08:00
|
|
|
{
|
2022-05-20 14:47:24 -07:00
|
|
|
displayName: 'Company ID',
|
2019-11-21 09:39:04 -08:00
|
|
|
name: 'companyId',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
resource: ['company'],
|
|
|
|
operation: ['create', 'update'],
|
2019-11-21 09:39:04 -08:00
|
|
|
},
|
|
|
|
},
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'The company ID you have defined for the company',
|
2019-11-21 09:39:04 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'JSON Parameters',
|
|
|
|
name: 'jsonParameters',
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
operation: ['create', 'update'],
|
|
|
|
resource: ['company'],
|
2019-11-21 09:39:04 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2019-11-22 14:04:06 -08:00
|
|
|
displayName: 'Additional Fields',
|
|
|
|
name: 'additionalFields',
|
2019-11-21 09:39:04 -08:00
|
|
|
type: 'collection',
|
2019-11-22 14:04:06 -08:00
|
|
|
placeholder: 'Add Field',
|
2019-11-21 09:39:04 -08:00
|
|
|
default: {},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
operation: ['create', 'update'],
|
|
|
|
resource: ['company'],
|
2019-11-21 09:39:04 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
2019-11-22 14:04:06 -08:00
|
|
|
{
|
|
|
|
displayName: 'Industry',
|
|
|
|
name: 'industry',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'The industry that this company operates in',
|
|
|
|
},
|
2019-11-21 09:39:04 -08:00
|
|
|
{
|
|
|
|
displayName: 'Monthly Spend',
|
|
|
|
name: 'monthlySpend',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'The phone number of the user',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Name',
|
|
|
|
name: 'name',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
placeholder: '',
|
|
|
|
description: 'Name of the user',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Plan',
|
|
|
|
name: 'plan',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
placeholder: '',
|
|
|
|
description: 'The name of the plan you have associated with the company',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Size',
|
|
|
|
name: 'size',
|
|
|
|
type: 'number',
|
|
|
|
default: '',
|
|
|
|
description: 'The number of employees in this company',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Website',
|
|
|
|
name: 'website',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
2022-08-17 08:50:24 -07:00
|
|
|
description:
|
|
|
|
"The URL for this company's website. Please note that the value specified here is not validated. Accepts any string.",
|
2019-11-21 09:39:04 -08:00
|
|
|
},
|
2020-10-22 06:46:03 -07:00
|
|
|
],
|
2019-11-21 09:39:04 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Custom Attributes',
|
|
|
|
name: 'customAttributesJson',
|
|
|
|
type: 'json',
|
|
|
|
typeOptions: {
|
|
|
|
alwaysOpenEditWindow: true,
|
|
|
|
},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
resource: ['company'],
|
|
|
|
operation: ['create', 'update'],
|
|
|
|
jsonParameters: [true],
|
2019-11-21 09:39:04 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
2022-08-17 08:50:24 -07:00
|
|
|
description:
|
|
|
|
'A hash of key/value pairs to represent custom data you want to attribute to a user',
|
2019-11-21 09:39:04 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Custom Attributes',
|
|
|
|
name: 'customAttributesUi',
|
|
|
|
type: 'fixedCollection',
|
2022-04-22 09:29:51 -07:00
|
|
|
default: {},
|
2019-11-21 09:39:04 -08:00
|
|
|
placeholder: 'Add Attribute',
|
|
|
|
typeOptions: {
|
|
|
|
multipleValues: true,
|
|
|
|
},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
resource: ['company'],
|
|
|
|
operation: ['create', 'update'],
|
|
|
|
jsonParameters: [false],
|
2019-11-21 09:39:04 -08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'customAttributesValues',
|
|
|
|
displayName: 'Attributes',
|
|
|
|
values: [
|
|
|
|
{
|
|
|
|
displayName: 'Name',
|
|
|
|
name: 'name',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Value',
|
|
|
|
name: 'value',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
],
|
2020-10-22 06:46:03 -07:00
|
|
|
},
|
2019-11-21 09:39:04 -08:00
|
|
|
],
|
2022-08-17 08:50:24 -07:00
|
|
|
description:
|
|
|
|
'A hash of key/value pairs to represent custom data you want to attribute to a user',
|
2019-11-21 09:39:04 -08:00
|
|
|
},
|
2021-12-03 00:44:16 -08:00
|
|
|
];
|