n8n-nodes-ritsa-crm 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/credentials/RitsaCrmApi.credentials.ts +28 -0
- package/dist/credentials/RitsaCrmApi.credentials.d.ts +7 -0
- package/dist/credentials/RitsaCrmApi.credentials.js +30 -0
- package/dist/credentials/RitsaCrmApi.credentials.js.map +1 -0
- package/dist/nodes/RitsaTools/RitsaTools.node.d.ts +5 -0
- package/dist/nodes/RitsaTools/RitsaTools.node.js +233 -0
- package/dist/nodes/RitsaTools/RitsaTools.node.js.map +1 -0
- package/nodes/RitsaTools/RitsaTools.node.ts +233 -0
- package/package.json +34 -0
- package/tsconfig.json +23 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ICredentialType,
|
|
3
|
+
INodeProperties,
|
|
4
|
+
} from 'n8n-workflow';
|
|
5
|
+
|
|
6
|
+
export class RitsaCrmApi implements ICredentialType {
|
|
7
|
+
name = 'ritsaCrmApi';
|
|
8
|
+
displayName = 'Ritsa CRM API';
|
|
9
|
+
documentationUrl = '';
|
|
10
|
+
properties: INodeProperties[] = [
|
|
11
|
+
{
|
|
12
|
+
displayName: 'API Key',
|
|
13
|
+
name: 'apiKey',
|
|
14
|
+
type: 'string',
|
|
15
|
+
typeOptions: {
|
|
16
|
+
password: true,
|
|
17
|
+
},
|
|
18
|
+
default: '',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
displayName: 'Base URL',
|
|
22
|
+
name: 'baseUrl',
|
|
23
|
+
type: 'string',
|
|
24
|
+
default: 'https://crm.ritsaai.com/api',
|
|
25
|
+
description: 'The base URL for the CRM API',
|
|
26
|
+
},
|
|
27
|
+
];
|
|
28
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RitsaCrmApi = void 0;
|
|
4
|
+
class RitsaCrmApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'ritsaCrmApi';
|
|
7
|
+
this.displayName = 'Ritsa CRM API';
|
|
8
|
+
this.documentationUrl = '';
|
|
9
|
+
this.properties = [
|
|
10
|
+
{
|
|
11
|
+
displayName: 'API Key',
|
|
12
|
+
name: 'apiKey',
|
|
13
|
+
type: 'string',
|
|
14
|
+
typeOptions: {
|
|
15
|
+
password: true,
|
|
16
|
+
},
|
|
17
|
+
default: '',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
displayName: 'Base URL',
|
|
21
|
+
name: 'baseUrl',
|
|
22
|
+
type: 'string',
|
|
23
|
+
default: 'https://crm.ritsaai.com/api',
|
|
24
|
+
description: 'The base URL for the CRM API',
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.RitsaCrmApi = RitsaCrmApi;
|
|
30
|
+
//# sourceMappingURL=RitsaCrmApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RitsaCrmApi.credentials.js","sourceRoot":"","sources":["../../credentials/RitsaCrmApi.credentials.ts"],"names":[],"mappings":";;;AAKA,MAAa,WAAW;IAAxB;QACC,SAAI,GAAG,aAAa,CAAC;QACrB,gBAAW,GAAG,eAAe,CAAC;QAC9B,qBAAgB,GAAG,EAAE,CAAC;QACtB,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE;oBACZ,QAAQ,EAAE,IAAI;iBACd;gBACD,OAAO,EAAE,EAAE;aACX;YACD;gBACC,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,6BAA6B;gBACtC,WAAW,EAAE,8BAA8B;aAC3C;SACD,CAAC;IACH,CAAC;CAAA;AAtBD,kCAsBC"}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RitsaTools = void 0;
|
|
4
|
+
class RitsaTools {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.description = {
|
|
7
|
+
displayName: 'Ritsa CRM Tools',
|
|
8
|
+
name: 'ritsaTools',
|
|
9
|
+
icon: 'file:ritsa.svg',
|
|
10
|
+
group: ['transform'],
|
|
11
|
+
version: 1,
|
|
12
|
+
subtitle: '={{$parameter["operation"]}}',
|
|
13
|
+
description: 'Interact with Ritsa CRM API (Appointments, Messages, Leads)',
|
|
14
|
+
defaults: {
|
|
15
|
+
name: 'Ritsa CRM Tools',
|
|
16
|
+
},
|
|
17
|
+
inputs: ['main'],
|
|
18
|
+
outputs: ['main'],
|
|
19
|
+
credentials: [
|
|
20
|
+
{
|
|
21
|
+
name: 'ritsaCrmApi',
|
|
22
|
+
required: true,
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
properties: [
|
|
26
|
+
{
|
|
27
|
+
displayName: 'Operation',
|
|
28
|
+
name: 'operation',
|
|
29
|
+
type: 'options',
|
|
30
|
+
noDataExpression: true,
|
|
31
|
+
options: [
|
|
32
|
+
{
|
|
33
|
+
name: 'Get Appointments',
|
|
34
|
+
value: 'getAppointments',
|
|
35
|
+
description: 'Get appointments for a specific date',
|
|
36
|
+
action: 'Get appointments',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'Create Appointment',
|
|
40
|
+
value: 'createAppointment',
|
|
41
|
+
description: 'Create a new appointment',
|
|
42
|
+
action: 'Create appointment',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: 'Send Message',
|
|
46
|
+
value: 'sendMessage',
|
|
47
|
+
description: 'Send a message to a customer',
|
|
48
|
+
action: 'Send message',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'Get Customer Details',
|
|
52
|
+
value: 'getCustomerDetails',
|
|
53
|
+
description: 'Retrieve details of a customer/lead',
|
|
54
|
+
action: 'Get customer details',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'Update Lead Status',
|
|
58
|
+
value: 'updateLeadStatus',
|
|
59
|
+
description: 'Update the pipeline stage of a lead',
|
|
60
|
+
action: 'Update lead status',
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
default: 'getAppointments',
|
|
64
|
+
},
|
|
65
|
+
// Get Appointments Properties
|
|
66
|
+
{
|
|
67
|
+
displayName: 'Date',
|
|
68
|
+
name: 'date',
|
|
69
|
+
type: 'string',
|
|
70
|
+
default: '',
|
|
71
|
+
description: 'Date in YYYY-MM-DD format. Leave empty for today.',
|
|
72
|
+
displayOptions: {
|
|
73
|
+
show: {
|
|
74
|
+
operation: ['getAppointments'],
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
// Create Appointment Properties
|
|
79
|
+
{
|
|
80
|
+
displayName: 'Customer Name',
|
|
81
|
+
name: 'customerName',
|
|
82
|
+
type: 'string',
|
|
83
|
+
required: true,
|
|
84
|
+
default: '',
|
|
85
|
+
displayOptions: {
|
|
86
|
+
show: {
|
|
87
|
+
operation: ['createAppointment'],
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
displayName: 'Customer Phone',
|
|
93
|
+
name: 'customerPhone',
|
|
94
|
+
type: 'string',
|
|
95
|
+
required: true,
|
|
96
|
+
default: '',
|
|
97
|
+
displayOptions: {
|
|
98
|
+
show: {
|
|
99
|
+
operation: ['createAppointment'],
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
displayName: 'Date',
|
|
105
|
+
name: 'date',
|
|
106
|
+
type: 'string',
|
|
107
|
+
required: true,
|
|
108
|
+
default: '',
|
|
109
|
+
description: 'Date in YYYY-MM-DD format',
|
|
110
|
+
displayOptions: {
|
|
111
|
+
show: {
|
|
112
|
+
operation: ['createAppointment'],
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
displayName: 'Time',
|
|
118
|
+
name: 'time',
|
|
119
|
+
type: 'string',
|
|
120
|
+
required: true,
|
|
121
|
+
default: '',
|
|
122
|
+
description: 'Time in HH:MM format',
|
|
123
|
+
displayOptions: {
|
|
124
|
+
show: {
|
|
125
|
+
operation: ['createAppointment'],
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
// Send Message Properties
|
|
130
|
+
{
|
|
131
|
+
displayName: 'Customer Phone / ID',
|
|
132
|
+
name: 'customerId',
|
|
133
|
+
type: 'string',
|
|
134
|
+
required: true,
|
|
135
|
+
default: '',
|
|
136
|
+
displayOptions: {
|
|
137
|
+
show: {
|
|
138
|
+
operation: ['sendMessage'],
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
displayName: 'Message Content',
|
|
144
|
+
name: 'messageContent',
|
|
145
|
+
type: 'string',
|
|
146
|
+
required: true,
|
|
147
|
+
default: '',
|
|
148
|
+
displayOptions: {
|
|
149
|
+
show: {
|
|
150
|
+
operation: ['sendMessage'],
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
// Get Customer Details
|
|
155
|
+
{
|
|
156
|
+
displayName: 'Customer Phone',
|
|
157
|
+
name: 'customerPhone',
|
|
158
|
+
type: 'string',
|
|
159
|
+
required: true,
|
|
160
|
+
default: '',
|
|
161
|
+
displayOptions: {
|
|
162
|
+
show: {
|
|
163
|
+
operation: ['getCustomerDetails'],
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
// Update Lead Status
|
|
168
|
+
{
|
|
169
|
+
displayName: 'Lead ID',
|
|
170
|
+
name: 'leadId',
|
|
171
|
+
type: 'string',
|
|
172
|
+
required: true,
|
|
173
|
+
default: '',
|
|
174
|
+
displayOptions: {
|
|
175
|
+
show: {
|
|
176
|
+
operation: ['updateLeadStatus'],
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
displayName: 'New Status',
|
|
182
|
+
name: 'newStatus',
|
|
183
|
+
type: 'string',
|
|
184
|
+
required: true,
|
|
185
|
+
default: '',
|
|
186
|
+
displayOptions: {
|
|
187
|
+
show: {
|
|
188
|
+
operation: ['updateLeadStatus'],
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
],
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
async execute() {
|
|
196
|
+
const items = this.getInputData();
|
|
197
|
+
const returnData = [];
|
|
198
|
+
for (let i = 0; i < items.length; i++) {
|
|
199
|
+
const operation = this.getNodeParameter('operation', i);
|
|
200
|
+
try {
|
|
201
|
+
let responseData;
|
|
202
|
+
if (operation === 'getAppointments') {
|
|
203
|
+
const date = this.getNodeParameter('date', i);
|
|
204
|
+
responseData = { success: true, operation: 'getAppointments', params: { date } };
|
|
205
|
+
}
|
|
206
|
+
else if (operation === 'createAppointment') {
|
|
207
|
+
responseData = { success: true, operation: 'createAppointment' };
|
|
208
|
+
}
|
|
209
|
+
else if (operation === 'sendMessage') {
|
|
210
|
+
responseData = { success: true, operation: 'sendMessage' };
|
|
211
|
+
}
|
|
212
|
+
else if (operation === 'getCustomerDetails') {
|
|
213
|
+
responseData = { success: true, operation: 'getCustomerDetails' };
|
|
214
|
+
}
|
|
215
|
+
else if (operation === 'updateLeadStatus') {
|
|
216
|
+
responseData = { success: true, operation: 'updateLeadStatus' };
|
|
217
|
+
}
|
|
218
|
+
returnData.push({ json: responseData });
|
|
219
|
+
}
|
|
220
|
+
catch (error) {
|
|
221
|
+
if (this.continueOnFail()) {
|
|
222
|
+
returnData.push({ json: { error: error.message } });
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
throw error;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return [returnData];
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
exports.RitsaTools = RitsaTools;
|
|
233
|
+
//# sourceMappingURL=RitsaTools.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RitsaTools.node.js","sourceRoot":"","sources":["../../../nodes/RitsaTools/RitsaTools.node.ts"],"names":[],"mappings":";;;AAOA,MAAa,UAAU;IAAvB;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,iBAAiB;YAC9B,IAAI,EAAE,YAAY;YAClB,IAAI,EAAE,gBAAgB;YACtB,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,8BAA8B;YACxC,WAAW,EAAE,6DAA6D;YAC1E,QAAQ,EAAE;gBACT,IAAI,EAAE,iBAAiB;aACvB;YACD,MAAM,EAAE,CAAC,MAAM,CAAC;YAChB,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,WAAW,EAAE;gBACZ;oBACC,IAAI,EAAE,aAAa;oBACnB,QAAQ,EAAE,IAAI;iBACd;aACD;YACD,UAAU,EAAE;gBACX;oBACC,WAAW,EAAE,WAAW;oBACxB,IAAI,EAAE,WAAW;oBACjB,IAAI,EAAE,SAAS;oBACf,gBAAgB,EAAE,IAAI;oBACtB,OAAO,EAAE;wBACR;4BACC,IAAI,EAAE,kBAAkB;4BACxB,KAAK,EAAE,iBAAiB;4BACxB,WAAW,EAAE,sCAAsC;4BACnD,MAAM,EAAE,kBAAkB;yBAC1B;wBACD;4BACC,IAAI,EAAE,oBAAoB;4BAC1B,KAAK,EAAE,mBAAmB;4BAC1B,WAAW,EAAE,0BAA0B;4BACvC,MAAM,EAAE,oBAAoB;yBAC5B;wBACD;4BACC,IAAI,EAAE,cAAc;4BACpB,KAAK,EAAE,aAAa;4BACpB,WAAW,EAAE,8BAA8B;4BAC3C,MAAM,EAAE,cAAc;yBACtB;wB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I,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAAC;gBACnE,CAAC;qBAAM,IAAI,SAAS,KAAK,kBAAkB,EAAE,CAAC;oBAC7C,YAAY,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;gBACjE,CAAC;gBAED,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,YAAmB,EAAE,CAAC,CAAC;YAChD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;oBAC3B,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAG,KAAe,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;gBAChE,CAAC;qBAAM,CAAC;oBACP,MAAM,KAAK,CAAC;gBACb,CAAC;YACF,CAAC;QACF,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AAjOD,gCAiOC"}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IExecuteFunctions,
|
|
3
|
+
INodeExecutionData,
|
|
4
|
+
INodeType,
|
|
5
|
+
INodeTypeDescription,
|
|
6
|
+
} from 'n8n-workflow';
|
|
7
|
+
|
|
8
|
+
export class RitsaTools implements INodeType {
|
|
9
|
+
description: INodeTypeDescription = {
|
|
10
|
+
displayName: 'Ritsa CRM Tools',
|
|
11
|
+
name: 'ritsaTools',
|
|
12
|
+
icon: 'file:ritsa.svg',
|
|
13
|
+
group: ['transform'],
|
|
14
|
+
version: 1,
|
|
15
|
+
subtitle: '={{$parameter["operation"]}}',
|
|
16
|
+
description: 'Interact with Ritsa CRM API (Appointments, Messages, Leads)',
|
|
17
|
+
defaults: {
|
|
18
|
+
name: 'Ritsa CRM Tools',
|
|
19
|
+
},
|
|
20
|
+
inputs: ['main'],
|
|
21
|
+
outputs: ['main'],
|
|
22
|
+
credentials: [
|
|
23
|
+
{
|
|
24
|
+
name: 'ritsaCrmApi',
|
|
25
|
+
required: true,
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
properties: [
|
|
29
|
+
{
|
|
30
|
+
displayName: 'Operation',
|
|
31
|
+
name: 'operation',
|
|
32
|
+
type: 'options',
|
|
33
|
+
noDataExpression: true,
|
|
34
|
+
options: [
|
|
35
|
+
{
|
|
36
|
+
name: 'Get Appointments',
|
|
37
|
+
value: 'getAppointments',
|
|
38
|
+
description: 'Get appointments for a specific date',
|
|
39
|
+
action: 'Get appointments',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'Create Appointment',
|
|
43
|
+
value: 'createAppointment',
|
|
44
|
+
description: 'Create a new appointment',
|
|
45
|
+
action: 'Create appointment',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: 'Send Message',
|
|
49
|
+
value: 'sendMessage',
|
|
50
|
+
description: 'Send a message to a customer',
|
|
51
|
+
action: 'Send message',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'Get Customer Details',
|
|
55
|
+
value: 'getCustomerDetails',
|
|
56
|
+
description: 'Retrieve details of a customer/lead',
|
|
57
|
+
action: 'Get customer details',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: 'Update Lead Status',
|
|
61
|
+
value: 'updateLeadStatus',
|
|
62
|
+
description: 'Update the pipeline stage of a lead',
|
|
63
|
+
action: 'Update lead status',
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
default: 'getAppointments',
|
|
67
|
+
},
|
|
68
|
+
// Get Appointments Properties
|
|
69
|
+
{
|
|
70
|
+
displayName: 'Date',
|
|
71
|
+
name: 'date',
|
|
72
|
+
type: 'string',
|
|
73
|
+
default: '',
|
|
74
|
+
description: 'Date in YYYY-MM-DD format. Leave empty for today.',
|
|
75
|
+
displayOptions: {
|
|
76
|
+
show: {
|
|
77
|
+
operation: ['getAppointments'],
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
// Create Appointment Properties
|
|
82
|
+
{
|
|
83
|
+
displayName: 'Customer Name',
|
|
84
|
+
name: 'customerName',
|
|
85
|
+
type: 'string',
|
|
86
|
+
required: true,
|
|
87
|
+
default: '',
|
|
88
|
+
displayOptions: {
|
|
89
|
+
show: {
|
|
90
|
+
operation: ['createAppointment'],
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
displayName: 'Customer Phone',
|
|
96
|
+
name: 'customerPhone',
|
|
97
|
+
type: 'string',
|
|
98
|
+
required: true,
|
|
99
|
+
default: '',
|
|
100
|
+
displayOptions: {
|
|
101
|
+
show: {
|
|
102
|
+
operation: ['createAppointment'],
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
displayName: 'Date',
|
|
108
|
+
name: 'date',
|
|
109
|
+
type: 'string',
|
|
110
|
+
required: true,
|
|
111
|
+
default: '',
|
|
112
|
+
description: 'Date in YYYY-MM-DD format',
|
|
113
|
+
displayOptions: {
|
|
114
|
+
show: {
|
|
115
|
+
operation: ['createAppointment'],
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
displayName: 'Time',
|
|
121
|
+
name: 'time',
|
|
122
|
+
type: 'string',
|
|
123
|
+
required: true,
|
|
124
|
+
default: '',
|
|
125
|
+
description: 'Time in HH:MM format',
|
|
126
|
+
displayOptions: {
|
|
127
|
+
show: {
|
|
128
|
+
operation: ['createAppointment'],
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
// Send Message Properties
|
|
133
|
+
{
|
|
134
|
+
displayName: 'Customer Phone / ID',
|
|
135
|
+
name: 'customerId',
|
|
136
|
+
type: 'string',
|
|
137
|
+
required: true,
|
|
138
|
+
default: '',
|
|
139
|
+
displayOptions: {
|
|
140
|
+
show: {
|
|
141
|
+
operation: ['sendMessage'],
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
displayName: 'Message Content',
|
|
147
|
+
name: 'messageContent',
|
|
148
|
+
type: 'string',
|
|
149
|
+
required: true,
|
|
150
|
+
default: '',
|
|
151
|
+
displayOptions: {
|
|
152
|
+
show: {
|
|
153
|
+
operation: ['sendMessage'],
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
// Get Customer Details
|
|
158
|
+
{
|
|
159
|
+
displayName: 'Customer Phone',
|
|
160
|
+
name: 'customerPhone',
|
|
161
|
+
type: 'string',
|
|
162
|
+
required: true,
|
|
163
|
+
default: '',
|
|
164
|
+
displayOptions: {
|
|
165
|
+
show: {
|
|
166
|
+
operation: ['getCustomerDetails'],
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
// Update Lead Status
|
|
171
|
+
{
|
|
172
|
+
displayName: 'Lead ID',
|
|
173
|
+
name: 'leadId',
|
|
174
|
+
type: 'string',
|
|
175
|
+
required: true,
|
|
176
|
+
default: '',
|
|
177
|
+
displayOptions: {
|
|
178
|
+
show: {
|
|
179
|
+
operation: ['updateLeadStatus'],
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
displayName: 'New Status',
|
|
185
|
+
name: 'newStatus',
|
|
186
|
+
type: 'string',
|
|
187
|
+
required: true,
|
|
188
|
+
default: '',
|
|
189
|
+
displayOptions: {
|
|
190
|
+
show: {
|
|
191
|
+
operation: ['updateLeadStatus'],
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
],
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
|
199
|
+
const items = this.getInputData();
|
|
200
|
+
const returnData: INodeExecutionData[] = [];
|
|
201
|
+
|
|
202
|
+
for (let i = 0; i < items.length; i++) {
|
|
203
|
+
const operation = this.getNodeParameter('operation', i) as string;
|
|
204
|
+
|
|
205
|
+
try {
|
|
206
|
+
let responseData;
|
|
207
|
+
|
|
208
|
+
if (operation === 'getAppointments') {
|
|
209
|
+
const date = this.getNodeParameter('date', i) as string;
|
|
210
|
+
responseData = { success: true, operation: 'getAppointments', params: { date } };
|
|
211
|
+
} else if (operation === 'createAppointment') {
|
|
212
|
+
responseData = { success: true, operation: 'createAppointment' };
|
|
213
|
+
} else if (operation === 'sendMessage') {
|
|
214
|
+
responseData = { success: true, operation: 'sendMessage' };
|
|
215
|
+
} else if (operation === 'getCustomerDetails') {
|
|
216
|
+
responseData = { success: true, operation: 'getCustomerDetails' };
|
|
217
|
+
} else if (operation === 'updateLeadStatus') {
|
|
218
|
+
responseData = { success: true, operation: 'updateLeadStatus' };
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
returnData.push({ json: responseData as any });
|
|
222
|
+
} catch (error) {
|
|
223
|
+
if (this.continueOnFail()) {
|
|
224
|
+
returnData.push({ json: { error: (error as Error).message } });
|
|
225
|
+
} else {
|
|
226
|
+
throw error;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
return [returnData];
|
|
232
|
+
}
|
|
233
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "n8n-nodes-ritsa-crm",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsc",
|
|
8
|
+
"dev": "tsc --watch"
|
|
9
|
+
},
|
|
10
|
+
"n8n": {
|
|
11
|
+
"n8nNodesApiVersion": 1,
|
|
12
|
+
"credentials": [
|
|
13
|
+
"dist/credentials/RitsaCrmApi.credentials.js"
|
|
14
|
+
],
|
|
15
|
+
"nodes": [
|
|
16
|
+
"dist/nodes/RitsaTools/RitsaTools.node.js"
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"n8n-community-node-package"
|
|
21
|
+
],
|
|
22
|
+
"author": "",
|
|
23
|
+
"license": "ISC",
|
|
24
|
+
"type": "commonjs",
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"n8n-core": "^2.16.1",
|
|
27
|
+
"n8n-workflow": "^2.16.0"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/node": "^26.0.1",
|
|
31
|
+
"eslint": "^10.6.0",
|
|
32
|
+
"typescript": "^6.0.3"
|
|
33
|
+
}
|
|
34
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2019",
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"lib": ["es2019", "dom"],
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"sourceMap": true,
|
|
8
|
+
"outDir": "./dist",
|
|
9
|
+
"rootDir": "./",
|
|
10
|
+
"strict": true,
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"skipLibCheck": true,
|
|
13
|
+
"forceConsistentCasingInFileNames": true
|
|
14
|
+
},
|
|
15
|
+
"include": [
|
|
16
|
+
"credentials/**/*.ts",
|
|
17
|
+
"nodes/**/*.ts"
|
|
18
|
+
],
|
|
19
|
+
"exclude": [
|
|
20
|
+
"node_modules",
|
|
21
|
+
"dist"
|
|
22
|
+
]
|
|
23
|
+
}
|