2022-08-01 13:47:55 -07:00
import { tz } from 'moment-timezone' ;
2021-07-30 07:12:30 -07:00
2023-01-27 03:22:44 -08:00
import type { INodeProperties } from 'n8n-workflow' ;
2021-07-30 07:12:30 -07:00
2021-12-03 00:44:16 -08:00
export const appointmentOperations : INodeProperties [ ] = [
2021-07-30 07:12:30 -07:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2021-07-30 07:12:30 -07:00
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'appointment' ] ,
2021-07-30 07:12:30 -07:00
} ,
} ,
options : [
{
name : 'Create' ,
value : 'create' ,
description : 'Create an appointment' ,
2022-07-10 13:50:51 -07:00
action : 'Create an appointment' ,
2021-07-30 07:12:30 -07:00
} ,
{
name : 'Delete' ,
value : 'delete' ,
description : 'Delete an appointment' ,
2022-07-10 13:50:51 -07:00
action : 'Delete an appointment' ,
2021-07-30 07:12:30 -07:00
} ,
{
name : 'Get' ,
value : 'get' ,
description : 'Retrieve an appointment' ,
2022-07-10 13:50:51 -07:00
action : 'Get an appointment' ,
2021-07-30 07:12:30 -07:00
} ,
{
2022-09-07 07:51:14 -07:00
name : 'Get Many' ,
2021-07-30 07:12:30 -07:00
value : 'getAll' ,
2022-09-13 03:36:36 -07:00
description : 'Retrieve many appointments' ,
2022-09-08 08:10:13 -07:00
action : 'Get many appointments' ,
2021-07-30 07:12:30 -07:00
} ,
{
name : 'Update' ,
value : 'update' ,
description : 'Update an appointment' ,
2022-07-10 13:50:51 -07:00
action : 'Update an appointment' ,
2021-07-30 07:12:30 -07:00
} ,
] ,
default : 'create' ,
} ,
2021-12-03 00:44:16 -08:00
] ;
2021-07-30 07:12:30 -07:00
2021-12-03 00:44:16 -08:00
export const appointmentFields : INodeProperties [ ] = [
2021-07-30 07:12:30 -07:00
// ----------------------------------------
// appointment: create
// ----------------------------------------
{
displayName : 'Title' ,
name : 'title' ,
description : 'Title of the appointment' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'appointment' ] ,
operation : [ 'create' ] ,
2021-07-30 07:12:30 -07:00
} ,
} ,
} ,
{
displayName : 'Start Date' ,
name : 'fromDate' ,
2022-08-01 13:47:55 -07:00
description :
'Timestamp that denotes the start of appointment. Start date if this is an all-day appointment.' ,
2021-07-30 07:12:30 -07:00
type : 'dateTime' ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'appointment' ] ,
operation : [ 'create' ] ,
2021-07-30 07:12:30 -07:00
} ,
} ,
} ,
{
displayName : 'End Date' ,
name : 'endDate' ,
2022-08-01 13:47:55 -07:00
description :
'Timestamp that denotes the end of appointment. End date if this is an all-day appointment.' ,
2021-07-30 07:12:30 -07:00
type : 'dateTime' ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'appointment' ] ,
operation : [ 'create' ] ,
2021-07-30 07:12:30 -07:00
} ,
} ,
} ,
{
displayName : 'Attendees' ,
name : 'attendees' ,
type : 'fixedCollection' ,
typeOptions : {
multipleValues : true ,
} ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'appointment' ] ,
operation : [ 'create' ] ,
2021-07-30 07:12:30 -07:00
} ,
} ,
placeholder : 'Add Attendee' ,
default : { } ,
options : [
{
name : 'attendee' ,
displayName : 'Attendee' ,
values : [
{
displayName : 'Type' ,
name : 'type' ,
type : 'options' ,
options : [
{
name : 'Contact' ,
value : 'contact' ,
} ,
{
name : 'User' ,
value : 'user' ,
} ,
] ,
default : 'contact' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'User Name or ID' ,
2021-07-30 07:12:30 -07:00
name : 'userId' ,
type : 'options' ,
2022-08-01 13:47:55 -07:00
description :
2024-09-12 07:53:36 -07:00
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>' ,
2021-07-30 07:12:30 -07:00
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
type : [ 'user' ] ,
2021-07-30 07:12:30 -07:00
} ,
} ,
typeOptions : {
loadOptionsMethod : 'getUsers' ,
} ,
default : '' ,
} ,
{
displayName : 'Contact ID' ,
name : 'contactId' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
type : [ 'contact' ] ,
2021-07-30 07:12:30 -07:00
} ,
} ,
type : 'string' ,
default : '' ,
} ,
] ,
} ,
] ,
} ,
{
displayName : 'Additional Fields' ,
name : 'additionalFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'appointment' ] ,
operation : [ 'create' ] ,
2021-07-30 07:12:30 -07:00
} ,
} ,
options : [
{
2022-06-03 10:23:49 -07:00
displayName : 'Creator Name or ID' ,
2021-07-30 07:12:30 -07:00
name : 'creater_id' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getUsers' ,
} ,
2022-08-01 13:47:55 -07:00
description :
2024-09-12 07:53:36 -07:00
'ID of the user who created the appointment. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.' ,
2021-07-30 07:12:30 -07:00
} ,
{
displayName : 'Is All-Day' ,
name : 'is_allday' ,
type : 'boolean' ,
default : false ,
description : 'Whether it is an all-day appointment or not' ,
} ,
{
displayName : 'Latitude' ,
name : 'latitude' ,
type : 'string' ,
default : '' ,
description : 'Latitude of the location when you check in for an appointment' ,
} ,
{
displayName : 'Location' ,
name : 'location' ,
type : 'string' ,
default : '' ,
description : 'Location of the appointment' ,
} ,
{
displayName : 'Longitude' ,
name : 'longitude' ,
type : 'string' ,
default : '' ,
description : 'Longitude of the location when you check in for an appointment' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Outcome Name or ID' ,
2021-07-30 07:12:30 -07:00
name : 'outcome_id' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getOutcomes' ,
} ,
2022-08-01 13:47:55 -07:00
description :
2024-09-12 07:53:36 -07:00
'ID of outcome of Appointment sales activity type. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.' ,
2021-07-30 07:12:30 -07:00
} ,
{
2021-07-30 07:43:46 -07:00
displayName : 'Target ID' ,
2021-07-30 07:12:30 -07:00
name : 'targetable_id' ,
type : 'string' ,
default : '' ,
description : 'ID of contact/account against whom appointment is created' ,
} ,
{
2021-07-30 07:43:46 -07:00
displayName : 'Target Type' ,
2021-07-30 07:12:30 -07:00
name : 'targetable_type' ,
type : 'options' ,
default : 'Contact' ,
options : [
{
name : 'Contact' ,
value : 'Contact' ,
} ,
{
name : 'Deal' ,
value : 'Deal' ,
} ,
{
name : 'SalesAccount' ,
value : 'SalesAccount' ,
} ,
] ,
} ,
{
displayName : 'Time Zone' ,
name : 'time_zone' ,
type : 'options' ,
default : '' ,
description : 'Timezone that the appointment is scheduled in' ,
2022-12-02 12:54:28 -08:00
options : tz.names ( ) . map ( ( timeZone ) = > ( { name : timeZone , value : timeZone } ) ) ,
2021-07-30 07:12:30 -07:00
} ,
] ,
} ,
// ----------------------------------------
// appointment: delete
// ----------------------------------------
{
displayName : 'Appointment ID' ,
name : 'appointmentId' ,
description : 'ID of the appointment to delete' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'appointment' ] ,
operation : [ 'delete' ] ,
2021-07-30 07:12:30 -07:00
} ,
} ,
} ,
// ----------------------------------------
// appointment: get
// ----------------------------------------
{
displayName : 'Appointment ID' ,
name : 'appointmentId' ,
description : 'ID of the appointment to retrieve' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'appointment' ] ,
operation : [ 'get' ] ,
2021-07-30 07:12:30 -07:00
} ,
} ,
} ,
// ----------------------------------------
// appointment: getAll
// ----------------------------------------
{
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
default : false ,
description : 'Whether to return all results or only up to a given limit' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'appointment' ] ,
operation : [ 'getAll' ] ,
2021-07-30 07:12:30 -07:00
} ,
} ,
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
default : 50 ,
2022-05-06 14:01:25 -07:00
description : 'Max number of results to return' ,
2021-07-30 07:12:30 -07:00
typeOptions : {
minValue : 1 ,
} ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'appointment' ] ,
operation : [ 'getAll' ] ,
returnAll : [ false ] ,
2021-07-30 07:12:30 -07:00
} ,
} ,
} ,
{
displayName : 'Filters' ,
name : 'filters' ,
type : 'collection' ,
2022-04-22 09:29:51 -07:00
default : { } ,
2021-07-30 07:12:30 -07:00
placeholder : 'Add Filter' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'appointment' ] ,
operation : [ 'getAll' ] ,
2021-07-30 07:12:30 -07:00
} ,
} ,
options : [
{
displayName : 'Include' ,
name : 'include' ,
type : 'options' ,
default : 'creater' ,
options : [
{
name : 'Appointment Attendees' ,
value : 'appointment_attendees' ,
} ,
{
name : 'Creator' ,
value : 'creater' ,
} ,
{
2021-07-30 07:43:46 -07:00
name : 'Target' ,
2021-07-30 07:12:30 -07:00
value : 'targetable' ,
} ,
] ,
} ,
{
displayName : 'Time' ,
name : 'filter' ,
type : 'options' ,
default : 'upcoming' ,
options : [
{
name : 'Past' ,
value : 'past' ,
} ,
{
name : 'Upcoming' ,
value : 'upcoming' ,
} ,
] ,
} ,
] ,
} ,
// ----------------------------------------
// appointment: update
// ----------------------------------------
{
displayName : 'Appointment ID' ,
name : 'appointmentId' ,
description : 'ID of the appointment to update' ,
type : 'string' ,
required : true ,
default : '' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'appointment' ] ,
operation : [ 'update' ] ,
2021-07-30 07:12:30 -07:00
} ,
} ,
} ,
{
displayName : 'Update Fields' ,
name : 'updateFields' ,
type : 'collection' ,
placeholder : 'Add Field' ,
default : { } ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
resource : [ 'appointment' ] ,
operation : [ 'update' ] ,
2021-07-30 07:12:30 -07:00
} ,
} ,
options : [
{
displayName : 'Attendees' ,
name : 'attendees' ,
type : 'fixedCollection' ,
typeOptions : {
multipleValues : true ,
} ,
placeholder : 'Add Attendee' ,
default : { } ,
options : [
{
name : 'attendee' ,
displayName : 'Attendee' ,
values : [
{
displayName : 'Type' ,
name : 'type' ,
type : 'options' ,
options : [
{
name : 'Contact' ,
value : 'contact' ,
} ,
{
name : 'User' ,
value : 'user' ,
} ,
] ,
default : 'contact' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'User Name or ID' ,
2021-07-30 07:12:30 -07:00
name : 'userId' ,
type : 'options' ,
2022-08-01 13:47:55 -07:00
description :
2024-09-12 07:53:36 -07:00
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>' ,
2021-07-30 07:12:30 -07:00
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
type : [ 'user' ] ,
2021-07-30 07:12:30 -07:00
} ,
} ,
typeOptions : {
loadOptionsMethod : 'getUsers' ,
} ,
default : '' ,
} ,
{
displayName : 'Contact ID' ,
name : 'contactId' ,
displayOptions : {
show : {
2022-08-01 13:47:55 -07:00
type : [ 'contact' ] ,
2021-07-30 07:12:30 -07:00
} ,
} ,
type : 'string' ,
default : '' ,
} ,
] ,
} ,
] ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Creator Name or ID' ,
2021-07-30 07:12:30 -07:00
name : 'creater_id' ,
type : 'options' ,
default : [ ] ,
typeOptions : {
loadOptionsMethod : 'getUsers' ,
} ,
2022-08-01 13:47:55 -07:00
description :
2024-09-12 07:53:36 -07:00
'ID of the user who created the appointment. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.' ,
2021-07-30 07:12:30 -07:00
} ,
{
displayName : 'End Date' ,
name : 'endDate' ,
2022-08-01 13:47:55 -07:00
description :
'Timestamp that denotes the end of appointment. End date if this is an all-day appointment.' ,
2021-07-30 07:12:30 -07:00
type : 'dateTime' ,
default : '' ,
} ,
{
displayName : 'Is All-Day' ,
name : 'is_allday' ,
type : 'boolean' ,
default : false ,
description : 'Whether it is an all-day appointment or not' ,
} ,
{
displayName : 'Latitude' ,
name : 'latitude' ,
type : 'string' ,
default : '' ,
description : 'Latitude of the location when you check in for an appointment' ,
} ,
{
displayName : 'Location' ,
name : 'location' ,
type : 'string' ,
default : '' ,
description : 'Location of the appointment' ,
} ,
{
displayName : 'Longitude' ,
name : 'longitude' ,
type : 'string' ,
default : '' ,
description : 'Longitude of the location when you check in for an appointment' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'Outcome Name or ID' ,
2021-07-30 07:12:30 -07:00
name : 'outcome_id' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getOutcomes' ,
} ,
2022-08-01 13:47:55 -07:00
description :
2024-09-12 07:53:36 -07:00
'ID of outcome of Appointment sales activity type. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.' ,
2021-07-30 07:12:30 -07:00
} ,
{
displayName : 'Start Date' ,
name : 'fromDate' ,
2022-08-01 13:47:55 -07:00
description :
'Timestamp that denotes the start of appointment. Start date if this is an all-day appointment.' ,
2021-07-30 07:12:30 -07:00
type : 'dateTime' ,
default : '' ,
} ,
{
2021-07-30 07:43:46 -07:00
displayName : 'Target ID' ,
2021-07-30 07:12:30 -07:00
name : 'targetable_id' ,
type : 'string' ,
default : '' ,
description : 'ID of contact/account against whom appointment is created' ,
} ,
{
2021-07-30 07:43:46 -07:00
displayName : 'Target Type' ,
2021-07-30 07:12:30 -07:00
name : 'targetable_type' ,
type : 'options' ,
default : 'Contact' ,
options : [
{
name : 'Contact' ,
value : 'Contact' ,
} ,
{
name : 'Deal' ,
value : 'Deal' ,
} ,
{
name : 'SalesAccount' ,
value : 'SalesAccount' ,
} ,
] ,
} ,
{
displayName : 'Time Zone' ,
name : 'time_zone' ,
type : 'options' ,
default : '' ,
description : 'Timezone that the appointment is scheduled in' ,
2022-12-02 12:54:28 -08:00
options : tz.names ( ) . map ( ( timeZone ) = > ( { name : timeZone , value : timeZone } ) ) ,
2021-07-30 07:12:30 -07:00
} ,
{
displayName : 'Title' ,
name : 'title' ,
type : 'string' ,
default : '' ,
description : 'Title of the appointment' ,
} ,
] ,
} ,
2021-12-03 00:44:16 -08:00
] ;