2021-01-13 11:20:30 -08:00
import { INodeProperties } from 'n8n-workflow' ;
2019-11-21 09:39:04 -08:00
2021-12-03 00:44:16 -08:00
export const userOpeations : 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 : [ 'user' ] ,
2019-11-21 09:39:04 -08:00
} ,
} ,
options : [
{
name : 'Create' ,
value : 'create' ,
description : 'Create a new user' ,
2022-07-10 13:50:51 -07:00
action : 'Create a user' ,
2019-11-21 09:39:04 -08:00
} ,
2021-04-24 08:49:52 -07:00
{
name : 'Delete' ,
value : 'delete' ,
description : 'Delete a user' ,
2022-07-10 13:50:51 -07:00
action : 'Delete a user' ,
2021-04-24 08:49:52 -07:00
} ,
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 user' ,
2022-07-10 13:50:51 -07:00
action : 'Get a user' ,
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 users' ,
2022-09-08 08:10:13 -07:00
action : 'Get many users' ,
2019-11-21 09:39:04 -08:00
} ,
{
2019-11-22 14:04:06 -08:00
name : 'Update' ,
value : 'update' ,
description : 'Update a user' ,
2022-07-10 13:50:51 -07:00
action : 'Update a user' ,
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 userFields : INodeProperties [ ] = [
2021-04-24 08:49:52 -07:00
/* -------------------------------------------------------------------------- */
/* user:delete */
/* -------------------------------------------------------------------------- */
2019-11-21 09:39:04 -08:00
{
displayName : 'ID' ,
name : 'id' ,
type : 'string' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'user' ] ,
operation : [ 'delete' ] ,
2019-11-21 09:39:04 -08:00
} ,
} ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The Intercom defined ID representing the Lead' ,
2019-11-21 09:39:04 -08:00
} ,
2021-04-24 08:49:52 -07:00
/* -------------------------------------------------------------------------- */
/* user: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 : [ 'user' ] ,
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 : [ 'user' ] ,
operation : [ 'getAll' ] ,
returnAll : [ false ] ,
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-22 14:04:06 -08:00
} ,
{
displayName : 'Filters' ,
name : 'filters' ,
type : 'collection' ,
placeholder : 'Add Filter' ,
default : { } ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'user' ] ,
operation : [ 'getAll' ] ,
2019-11-21 09:39:04 -08:00
} ,
2019-11-22 14:04:06 -08:00
} ,
options : [
2019-11-21 09:39:04 -08:00
{
2019-11-22 14:04:06 -08:00
displayName : 'Company ID' ,
name : 'company_id' ,
type : 'string' ,
2019-11-21 09:39:04 -08:00
default : '' ,
2019-11-22 14:04:06 -08:00
description : 'Company ID representing the user' ,
2019-11-21 09:39:04 -08:00
} ,
{
2019-11-22 14:04:06 -08:00
displayName : 'Email' ,
name : 'email' ,
type : 'string' ,
2022-06-20 07:54:01 -07:00
placeholder : 'name@email.com' ,
2019-11-21 09:39:04 -08:00
default : '' ,
2019-11-22 14:04:06 -08:00
description : 'The email address of the user' ,
2019-11-21 09:39:04 -08:00
} ,
{
2021-04-24 08:49:52 -07:00
displayName : 'Segment ID' ,
name : 'segment_id' ,
2019-11-22 14:04:06 -08:00
type : 'string' ,
2019-11-21 09:39:04 -08:00
default : '' ,
2021-04-24 08:49:52 -07:00
description : 'Segment representing the user' ,
2019-11-21 09:39:04 -08:00
} ,
{
2021-04-24 08:49:52 -07:00
displayName : 'Tag ID' ,
name : 'tag_id' ,
2019-11-22 14:04:06 -08:00
type : 'string' ,
2019-11-21 09:39:04 -08:00
default : '' ,
2021-04-24 08:49:52 -07:00
description : 'Tag representing the user' ,
2019-11-21 09:39:04 -08:00
} ,
] ,
} ,
2021-04-24 08:49:52 -07:00
/* -------------------------------------------------------------------------- */
/* user: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 : [ 'user' ] ,
operation : [ 'get' ] ,
2019-11-21 09:39:04 -08:00
} ,
} ,
options : [
{
name : 'ID' ,
value : 'id' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The Intercom defined ID representing the Lead' ,
2019-11-21 09:39:04 -08:00
} ,
{
name : 'User ID' ,
value : 'userId' ,
default : '' ,
description : 'Automatically generated identifier for the Lead' ,
} ,
] ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The property to select the user by' ,
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 : [ 'user' ] ,
operation : [ 'get' ] ,
2019-11-21 09:39:04 -08:00
} ,
} ,
description : 'View by value' ,
} ,
2021-04-24 08:49:52 -07:00
/* -------------------------------------------------------------------------- */
/* user:update */
/* -------------------------------------------------------------------------- */
2019-11-21 09:39:04 -08:00
{
2019-11-22 14:04:06 -08:00
displayName : 'Update By' ,
name : 'updateBy' ,
type : 'options' ,
2019-11-21 09:39:04 -08:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'user' ] ,
operation : [ 'update' ] ,
2019-11-21 09:39:04 -08:00
} ,
} ,
2019-11-22 14:04:06 -08:00
options : [
{
name : 'ID' ,
value : 'id' ,
2022-05-06 14:01:25 -07:00
description : 'The Intercom defined ID representing the user' ,
2019-11-21 09:39:04 -08:00
} ,
2019-11-22 14:04:06 -08:00
{
name : 'Email' ,
value : 'email' ,
description : 'The email address of user' ,
} ,
{
name : 'User ID' ,
value : 'userId' ,
description : 'Automatically generated identifier for the user' ,
} ,
] ,
default : 'id' ,
2022-05-06 14:01:25 -07:00
description : 'The property via which to query the user' ,
2019-11-21 09:39:04 -08:00
} ,
{
2019-11-22 14:04:06 -08:00
displayName : 'Value' ,
name : 'value' ,
2019-11-21 09:39:04 -08:00
type : 'string' ,
default : '' ,
2019-11-22 14:04:06 -08:00
required : true ,
2019-11-21 09:39:04 -08:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'user' ] ,
operation : [ 'update' ] ,
2019-11-21 09:39:04 -08:00
} ,
} ,
2019-11-22 14:04:06 -08:00
description : 'Value of the property to identify the user to update' ,
2019-11-21 09:39:04 -08:00
} ,
2021-04-24 08:49:52 -07:00
/* -------------------------------------------------------------------------- */
/* user:create */
/* -------------------------------------------------------------------------- */
2019-11-21 09:39:04 -08:00
{
2019-11-22 14:04:06 -08:00
displayName : 'Identifier Type' ,
name : 'identifierType' ,
2019-11-21 09:39:04 -08:00
type : 'options' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'user' ] ,
operation : [ 'create' ] ,
2019-11-21 09:39:04 -08:00
} ,
} ,
options : [
{
2019-11-22 14:04:06 -08:00
name : 'User ID' ,
2019-11-21 09:39:04 -08:00
value : 'userId' ,
2022-08-17 08:50:24 -07:00
description :
'A unique string identifier for the user. It is required on creation if an email is not supplied.' ,
2019-11-21 09:39:04 -08:00
} ,
{
name : 'Email' ,
value : 'email' ,
2022-08-17 08:50:24 -07:00
description :
"The user's email address. It is required on creation if a user_id is not supplied." ,
2019-11-21 09:39:04 -08:00
} ,
] ,
default : '' ,
description : 'Unique string identifier' ,
} ,
{
displayName : 'Value' ,
name : 'idValue' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'user' ] ,
operation : [ 'create' ] ,
2019-11-21 09:39:04 -08:00
} ,
} ,
description : 'Unique string identifier value' ,
} ,
{
displayName : 'JSON Parameters' ,
name : 'jsonParameters' ,
type : 'boolean' ,
default : false ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
operation : [ 'create' , 'update' ] ,
resource : [ 'user' ] ,
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 : [ 'user' ] ,
2019-11-21 09:39:04 -08:00
} ,
} ,
options : [
2021-04-24 08:49:52 -07:00
{
displayName : 'Avatar' ,
name : 'avatar' ,
type : 'string' ,
default : '' ,
2022-06-03 10:23:49 -07:00
description : 'An avatar image URL. note: the image URL needs to be https.' ,
2021-04-24 08:49:52 -07:00
} ,
{
2022-06-20 07:54:01 -07:00
displayName : 'Company Names or IDs' ,
2021-04-24 08:49:52 -07:00
name : 'companies' ,
type : 'multiOptions' ,
typeOptions : {
loadOptionsMethod : 'getCompanies' ,
} ,
default : [ ] ,
2022-08-17 08:50:24 -07:00
description :
'Identifies the companies this user belongs to. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.' ,
2021-04-24 08:49:52 -07:00
} ,
2019-11-22 14:04:06 -08:00
{
displayName : 'Email' ,
name : 'email' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
'/operation' : [ 'update' ] ,
'/resource' : [ 'user' ] ,
2019-11-22 14:04:06 -08:00
} ,
hide : {
2022-08-17 08:50:24 -07:00
'/updateBy' : [ 'email' ] ,
2019-11-22 14:04:06 -08:00
} ,
} ,
type : 'string' ,
2022-06-20 07:54:01 -07:00
placeholder : 'name@email.com' ,
2019-11-22 14:04:06 -08:00
default : '' ,
description : 'Email of the user' ,
} ,
2021-04-24 08:49:52 -07:00
{
displayName : 'Name' ,
name : 'name' ,
type : 'string' ,
default : '' ,
placeholder : '' ,
description : 'Name of the user' ,
} ,
{
displayName : 'Phone' ,
name : 'phone' ,
type : 'string' ,
default : '' ,
description : 'The phone number of the user' ,
} ,
{
displayName : 'Session Count' ,
name : 'sessionCount' ,
type : 'number' ,
default : false ,
options : [ ] ,
2022-05-06 14:01:25 -07:00
description : 'How many sessions the user has recorded' ,
2021-04-24 08:49:52 -07:00
} ,
2019-11-22 14:04:06 -08:00
{
displayName : 'User ID' ,
name : 'userId' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
'/operation' : [ 'update' ] ,
'/resource' : [ 'user' ] ,
2019-11-22 14:04:06 -08:00
} ,
hide : {
2022-08-17 08:50:24 -07:00
'/updateBy' : [ 'email' , 'userId' ] ,
2019-11-22 14:04:06 -08:00
} ,
} ,
type : 'string' ,
default : '' ,
description : 'Email of the user' ,
} ,
2019-11-21 09:39:04 -08:00
{
displayName : 'Unsubscribed From Emails' ,
name : 'unsubscribedFromEmails' ,
type : 'boolean' ,
2022-04-22 09:29:51 -07:00
default : false ,
2019-11-21 09:39:04 -08:00
placeholder : '' ,
description : 'Whether the user is unsubscribed from emails' ,
} ,
{
displayName : 'Update Last Request At' ,
name : 'updateLastRequestAt' ,
type : 'boolean' ,
default : false ,
options : [ ] ,
2022-08-17 08:50:24 -07:00
description :
'Whether to instruct Intercom to update the users last_request_at value to the current API service time in UTC' ,
2019-11-21 09:39:04 -08:00
} ,
{
2021-04-24 08:49:52 -07:00
displayName : 'UTM Campaign' ,
name : 'utmCampaign' ,
2019-11-21 09:39:04 -08:00
type : 'string' ,
default : '' ,
2021-04-24 08:49:52 -07:00
description : 'Identifies a specific product promotion or strategic campaign' ,
2019-11-21 09:39:04 -08:00
} ,
{
2021-04-24 08:49:52 -07:00
displayName : 'UTM Content' ,
name : 'utmContent' ,
2019-11-21 09:39:04 -08:00
type : 'string' ,
default : '' ,
2021-04-24 08:49:52 -07:00
description : 'Identifies what specifically was clicked to bring the user to the site' ,
2019-11-21 09:39:04 -08:00
} ,
{
displayName : 'UTM Medium' ,
name : 'utmMedium' ,
type : 'string' ,
default : '' ,
description : 'Identifies what type of link was used' ,
} ,
{
2021-04-24 08:49:52 -07:00
displayName : 'UTM Source' ,
name : 'utmSource' ,
2019-11-21 09:39:04 -08:00
type : 'string' ,
default : '' ,
2022-06-03 10:23:49 -07:00
description : 'An avatar image URL. note: the image URL needs to be https.' ,
2019-11-21 09:39:04 -08:00
} ,
{
displayName : 'UTM Term' ,
name : 'utmTerm' ,
type : 'string' ,
default : '' ,
description : 'Identifies search terms' ,
} ,
2020-10-22 06:46:03 -07:00
] ,
2019-11-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 : [ 'user' ] ,
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 : [ 'user' ] ,
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
] ;