n8n-nodes-linq 0.1.5 → 0.1.7
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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Linq = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
4
5
|
class Linq {
|
|
5
6
|
constructor() {
|
|
6
7
|
this.description = {
|
|
@@ -31,182 +32,182 @@ class Linq {
|
|
|
31
32
|
],
|
|
32
33
|
default: 'chat',
|
|
33
34
|
},
|
|
34
|
-
// Chat operations
|
|
35
35
|
{
|
|
36
36
|
displayName: 'Operation',
|
|
37
37
|
name: 'operation',
|
|
38
38
|
type: 'options',
|
|
39
39
|
noDataExpression: true,
|
|
40
|
-
displayOptions: { show: { resource: ['chat'] } },
|
|
41
40
|
options: [
|
|
41
|
+
// Phone Number Operations (Check iMessage Availability comes first alphabetically)
|
|
42
42
|
{
|
|
43
|
-
name: '
|
|
44
|
-
value: '
|
|
45
|
-
action: '
|
|
43
|
+
name: 'Check iMessage Availability',
|
|
44
|
+
value: 'phoneNumberCheckIMessageAvailability',
|
|
45
|
+
action: 'Check imessage availability',
|
|
46
|
+
displayOptions: { show: { resource: ['phoneNumber'] } },
|
|
46
47
|
},
|
|
48
|
+
// Chat Operations
|
|
47
49
|
{
|
|
48
|
-
name: '
|
|
49
|
-
value: '
|
|
50
|
-
action: '
|
|
50
|
+
name: 'Create Chat',
|
|
51
|
+
value: 'chatCreate',
|
|
52
|
+
action: 'Create a chat',
|
|
53
|
+
displayOptions: { show: { resource: ['chat'] } },
|
|
51
54
|
},
|
|
55
|
+
// Chat Message Operations
|
|
52
56
|
{
|
|
53
|
-
name: '
|
|
54
|
-
value: '
|
|
55
|
-
action: '
|
|
57
|
+
name: 'Create Chat Message',
|
|
58
|
+
value: 'chatMessageCreate',
|
|
59
|
+
action: 'Create a chat message',
|
|
60
|
+
displayOptions: { show: { resource: ['chatMessage'] } },
|
|
56
61
|
},
|
|
62
|
+
// Contact Operations
|
|
57
63
|
{
|
|
58
|
-
name: '
|
|
59
|
-
value: '
|
|
60
|
-
action: '
|
|
64
|
+
name: 'Create Contact',
|
|
65
|
+
value: 'contactCreate',
|
|
66
|
+
action: 'Create a contact',
|
|
67
|
+
displayOptions: { show: { resource: ['contact'] } },
|
|
61
68
|
},
|
|
69
|
+
// Webhook Subscription Operations
|
|
62
70
|
{
|
|
63
|
-
name: '
|
|
64
|
-
value: '
|
|
65
|
-
action: '
|
|
71
|
+
name: 'Create Webhook Subscription',
|
|
72
|
+
value: 'webhookSubscriptionCreate',
|
|
73
|
+
action: 'Create a webhook subscription',
|
|
74
|
+
displayOptions: { show: { resource: ['webhookSubscription'] } },
|
|
66
75
|
},
|
|
67
|
-
|
|
68
|
-
default: 'getAll',
|
|
69
|
-
},
|
|
70
|
-
// Chat Message operations
|
|
71
|
-
{
|
|
72
|
-
displayName: 'Operation',
|
|
73
|
-
name: 'operation',
|
|
74
|
-
type: 'options',
|
|
75
|
-
noDataExpression: true,
|
|
76
|
-
displayOptions: { show: { resource: ['chatMessage'] } },
|
|
77
|
-
options: [
|
|
76
|
+
// Chat Message Operations (Delete)
|
|
78
77
|
{
|
|
79
|
-
name: '
|
|
80
|
-
value: '
|
|
81
|
-
action: '
|
|
78
|
+
name: 'Delete Chat Message',
|
|
79
|
+
value: 'chatMessageDelete',
|
|
80
|
+
action: 'Delete a chat message',
|
|
81
|
+
displayOptions: { show: { resource: ['chatMessage'] } },
|
|
82
82
|
},
|
|
83
|
+
// Contact Operations (Delete)
|
|
83
84
|
{
|
|
84
|
-
name: 'Delete',
|
|
85
|
-
value: '
|
|
86
|
-
action: 'Delete a
|
|
85
|
+
name: 'Delete Contact',
|
|
86
|
+
value: 'contactDelete',
|
|
87
|
+
action: 'Delete a contact',
|
|
88
|
+
displayOptions: { show: { resource: ['contact'] } },
|
|
87
89
|
},
|
|
90
|
+
// Webhook Subscription Operations (Delete)
|
|
88
91
|
{
|
|
89
|
-
name: '
|
|
90
|
-
value: '
|
|
91
|
-
action: '
|
|
92
|
+
name: 'Delete Webhook Subscription',
|
|
93
|
+
value: 'webhookSubscriptionDelete',
|
|
94
|
+
action: 'Delete a webhook subscription',
|
|
95
|
+
displayOptions: { show: { resource: ['webhookSubscription'] } },
|
|
92
96
|
},
|
|
97
|
+
// Chat Message Operations (Edit)
|
|
93
98
|
{
|
|
94
|
-
name: '
|
|
95
|
-
value: '
|
|
96
|
-
action: '
|
|
99
|
+
name: 'Edit Chat Message',
|
|
100
|
+
value: 'chatMessageEdit',
|
|
101
|
+
action: 'Edit a chat message',
|
|
102
|
+
displayOptions: { show: { resource: ['chatMessage'] } },
|
|
97
103
|
},
|
|
104
|
+
// Chat Operations (Find)
|
|
98
105
|
{
|
|
99
|
-
name: '
|
|
100
|
-
value: '
|
|
101
|
-
action: '
|
|
106
|
+
name: 'Find Chat',
|
|
107
|
+
value: 'chatFind',
|
|
108
|
+
action: 'Find chats',
|
|
109
|
+
displayOptions: { show: { resource: ['chat'] } },
|
|
102
110
|
},
|
|
111
|
+
// Chat Message Operations (Get Many)
|
|
103
112
|
{
|
|
104
|
-
name: 'Get
|
|
105
|
-
value: '
|
|
106
|
-
action: 'Get
|
|
113
|
+
name: 'Get Many Chat Messages',
|
|
114
|
+
value: 'chatMessageGetAll',
|
|
115
|
+
action: 'Get many chat messages',
|
|
116
|
+
displayOptions: { show: { resource: ['chatMessage'] } },
|
|
107
117
|
},
|
|
118
|
+
// Chat Operations (Get Many)
|
|
108
119
|
{
|
|
109
|
-
name: '
|
|
110
|
-
value: '
|
|
111
|
-
action: '
|
|
120
|
+
name: 'Get Many Chats',
|
|
121
|
+
value: 'chatGetAll',
|
|
122
|
+
action: 'Get many chats',
|
|
123
|
+
displayOptions: { show: { resource: ['chat'] } },
|
|
112
124
|
},
|
|
113
|
-
|
|
114
|
-
default: 'getAll',
|
|
115
|
-
},
|
|
116
|
-
// Phone Number operations
|
|
117
|
-
{
|
|
118
|
-
displayName: 'Operation',
|
|
119
|
-
name: 'operation',
|
|
120
|
-
type: 'options',
|
|
121
|
-
noDataExpression: true,
|
|
122
|
-
displayOptions: { show: { resource: ['phoneNumber'] } },
|
|
123
|
-
options: [
|
|
125
|
+
// Phone Number Operations (Get Many)
|
|
124
126
|
{
|
|
125
|
-
name: '
|
|
126
|
-
value: '
|
|
127
|
-
action: '
|
|
127
|
+
name: 'Get Many Phone Numbers',
|
|
128
|
+
value: 'phoneNumberGetAll',
|
|
129
|
+
action: 'Get many phone numbers',
|
|
130
|
+
displayOptions: { show: { resource: ['phoneNumber'] } },
|
|
128
131
|
},
|
|
132
|
+
// Webhook Subscription Operations (Get Many)
|
|
129
133
|
{
|
|
130
|
-
name: 'Get Many',
|
|
131
|
-
value: '
|
|
132
|
-
action: 'Get many
|
|
134
|
+
name: 'Get Many Webhook Subscriptions',
|
|
135
|
+
value: 'webhookSubscriptionGetAll',
|
|
136
|
+
action: 'Get many webhook subscriptions',
|
|
137
|
+
displayOptions: { show: { resource: ['webhookSubscription'] } },
|
|
133
138
|
},
|
|
134
|
-
|
|
135
|
-
default: 'getAll',
|
|
136
|
-
},
|
|
137
|
-
// Webhook Subscription operations
|
|
138
|
-
{
|
|
139
|
-
displayName: 'Operation',
|
|
140
|
-
name: 'operation',
|
|
141
|
-
type: 'options',
|
|
142
|
-
noDataExpression: true,
|
|
143
|
-
displayOptions: { show: { resource: ['webhookSubscription'] } },
|
|
144
|
-
options: [
|
|
139
|
+
// Chat Operations (Get One)
|
|
145
140
|
{
|
|
146
|
-
name: '
|
|
147
|
-
value: '
|
|
148
|
-
action: '
|
|
141
|
+
name: 'Get One Chat',
|
|
142
|
+
value: 'chatGetOne',
|
|
143
|
+
action: 'Get one chat',
|
|
144
|
+
displayOptions: { show: { resource: ['chat'] } },
|
|
149
145
|
},
|
|
146
|
+
// Chat Message Operations (Get One)
|
|
150
147
|
{
|
|
151
|
-
name: '
|
|
152
|
-
value: '
|
|
153
|
-
action: '
|
|
148
|
+
name: 'Get One Chat Message',
|
|
149
|
+
value: 'chatMessageGetOne',
|
|
150
|
+
action: 'Get one chat message',
|
|
151
|
+
displayOptions: { show: { resource: ['chatMessage'] } },
|
|
154
152
|
},
|
|
153
|
+
// Contact Operations (Get One)
|
|
155
154
|
{
|
|
156
|
-
name: 'Get
|
|
157
|
-
value: '
|
|
158
|
-
action: 'Get
|
|
155
|
+
name: 'Get One Contact',
|
|
156
|
+
value: 'contactGetOne',
|
|
157
|
+
action: 'Get one contact',
|
|
158
|
+
displayOptions: { show: { resource: ['contact'] } },
|
|
159
159
|
},
|
|
160
|
+
// Webhook Subscription Operations (Get One)
|
|
160
161
|
{
|
|
161
|
-
name: 'Get One',
|
|
162
|
-
value: '
|
|
163
|
-
action: 'Get one webhook subscription'
|
|
162
|
+
name: 'Get One Webhook Subscription',
|
|
163
|
+
value: 'webhookSubscriptionGetOne',
|
|
164
|
+
action: 'Get one webhook subscription',
|
|
165
|
+
displayOptions: { show: { resource: ['webhookSubscription'] } },
|
|
164
166
|
},
|
|
167
|
+
// Chat Message Operations (Get Reaction)
|
|
165
168
|
{
|
|
166
|
-
name: '
|
|
167
|
-
value: '
|
|
168
|
-
action: '
|
|
169
|
+
name: 'Get Reaction',
|
|
170
|
+
value: 'chatMessageGetReaction',
|
|
171
|
+
action: 'Get a chat message reaction',
|
|
172
|
+
displayOptions: { show: { resource: ['chatMessage'] } },
|
|
169
173
|
},
|
|
170
|
-
|
|
171
|
-
default: 'getAll',
|
|
172
|
-
},
|
|
173
|
-
// Contact operations
|
|
174
|
-
{
|
|
175
|
-
displayName: 'Operation',
|
|
176
|
-
name: 'operation',
|
|
177
|
-
type: 'options',
|
|
178
|
-
noDataExpression: true,
|
|
179
|
-
displayOptions: { show: { resource: ['contact'] } },
|
|
180
|
-
options: [
|
|
174
|
+
// Chat Message Operations (React)
|
|
181
175
|
{
|
|
182
|
-
name: '
|
|
183
|
-
value: '
|
|
184
|
-
action: '
|
|
176
|
+
name: 'React',
|
|
177
|
+
value: 'chatMessageReact',
|
|
178
|
+
action: 'React to a chat message',
|
|
179
|
+
displayOptions: { show: { resource: ['chatMessage'] } },
|
|
185
180
|
},
|
|
181
|
+
// Chat Operations (Share Contact)
|
|
186
182
|
{
|
|
187
|
-
name: '
|
|
188
|
-
value: '
|
|
189
|
-
action: '
|
|
183
|
+
name: 'Share Contact',
|
|
184
|
+
value: 'chatShareContact',
|
|
185
|
+
action: 'Share a contact',
|
|
186
|
+
displayOptions: { show: { resource: ['chat'] } },
|
|
190
187
|
},
|
|
188
|
+
// Contact Operations (Update)
|
|
191
189
|
{
|
|
192
|
-
name: '
|
|
193
|
-
value: '
|
|
194
|
-
action: '
|
|
190
|
+
name: 'Update Contact',
|
|
191
|
+
value: 'contactUpdate',
|
|
192
|
+
action: 'Update a contact',
|
|
193
|
+
displayOptions: { show: { resource: ['contact'] } },
|
|
195
194
|
},
|
|
195
|
+
// Webhook Subscription Operations (Update)
|
|
196
196
|
{
|
|
197
|
-
name: 'Update',
|
|
198
|
-
value: '
|
|
199
|
-
action: 'Update a
|
|
197
|
+
name: 'Update Webhook Subscription',
|
|
198
|
+
value: 'webhookSubscriptionUpdate',
|
|
199
|
+
action: 'Update a webhook subscription',
|
|
200
|
+
displayOptions: { show: { resource: ['webhookSubscription'] } },
|
|
200
201
|
},
|
|
201
202
|
],
|
|
202
|
-
default: '
|
|
203
|
+
default: 'chatGetAll',
|
|
203
204
|
},
|
|
204
205
|
// Chat parameters
|
|
205
206
|
{
|
|
206
207
|
displayName: 'Chat ID',
|
|
207
208
|
name: 'chatId',
|
|
208
209
|
type: 'string',
|
|
209
|
-
displayOptions: { show: { resource: ['chat'], operation: ['
|
|
210
|
+
displayOptions: { show: { resource: ['chat'], operation: ['chatGetOne'] } },
|
|
210
211
|
default: '',
|
|
211
212
|
description: 'The ID of the chat to retrieve',
|
|
212
213
|
},
|
|
@@ -214,7 +215,7 @@ class Linq {
|
|
|
214
215
|
displayName: 'Phone Number',
|
|
215
216
|
name: 'phoneNumber',
|
|
216
217
|
type: 'string',
|
|
217
|
-
displayOptions: { show: { resource: ['chat'], operation: ['
|
|
218
|
+
displayOptions: { show: { resource: ['chat'], operation: ['chatGetAll'] } },
|
|
218
219
|
default: '',
|
|
219
220
|
description: 'Filter chats by phone number',
|
|
220
221
|
},
|
|
@@ -222,7 +223,7 @@ class Linq {
|
|
|
222
223
|
displayName: 'Page',
|
|
223
224
|
name: 'page',
|
|
224
225
|
type: 'number',
|
|
225
|
-
displayOptions: { show: { resource: ['chat'], operation: ['
|
|
226
|
+
displayOptions: { show: { resource: ['chat'], operation: ['chatGetAll'] } },
|
|
226
227
|
default: 1,
|
|
227
228
|
description: 'Page number for pagination',
|
|
228
229
|
},
|
|
@@ -230,7 +231,7 @@ class Linq {
|
|
|
230
231
|
displayName: 'Per Page',
|
|
231
232
|
name: 'perPage',
|
|
232
233
|
type: 'number',
|
|
233
|
-
displayOptions: { show: { resource: ['chat'], operation: ['
|
|
234
|
+
displayOptions: { show: { resource: ['chat'], operation: ['chatGetAll'] } },
|
|
234
235
|
default: 25,
|
|
235
236
|
description: 'Number of items per page',
|
|
236
237
|
},
|
|
@@ -239,7 +240,7 @@ class Linq {
|
|
|
239
240
|
displayName: 'Send From',
|
|
240
241
|
name: 'sendFrom',
|
|
241
242
|
type: 'string',
|
|
242
|
-
displayOptions: { show: { resource: ['chat'], operation: ['
|
|
243
|
+
displayOptions: { show: { resource: ['chat'], operation: ['chatCreate'] } },
|
|
243
244
|
default: '',
|
|
244
245
|
description: 'The phone number to send from',
|
|
245
246
|
},
|
|
@@ -247,7 +248,7 @@ class Linq {
|
|
|
247
248
|
displayName: 'Display Name',
|
|
248
249
|
name: 'displayName',
|
|
249
250
|
type: 'string',
|
|
250
|
-
displayOptions: { show: { resource: ['chat'], operation: ['
|
|
251
|
+
displayOptions: { show: { resource: ['chat'], operation: ['chatCreate'] } },
|
|
251
252
|
default: '',
|
|
252
253
|
description: 'The display name for the chat',
|
|
253
254
|
},
|
|
@@ -255,7 +256,7 @@ class Linq {
|
|
|
255
256
|
displayName: 'Phone Numbers',
|
|
256
257
|
name: 'phoneNumbers',
|
|
257
258
|
type: 'string',
|
|
258
|
-
displayOptions: { show: { resource: ['chat'], operation: ['
|
|
259
|
+
displayOptions: { show: { resource: ['chat'], operation: ['chatCreate'] } },
|
|
259
260
|
default: '',
|
|
260
261
|
description: 'Comma-separated list of phone numbers',
|
|
261
262
|
},
|
|
@@ -263,7 +264,7 @@ class Linq {
|
|
|
263
264
|
displayName: 'Message Text',
|
|
264
265
|
name: 'messageText',
|
|
265
266
|
type: 'string',
|
|
266
|
-
displayOptions: { show: { resource: ['chat'], operation: ['
|
|
267
|
+
displayOptions: { show: { resource: ['chat'], operation: ['chatCreate'] } },
|
|
267
268
|
default: '',
|
|
268
269
|
description: 'The text of the message to send',
|
|
269
270
|
},
|
|
@@ -272,7 +273,7 @@ class Linq {
|
|
|
272
273
|
displayName: 'Chat Message ID',
|
|
273
274
|
name: 'chatMessageId',
|
|
274
275
|
type: 'string',
|
|
275
|
-
displayOptions: { show: { resource: ['chatMessage'], operation: ['
|
|
276
|
+
displayOptions: { show: { resource: ['chatMessage'], operation: ['chatMessageGetOne', 'chatMessageDelete', 'chatMessageEdit', 'chatMessageReact', 'chatMessageGetReaction'] } },
|
|
276
277
|
default: '',
|
|
277
278
|
description: 'The ID of the chat message',
|
|
278
279
|
},
|
|
@@ -280,7 +281,7 @@ class Linq {
|
|
|
280
281
|
displayName: 'Chat ID',
|
|
281
282
|
name: 'chatId',
|
|
282
283
|
type: 'string',
|
|
283
|
-
displayOptions: { show: { resource: ['chatMessage'], operation: ['
|
|
284
|
+
displayOptions: { show: { resource: ['chatMessage'], operation: ['chatMessageGetAll', 'chatMessageCreate'] } },
|
|
284
285
|
default: '',
|
|
285
286
|
description: 'The ID of the chat',
|
|
286
287
|
},
|
|
@@ -288,7 +289,7 @@ class Linq {
|
|
|
288
289
|
displayName: 'Message Text',
|
|
289
290
|
name: 'messageText',
|
|
290
291
|
type: 'string',
|
|
291
|
-
displayOptions: { show: { resource: ['chatMessage'], operation: ['
|
|
292
|
+
displayOptions: { show: { resource: ['chatMessage'], operation: ['chatMessageCreate', 'chatMessageEdit'] } },
|
|
292
293
|
default: '',
|
|
293
294
|
description: 'The text of the message',
|
|
294
295
|
},
|
|
@@ -296,7 +297,7 @@ class Linq {
|
|
|
296
297
|
displayName: 'Reaction',
|
|
297
298
|
name: 'reaction',
|
|
298
299
|
type: 'string',
|
|
299
|
-
displayOptions: { show: { resource: ['chatMessage'], operation: ['
|
|
300
|
+
displayOptions: { show: { resource: ['chatMessage'], operation: ['chatMessageReact'] } },
|
|
300
301
|
default: '',
|
|
301
302
|
description: 'The reaction to add',
|
|
302
303
|
},
|
|
@@ -305,7 +306,7 @@ class Linq {
|
|
|
305
306
|
displayName: 'Phone Number',
|
|
306
307
|
name: 'phoneNumber',
|
|
307
308
|
type: 'string',
|
|
308
|
-
displayOptions: { show: { resource: ['phoneNumber'], operation: ['
|
|
309
|
+
displayOptions: { show: { resource: ['phoneNumber'], operation: ['phoneNumberCheckIMessageAvailability'] } },
|
|
309
310
|
default: '',
|
|
310
311
|
description: 'The phone number to check',
|
|
311
312
|
},
|
|
@@ -314,7 +315,7 @@ class Linq {
|
|
|
314
315
|
displayName: 'Webhook Subscription ID',
|
|
315
316
|
name: 'webhookSubscriptionId',
|
|
316
317
|
type: 'string',
|
|
317
|
-
displayOptions: { show: { resource: ['webhookSubscription'], operation: ['
|
|
318
|
+
displayOptions: { show: { resource: ['webhookSubscription'], operation: ['webhookSubscriptionGetOne', 'webhookSubscriptionUpdate', 'webhookSubscriptionDelete'] } },
|
|
318
319
|
default: '',
|
|
319
320
|
description: 'The ID of the webhook subscription',
|
|
320
321
|
},
|
|
@@ -322,7 +323,7 @@ class Linq {
|
|
|
322
323
|
displayName: 'Webhook URL',
|
|
323
324
|
name: 'webhookUrl',
|
|
324
325
|
type: 'string',
|
|
325
|
-
displayOptions: { show: { resource: ['webhookSubscription'], operation: ['
|
|
326
|
+
displayOptions: { show: { resource: ['webhookSubscription'], operation: ['webhookSubscriptionCreate', 'webhookSubscriptionUpdate'] } },
|
|
326
327
|
default: '',
|
|
327
328
|
description: 'The URL for the webhook',
|
|
328
329
|
},
|
|
@@ -330,7 +331,7 @@ class Linq {
|
|
|
330
331
|
displayName: 'Events',
|
|
331
332
|
name: 'events',
|
|
332
333
|
type: 'string',
|
|
333
|
-
displayOptions: { show: { resource: ['webhookSubscription'], operation: ['
|
|
334
|
+
displayOptions: { show: { resource: ['webhookSubscription'], operation: ['webhookSubscriptionCreate', 'webhookSubscriptionUpdate'] } },
|
|
334
335
|
default: '',
|
|
335
336
|
description: 'Comma-separated list of events',
|
|
336
337
|
},
|
|
@@ -338,7 +339,7 @@ class Linq {
|
|
|
338
339
|
displayName: 'Version',
|
|
339
340
|
name: 'version',
|
|
340
341
|
type: 'number',
|
|
341
|
-
displayOptions: { show: { resource: ['webhookSubscription'], operation: ['
|
|
342
|
+
displayOptions: { show: { resource: ['webhookSubscription'], operation: ['webhookSubscriptionCreate', 'webhookSubscriptionUpdate'] } },
|
|
342
343
|
default: 2,
|
|
343
344
|
description: 'The version of the webhook',
|
|
344
345
|
},
|
|
@@ -346,7 +347,7 @@ class Linq {
|
|
|
346
347
|
displayName: 'Active',
|
|
347
348
|
name: 'active',
|
|
348
349
|
type: 'boolean',
|
|
349
|
-
displayOptions: { show: { resource: ['webhookSubscription'], operation: ['
|
|
350
|
+
displayOptions: { show: { resource: ['webhookSubscription'], operation: ['webhookSubscriptionCreate', 'webhookSubscriptionUpdate'] } },
|
|
350
351
|
default: true,
|
|
351
352
|
description: 'Whether the webhook is active',
|
|
352
353
|
},
|
|
@@ -355,7 +356,7 @@ class Linq {
|
|
|
355
356
|
displayName: 'Contact ID',
|
|
356
357
|
name: 'contactId',
|
|
357
358
|
type: 'string',
|
|
358
|
-
displayOptions: { show: { resource: ['contact'], operation: ['
|
|
359
|
+
displayOptions: { show: { resource: ['contact'], operation: ['contactGetOne', 'contactUpdate', 'contactDelete'] } },
|
|
359
360
|
default: '',
|
|
360
361
|
description: 'The ID of the contact',
|
|
361
362
|
},
|
|
@@ -363,7 +364,7 @@ class Linq {
|
|
|
363
364
|
displayName: 'First Name',
|
|
364
365
|
name: 'firstName',
|
|
365
366
|
type: 'string',
|
|
366
|
-
displayOptions: { show: { resource: ['contact'], operation: ['
|
|
367
|
+
displayOptions: { show: { resource: ['contact'], operation: ['contactCreate', 'contactUpdate'] } },
|
|
367
368
|
default: '',
|
|
368
369
|
description: 'The first name of the contact',
|
|
369
370
|
},
|
|
@@ -371,7 +372,7 @@ class Linq {
|
|
|
371
372
|
displayName: 'Last Name',
|
|
372
373
|
name: 'lastName',
|
|
373
374
|
type: 'string',
|
|
374
|
-
displayOptions: { show: { resource: ['contact'], operation: ['
|
|
375
|
+
displayOptions: { show: { resource: ['contact'], operation: ['contactCreate', 'contactUpdate'] } },
|
|
375
376
|
default: '',
|
|
376
377
|
description: 'The last name of the contact',
|
|
377
378
|
},
|
|
@@ -379,7 +380,7 @@ class Linq {
|
|
|
379
380
|
displayName: 'Email',
|
|
380
381
|
name: 'email',
|
|
381
382
|
type: 'string',
|
|
382
|
-
displayOptions: { show: { resource: ['contact'], operation: ['
|
|
383
|
+
displayOptions: { show: { resource: ['contact'], operation: ['contactCreate', 'contactUpdate'] } },
|
|
383
384
|
default: '',
|
|
384
385
|
placeholder: 'name@email.com',
|
|
385
386
|
description: 'The email of the contact',
|
|
@@ -388,7 +389,7 @@ class Linq {
|
|
|
388
389
|
displayName: 'Phone Number',
|
|
389
390
|
name: 'phoneNumber',
|
|
390
391
|
type: 'string',
|
|
391
|
-
displayOptions: { show: { resource: ['contact'], operation: ['
|
|
392
|
+
displayOptions: { show: { resource: ['contact'], operation: ['contactCreate', 'contactUpdate'] } },
|
|
392
393
|
default: '',
|
|
393
394
|
description: 'The phone number of the contact',
|
|
394
395
|
},
|
|
@@ -396,7 +397,7 @@ class Linq {
|
|
|
396
397
|
displayName: 'Company',
|
|
397
398
|
name: 'company',
|
|
398
399
|
type: 'string',
|
|
399
|
-
displayOptions: { show: { resource: ['contact'], operation: ['
|
|
400
|
+
displayOptions: { show: { resource: ['contact'], operation: ['contactCreate', 'contactUpdate'] } },
|
|
400
401
|
default: '',
|
|
401
402
|
description: 'The company of the contact',
|
|
402
403
|
},
|
|
@@ -404,7 +405,7 @@ class Linq {
|
|
|
404
405
|
displayName: 'Title',
|
|
405
406
|
name: 'title',
|
|
406
407
|
type: 'string',
|
|
407
|
-
displayOptions: { show: { resource: ['contact'], operation: ['
|
|
408
|
+
displayOptions: { show: { resource: ['contact'], operation: ['contactCreate', 'contactUpdate'] } },
|
|
408
409
|
default: '',
|
|
409
410
|
description: 'The title of the contact',
|
|
410
411
|
},
|
|
@@ -412,7 +413,7 @@ class Linq {
|
|
|
412
413
|
displayName: 'Location',
|
|
413
414
|
name: 'location',
|
|
414
415
|
type: 'string',
|
|
415
|
-
displayOptions: { show: { resource: ['contact'], operation: ['
|
|
416
|
+
displayOptions: { show: { resource: ['contact'], operation: ['contactCreate', 'contactUpdate'] } },
|
|
416
417
|
default: '',
|
|
417
418
|
description: 'The location of the contact',
|
|
418
419
|
},
|
|
@@ -420,6 +421,7 @@ class Linq {
|
|
|
420
421
|
};
|
|
421
422
|
}
|
|
422
423
|
async execute() {
|
|
424
|
+
var _a;
|
|
423
425
|
const items = this.getInputData();
|
|
424
426
|
const returnData = [];
|
|
425
427
|
const credentials = await this.getCredentials('linqApi');
|
|
@@ -427,379 +429,387 @@ class Linq {
|
|
|
427
429
|
const resource = this.getNodeParameter('resource', i);
|
|
428
430
|
const operation = this.getNodeParameter('operation', i);
|
|
429
431
|
let responseData;
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
if (
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
432
|
+
try {
|
|
433
|
+
// Chat operations
|
|
434
|
+
if (resource === 'chat') {
|
|
435
|
+
if (operation === 'chatGetAll') {
|
|
436
|
+
const phoneNumber = this.getNodeParameter('phoneNumber', i, '');
|
|
437
|
+
const page = this.getNodeParameter('page', i, 1);
|
|
438
|
+
const perPage = this.getNodeParameter('perPage', i, 25);
|
|
439
|
+
const qs = { page, per_page: perPage };
|
|
440
|
+
if (phoneNumber)
|
|
441
|
+
qs.phone_number = phoneNumber;
|
|
442
|
+
responseData = await this.helpers.request({
|
|
443
|
+
method: 'GET',
|
|
444
|
+
url: 'https://api.linqapp.com/api/partner/v2/chats',
|
|
445
|
+
qs,
|
|
446
|
+
headers: { 'X-LINQ-INTEGRATION-TOKEN': credentials.integrationToken },
|
|
447
|
+
json: true,
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
if (operation === 'chatGetOne') {
|
|
451
|
+
const chatId = this.getNodeParameter('chatId', i);
|
|
452
|
+
responseData = await this.helpers.request({
|
|
453
|
+
method: 'GET',
|
|
454
|
+
url: `https://api.linqapp.com/api/partner/v2/chats/${chatId}`,
|
|
455
|
+
headers: { 'X-LINQ-INTEGRATION-TOKEN': credentials.integrationToken },
|
|
456
|
+
json: true,
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
if (operation === 'chatFind') {
|
|
460
|
+
const phoneNumber = this.getNodeParameter('phoneNumber', i, '');
|
|
461
|
+
const qs = {};
|
|
462
|
+
if (phoneNumber)
|
|
463
|
+
qs.phone_number = phoneNumber;
|
|
464
|
+
responseData = await this.helpers.request({
|
|
465
|
+
method: 'GET',
|
|
466
|
+
url: 'https://api.linqapp.com/api/partner/v2/chats/find',
|
|
467
|
+
qs,
|
|
468
|
+
headers: { 'X-LINQ-INTEGRATION-TOKEN': credentials.integrationToken },
|
|
469
|
+
json: true,
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
if (operation === 'chatCreate') {
|
|
473
|
+
const sendFrom = this.getNodeParameter('sendFrom', i);
|
|
474
|
+
const displayName = this.getNodeParameter('displayName', i);
|
|
475
|
+
const phoneNumbers = this.getNodeParameter('phoneNumbers', i);
|
|
476
|
+
const messageText = this.getNodeParameter('messageText', i);
|
|
477
|
+
const body = {
|
|
478
|
+
chat: {
|
|
479
|
+
phone_numbers: phoneNumbers.split(',').map(p => p.trim())
|
|
480
|
+
},
|
|
481
|
+
message: {
|
|
482
|
+
text: messageText
|
|
483
|
+
}
|
|
484
|
+
};
|
|
485
|
+
if (sendFrom) {
|
|
486
|
+
body.send_from = sendFrom;
|
|
487
|
+
}
|
|
488
|
+
if (displayName) {
|
|
489
|
+
body.chat.display_name = displayName;
|
|
480
490
|
}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
491
|
+
responseData = await this.helpers.request({
|
|
492
|
+
method: 'POST',
|
|
493
|
+
url: 'https://api.linqapp.com/api/partner/v2/chats',
|
|
494
|
+
headers: {
|
|
495
|
+
'X-LINQ-INTEGRATION-TOKEN': credentials.integrationToken,
|
|
496
|
+
'Content-Type': 'application/json'
|
|
497
|
+
},
|
|
498
|
+
body: body,
|
|
499
|
+
json: true,
|
|
500
|
+
});
|
|
484
501
|
}
|
|
485
|
-
if (
|
|
486
|
-
|
|
502
|
+
if (operation === 'chatShareContact') {
|
|
503
|
+
responseData = await this.helpers.request({
|
|
504
|
+
method: 'POST',
|
|
505
|
+
url: 'https://api.linqapp.com/api/partner/v2/chats/share-contact',
|
|
506
|
+
headers: {
|
|
507
|
+
'X-LINQ-INTEGRATION-TOKEN': credentials.integrationToken,
|
|
508
|
+
'Content-Type': 'application/json'
|
|
509
|
+
},
|
|
510
|
+
json: true,
|
|
511
|
+
});
|
|
487
512
|
}
|
|
488
|
-
responseData = await this.helpers.request({
|
|
489
|
-
method: 'POST',
|
|
490
|
-
url: 'https://api.linqapp.com/api/partner/v2/chats',
|
|
491
|
-
headers: {
|
|
492
|
-
'X-LINQ-INTEGRATION-TOKEN': credentials.integrationToken,
|
|
493
|
-
'Content-Type': 'application/json'
|
|
494
|
-
},
|
|
495
|
-
body: JSON.stringify(body),
|
|
496
|
-
json: true,
|
|
497
|
-
});
|
|
498
|
-
}
|
|
499
|
-
if (operation === 'shareContact') {
|
|
500
|
-
responseData = await this.helpers.request({
|
|
501
|
-
method: 'POST',
|
|
502
|
-
url: 'https://api.linqapp.com/api/partner/v2/chats/share-contact',
|
|
503
|
-
headers: {
|
|
504
|
-
'X-LINQ-INTEGRATION-TOKEN': credentials.integrationToken,
|
|
505
|
-
'Content-Type': 'application/json'
|
|
506
|
-
},
|
|
507
|
-
json: true,
|
|
508
|
-
});
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
// Chat Message operations
|
|
512
|
-
if (resource === 'chatMessage') {
|
|
513
|
-
if (operation === 'getAll') {
|
|
514
|
-
const chatId = this.getNodeParameter('chatId', i);
|
|
515
|
-
responseData = await this.helpers.request({
|
|
516
|
-
method: 'GET',
|
|
517
|
-
url: `https://api.linqapp.com/api/partner/v2/chat_messages`,
|
|
518
|
-
qs: { chat_id: chatId },
|
|
519
|
-
headers: { 'X-LINQ-INTEGRATION-TOKEN': credentials.integrationToken },
|
|
520
|
-
json: true,
|
|
521
|
-
});
|
|
522
513
|
}
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
const phoneNumber = this.getNodeParameter('phoneNumber', i);
|
|
615
|
-
const body = {
|
|
616
|
-
phone_number: phoneNumber
|
|
617
|
-
};
|
|
618
|
-
responseData = await this.helpers.request({
|
|
619
|
-
method: 'POST',
|
|
620
|
-
url: 'https://api.linqapp.com/api/partner/v2/i_message_availability/check',
|
|
621
|
-
headers: {
|
|
622
|
-
'X-LINQ-INTEGRATION-TOKEN': credentials.integrationToken,
|
|
623
|
-
'Content-Type': 'application/json'
|
|
624
|
-
},
|
|
625
|
-
body: JSON.stringify(body),
|
|
626
|
-
json: true,
|
|
627
|
-
});
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
// Webhook Subscription operations
|
|
631
|
-
if (resource === 'webhookSubscription') {
|
|
632
|
-
if (operation === 'getAll') {
|
|
633
|
-
responseData = await this.helpers.request({
|
|
634
|
-
method: 'GET',
|
|
635
|
-
url: 'https://api.linqapp.com/api/partner/v2/webhook_subscriptions',
|
|
636
|
-
headers: { 'X-LINQ-INTEGRATION-TOKEN': credentials.integrationToken },
|
|
637
|
-
json: true,
|
|
638
|
-
});
|
|
639
|
-
}
|
|
640
|
-
if (operation === 'getOne') {
|
|
641
|
-
const webhookSubscriptionId = this.getNodeParameter('webhookSubscriptionId', i);
|
|
642
|
-
responseData = await this.helpers.request({
|
|
643
|
-
method: 'GET',
|
|
644
|
-
url: `https://api.linqapp.com/api/partner/v2/webhook_subscriptions/${webhookSubscriptionId}`,
|
|
645
|
-
headers: { 'X-LINQ-INTEGRATION-TOKEN': credentials.integrationToken },
|
|
646
|
-
json: true,
|
|
647
|
-
});
|
|
514
|
+
// Chat Message operations
|
|
515
|
+
if (resource === 'chatMessage') {
|
|
516
|
+
if (operation === 'chatMessageGetAll') {
|
|
517
|
+
const chatId = this.getNodeParameter('chatId', i);
|
|
518
|
+
responseData = await this.helpers.request({
|
|
519
|
+
method: 'GET',
|
|
520
|
+
url: `https://api.linqapp.com/api/partner/v2/chat_messages`,
|
|
521
|
+
qs: { chat_id: chatId },
|
|
522
|
+
headers: { 'X-LINQ-INTEGRATION-TOKEN': credentials.integrationToken },
|
|
523
|
+
json: true,
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
if (operation === 'chatMessageGetOne') {
|
|
527
|
+
const chatMessageId = this.getNodeParameter('chatMessageId', i);
|
|
528
|
+
responseData = await this.helpers.request({
|
|
529
|
+
method: 'GET',
|
|
530
|
+
url: `https://api.linqapp.com/api/partner/v2/chat_messages/${chatMessageId}`,
|
|
531
|
+
headers: { 'X-LINQ-INTEGRATION-TOKEN': credentials.integrationToken },
|
|
532
|
+
json: true,
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
if (operation === 'chatMessageCreate') {
|
|
536
|
+
const chatId = this.getNodeParameter('chatId', i);
|
|
537
|
+
const messageText = this.getNodeParameter('messageText', i);
|
|
538
|
+
const body = {
|
|
539
|
+
chat_id: chatId,
|
|
540
|
+
text: messageText
|
|
541
|
+
};
|
|
542
|
+
responseData = await this.helpers.request({
|
|
543
|
+
method: 'POST',
|
|
544
|
+
url: 'https://api.linqapp.com/api/partner/v2/chat_messages',
|
|
545
|
+
headers: {
|
|
546
|
+
'X-LINQ-INTEGRATION-TOKEN': credentials.integrationToken,
|
|
547
|
+
'Content-Type': 'application/json'
|
|
548
|
+
},
|
|
549
|
+
body: body,
|
|
550
|
+
json: true,
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
if (operation === 'chatMessageDelete') {
|
|
554
|
+
const chatMessageId = this.getNodeParameter('chatMessageId', i);
|
|
555
|
+
responseData = await this.helpers.request({
|
|
556
|
+
method: 'DELETE',
|
|
557
|
+
url: `https://api.linqapp.com/api/partner/v2/chat_messages/${chatMessageId}`,
|
|
558
|
+
headers: { 'X-LINQ-INTEGRATION-TOKEN': credentials.integrationToken },
|
|
559
|
+
json: true,
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
if (operation === 'chatMessageEdit') {
|
|
563
|
+
const chatMessageId = this.getNodeParameter('chatMessageId', i);
|
|
564
|
+
const messageText = this.getNodeParameter('messageText', i);
|
|
565
|
+
const body = {
|
|
566
|
+
text: messageText
|
|
567
|
+
};
|
|
568
|
+
responseData = await this.helpers.request({
|
|
569
|
+
method: 'POST',
|
|
570
|
+
url: `https://api.linqapp.com/api/partner/v2/chat_messages/${chatMessageId}/edit`,
|
|
571
|
+
headers: {
|
|
572
|
+
'X-LINQ-INTEGRATION-TOKEN': credentials.integrationToken,
|
|
573
|
+
'Content-Type': 'application/json'
|
|
574
|
+
},
|
|
575
|
+
body: body,
|
|
576
|
+
json: true,
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
if (operation === 'chatMessageReact') {
|
|
580
|
+
const chatMessageId = this.getNodeParameter('chatMessageId', i);
|
|
581
|
+
const reaction = this.getNodeParameter('reaction', i);
|
|
582
|
+
const body = {
|
|
583
|
+
reaction: reaction
|
|
584
|
+
};
|
|
585
|
+
responseData = await this.helpers.request({
|
|
586
|
+
method: 'POST',
|
|
587
|
+
url: `https://api.linqapp.com/api/partner/v2/chat_messages/${chatMessageId}/react`,
|
|
588
|
+
headers: {
|
|
589
|
+
'X-LINQ-INTEGRATION-TOKEN': credentials.integrationToken,
|
|
590
|
+
'Content-Type': 'application/json'
|
|
591
|
+
},
|
|
592
|
+
body: body,
|
|
593
|
+
json: true,
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
if (operation === 'chatMessageGetReaction') {
|
|
597
|
+
const chatMessageId = this.getNodeParameter('chatMessageId', i);
|
|
598
|
+
responseData = await this.helpers.request({
|
|
599
|
+
method: 'GET',
|
|
600
|
+
url: `https://api.linqapp.com/api/partner/v2/chat_messages/${chatMessageId}/reaction`,
|
|
601
|
+
headers: { 'X-LINQ-INTEGRATION-TOKEN': credentials.integrationToken },
|
|
602
|
+
json: true,
|
|
603
|
+
});
|
|
604
|
+
}
|
|
648
605
|
}
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
}
|
|
659
|
-
if (
|
|
660
|
-
|
|
606
|
+
// Phone Number operations
|
|
607
|
+
if (resource === 'phoneNumber') {
|
|
608
|
+
if (operation === 'phoneNumberGetAll') {
|
|
609
|
+
responseData = await this.helpers.request({
|
|
610
|
+
method: 'GET',
|
|
611
|
+
url: 'https://api.linqapp.com/api/partner/v2/phone_numbers',
|
|
612
|
+
headers: { 'X-LINQ-INTEGRATION-TOKEN': credentials.integrationToken },
|
|
613
|
+
json: true,
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
if (operation === 'phoneNumberCheckIMessageAvailability') {
|
|
617
|
+
const phoneNumber = this.getNodeParameter('phoneNumber', i);
|
|
618
|
+
const body = {
|
|
619
|
+
phone_number: phoneNumber
|
|
620
|
+
};
|
|
621
|
+
responseData = await this.helpers.request({
|
|
622
|
+
method: 'POST',
|
|
623
|
+
url: 'https://api.linqapp.com/api/partner/v2/i_message_availability/check',
|
|
624
|
+
headers: {
|
|
625
|
+
'X-LINQ-INTEGRATION-TOKEN': credentials.integrationToken,
|
|
626
|
+
'Content-Type': 'application/json'
|
|
627
|
+
},
|
|
628
|
+
body: body,
|
|
629
|
+
json: true,
|
|
630
|
+
});
|
|
661
631
|
}
|
|
662
|
-
responseData = await this.helpers.request({
|
|
663
|
-
method: 'POST',
|
|
664
|
-
url: 'https://api.linqapp.com/api/partner/v2/webhook_subscriptions',
|
|
665
|
-
headers: {
|
|
666
|
-
'X-LINQ-INTEGRATION-TOKEN': credentials.integrationToken,
|
|
667
|
-
'Content-Type': 'application/json'
|
|
668
|
-
},
|
|
669
|
-
body: JSON.stringify(body),
|
|
670
|
-
json: true,
|
|
671
|
-
});
|
|
672
632
|
}
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
};
|
|
683
|
-
if (webhookUrl) {
|
|
684
|
-
body.webhook_url = webhookUrl;
|
|
633
|
+
// Webhook Subscription operations
|
|
634
|
+
if (resource === 'webhookSubscription') {
|
|
635
|
+
if (operation === 'webhookSubscriptionGetAll') {
|
|
636
|
+
responseData = await this.helpers.request({
|
|
637
|
+
method: 'GET',
|
|
638
|
+
url: 'https://api.linqapp.com/api/partner/v2/webhook_subscriptions',
|
|
639
|
+
headers: { 'X-LINQ-INTEGRATION-TOKEN': credentials.integrationToken },
|
|
640
|
+
json: true,
|
|
641
|
+
});
|
|
685
642
|
}
|
|
686
|
-
if (
|
|
687
|
-
|
|
643
|
+
if (operation === 'webhookSubscriptionGetOne') {
|
|
644
|
+
const webhookSubscriptionId = this.getNodeParameter('webhookSubscriptionId', i);
|
|
645
|
+
responseData = await this.helpers.request({
|
|
646
|
+
method: 'GET',
|
|
647
|
+
url: `https://api.linqapp.com/api/partner/v2/webhook_subscriptions/${webhookSubscriptionId}`,
|
|
648
|
+
headers: { 'X-LINQ-INTEGRATION-TOKEN': credentials.integrationToken },
|
|
649
|
+
json: true,
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
if (operation === 'webhookSubscriptionCreate') {
|
|
653
|
+
const webhookUrl = this.getNodeParameter('webhookUrl', i);
|
|
654
|
+
const events = this.getNodeParameter('events', i);
|
|
655
|
+
const version = this.getNodeParameter('version', i);
|
|
656
|
+
const active = this.getNodeParameter('active', i);
|
|
657
|
+
const body = {
|
|
658
|
+
webhook_url: webhookUrl,
|
|
659
|
+
version: version,
|
|
660
|
+
active: active
|
|
661
|
+
};
|
|
662
|
+
if (events) {
|
|
663
|
+
body.events = events.split(',').map(e => e.trim());
|
|
664
|
+
}
|
|
665
|
+
responseData = await this.helpers.request({
|
|
666
|
+
method: 'POST',
|
|
667
|
+
url: 'https://api.linqapp.com/api/partner/v2/webhook_subscriptions',
|
|
668
|
+
headers: {
|
|
669
|
+
'X-LINQ-INTEGRATION-TOKEN': credentials.integrationToken,
|
|
670
|
+
'Content-Type': 'application/json'
|
|
671
|
+
},
|
|
672
|
+
body: body,
|
|
673
|
+
json: true,
|
|
674
|
+
});
|
|
675
|
+
}
|
|
676
|
+
if (operation === 'webhookSubscriptionUpdate') {
|
|
677
|
+
const webhookSubscriptionId = this.getNodeParameter('webhookSubscriptionId', i);
|
|
678
|
+
const webhookUrl = this.getNodeParameter('webhookUrl', i);
|
|
679
|
+
const events = this.getNodeParameter('events', i);
|
|
680
|
+
const version = this.getNodeParameter('version', i);
|
|
681
|
+
const active = this.getNodeParameter('active', i);
|
|
682
|
+
const body = {
|
|
683
|
+
version: version,
|
|
684
|
+
active: active
|
|
685
|
+
};
|
|
686
|
+
if (webhookUrl) {
|
|
687
|
+
body.webhook_url = webhookUrl;
|
|
688
|
+
}
|
|
689
|
+
if (events) {
|
|
690
|
+
body.events = events.split(',').map(e => e.trim());
|
|
691
|
+
}
|
|
692
|
+
responseData = await this.helpers.request({
|
|
693
|
+
method: 'PUT',
|
|
694
|
+
url: `https://api.linqapp.com/api/partner/v2/webhook_subscriptions/${webhookSubscriptionId}`,
|
|
695
|
+
headers: {
|
|
696
|
+
'X-LINQ-INTEGRATION-TOKEN': credentials.integrationToken,
|
|
697
|
+
'Content-Type': 'application/json'
|
|
698
|
+
},
|
|
699
|
+
body: body,
|
|
700
|
+
json: true,
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
if (operation === 'webhookSubscriptionDelete') {
|
|
704
|
+
const webhookSubscriptionId = this.getNodeParameter('webhookSubscriptionId', i);
|
|
705
|
+
responseData = await this.helpers.request({
|
|
706
|
+
method: 'DELETE',
|
|
707
|
+
url: `https://api.linqapp.com/api/partner/v2/webhook_subscriptions/${webhookSubscriptionId}`,
|
|
708
|
+
headers: { 'X-LINQ-INTEGRATION-TOKEN': credentials.integrationToken },
|
|
709
|
+
json: true,
|
|
710
|
+
});
|
|
688
711
|
}
|
|
689
|
-
responseData = await this.helpers.request({
|
|
690
|
-
method: 'PUT',
|
|
691
|
-
url: `https://api.linqapp.com/api/partner/v2/webhook_subscriptions/${webhookSubscriptionId}`,
|
|
692
|
-
headers: {
|
|
693
|
-
'X-LINQ-INTEGRATION-TOKEN': credentials.integrationToken,
|
|
694
|
-
'Content-Type': 'application/json'
|
|
695
|
-
},
|
|
696
|
-
body: JSON.stringify(body),
|
|
697
|
-
json: true,
|
|
698
|
-
});
|
|
699
712
|
}
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
713
|
+
// Contact operations
|
|
714
|
+
if (resource === 'contact') {
|
|
715
|
+
if (operation === 'contactCreate') {
|
|
716
|
+
const firstName = this.getNodeParameter('firstName', i);
|
|
717
|
+
const lastName = this.getNodeParameter('lastName', i);
|
|
718
|
+
const email = this.getNodeParameter('email', i);
|
|
719
|
+
const phoneNumber = this.getNodeParameter('phoneNumber', i);
|
|
720
|
+
const company = this.getNodeParameter('company', i);
|
|
721
|
+
const title = this.getNodeParameter('title', i);
|
|
722
|
+
const location = this.getNodeParameter('location', i);
|
|
723
|
+
const body = {
|
|
724
|
+
contact: {}
|
|
725
|
+
};
|
|
726
|
+
if (firstName)
|
|
727
|
+
body.contact.first_name = firstName;
|
|
728
|
+
if (lastName)
|
|
729
|
+
body.contact.last_name = lastName;
|
|
730
|
+
if (email)
|
|
731
|
+
body.contact.email = email;
|
|
732
|
+
if (phoneNumber)
|
|
733
|
+
body.contact.phone_number = phoneNumber;
|
|
734
|
+
if (company)
|
|
735
|
+
body.contact.company = company;
|
|
736
|
+
if (title)
|
|
737
|
+
body.contact.title = title;
|
|
738
|
+
if (location)
|
|
739
|
+
body.contact.location = location;
|
|
740
|
+
responseData = await this.helpers.request({
|
|
741
|
+
method: 'POST',
|
|
742
|
+
url: 'https://api.linqapp.com/api/partner/v2/contacts',
|
|
743
|
+
headers: {
|
|
744
|
+
'X-LINQ-INTEGRATION-TOKEN': credentials.integrationToken,
|
|
745
|
+
'Content-Type': 'application/json'
|
|
746
|
+
},
|
|
747
|
+
body: body,
|
|
748
|
+
json: true,
|
|
749
|
+
});
|
|
750
|
+
}
|
|
751
|
+
if (operation === 'contactGetOne') {
|
|
752
|
+
const contactId = this.getNodeParameter('contactId', i);
|
|
753
|
+
responseData = await this.helpers.request({
|
|
754
|
+
method: 'GET',
|
|
755
|
+
url: `https://api.linqapp.com/api/partner/v2/contacts/${contactId}`,
|
|
756
|
+
headers: { 'X-LINQ-INTEGRATION-TOKEN': credentials.integrationToken },
|
|
757
|
+
json: true,
|
|
758
|
+
});
|
|
759
|
+
}
|
|
760
|
+
if (operation === 'contactUpdate') {
|
|
761
|
+
const contactId = this.getNodeParameter('contactId', i);
|
|
762
|
+
const firstName = this.getNodeParameter('firstName', i);
|
|
763
|
+
const lastName = this.getNodeParameter('lastName', i);
|
|
764
|
+
const email = this.getNodeParameter('email', i);
|
|
765
|
+
const phoneNumber = this.getNodeParameter('phoneNumber', i);
|
|
766
|
+
const company = this.getNodeParameter('company', i);
|
|
767
|
+
const title = this.getNodeParameter('title', i);
|
|
768
|
+
const location = this.getNodeParameter('location', i);
|
|
769
|
+
const body = {
|
|
770
|
+
contact: {}
|
|
771
|
+
};
|
|
772
|
+
if (firstName)
|
|
773
|
+
body.contact.first_name = firstName;
|
|
774
|
+
if (lastName)
|
|
775
|
+
body.contact.last_name = lastName;
|
|
776
|
+
if (email)
|
|
777
|
+
body.contact.email = email;
|
|
778
|
+
if (phoneNumber)
|
|
779
|
+
body.contact.phone_number = phoneNumber;
|
|
780
|
+
if (company)
|
|
781
|
+
body.contact.company = company;
|
|
782
|
+
if (title)
|
|
783
|
+
body.contact.title = title;
|
|
784
|
+
if (location)
|
|
785
|
+
body.contact.location = location;
|
|
786
|
+
responseData = await this.helpers.request({
|
|
787
|
+
method: 'PUT',
|
|
788
|
+
url: `https://api.linqapp.com/api/partner/v2/contacts/${contactId}`,
|
|
789
|
+
headers: {
|
|
790
|
+
'X-LINQ-INTEGRATION-TOKEN': credentials.integrationToken,
|
|
791
|
+
'Content-Type': 'application/json'
|
|
792
|
+
},
|
|
793
|
+
body: body,
|
|
794
|
+
json: true,
|
|
795
|
+
});
|
|
796
|
+
}
|
|
797
|
+
if (operation === 'contactDelete') {
|
|
798
|
+
const contactId = this.getNodeParameter('contactId', i);
|
|
799
|
+
responseData = await this.helpers.request({
|
|
800
|
+
method: 'DELETE',
|
|
801
|
+
url: `https://api.linqapp.com/api/partner/v2/contacts/${contactId}`,
|
|
802
|
+
headers: { 'X-LINQ-INTEGRATION-TOKEN': credentials.integrationToken },
|
|
803
|
+
json: true,
|
|
804
|
+
});
|
|
805
|
+
}
|
|
708
806
|
}
|
|
709
807
|
}
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
const firstName = this.getNodeParameter('firstName', i);
|
|
714
|
-
const lastName = this.getNodeParameter('lastName', i);
|
|
715
|
-
const email = this.getNodeParameter('email', i);
|
|
716
|
-
const phoneNumber = this.getNodeParameter('phoneNumber', i);
|
|
717
|
-
const company = this.getNodeParameter('company', i);
|
|
718
|
-
const title = this.getNodeParameter('title', i);
|
|
719
|
-
const location = this.getNodeParameter('location', i);
|
|
720
|
-
const body = {
|
|
721
|
-
contact: {}
|
|
722
|
-
};
|
|
723
|
-
if (firstName)
|
|
724
|
-
body.contact.first_name = firstName;
|
|
725
|
-
if (lastName)
|
|
726
|
-
body.contact.last_name = lastName;
|
|
727
|
-
if (email)
|
|
728
|
-
body.contact.email = email;
|
|
729
|
-
if (phoneNumber)
|
|
730
|
-
body.contact.phone_number = phoneNumber;
|
|
731
|
-
if (company)
|
|
732
|
-
body.contact.company = company;
|
|
733
|
-
if (title)
|
|
734
|
-
body.contact.title = title;
|
|
735
|
-
if (location)
|
|
736
|
-
body.contact.location = location;
|
|
737
|
-
responseData = await this.helpers.request({
|
|
738
|
-
method: 'POST',
|
|
739
|
-
url: 'https://api.linqapp.com/api/partner/v2/contacts',
|
|
740
|
-
headers: {
|
|
741
|
-
'X-LINQ-INTEGRATION-TOKEN': credentials.integrationToken,
|
|
742
|
-
'Content-Type': 'application/json'
|
|
743
|
-
},
|
|
744
|
-
body: JSON.stringify(body),
|
|
745
|
-
json: true,
|
|
746
|
-
});
|
|
747
|
-
}
|
|
748
|
-
if (operation === 'getOne') {
|
|
749
|
-
const contactId = this.getNodeParameter('contactId', i);
|
|
750
|
-
responseData = await this.helpers.request({
|
|
751
|
-
method: 'GET',
|
|
752
|
-
url: `https://api.linqapp.com/api/partner/v2/contacts/${contactId}`,
|
|
753
|
-
headers: { 'X-LINQ-INTEGRATION-TOKEN': credentials.integrationToken },
|
|
754
|
-
json: true,
|
|
755
|
-
});
|
|
756
|
-
}
|
|
757
|
-
if (operation === 'update') {
|
|
758
|
-
const contactId = this.getNodeParameter('contactId', i);
|
|
759
|
-
const firstName = this.getNodeParameter('firstName', i);
|
|
760
|
-
const lastName = this.getNodeParameter('lastName', i);
|
|
761
|
-
const email = this.getNodeParameter('email', i);
|
|
762
|
-
const phoneNumber = this.getNodeParameter('phoneNumber', i);
|
|
763
|
-
const company = this.getNodeParameter('company', i);
|
|
764
|
-
const title = this.getNodeParameter('title', i);
|
|
765
|
-
const location = this.getNodeParameter('location', i);
|
|
766
|
-
const body = {
|
|
767
|
-
contact: {}
|
|
768
|
-
};
|
|
769
|
-
if (firstName)
|
|
770
|
-
body.contact.first_name = firstName;
|
|
771
|
-
if (lastName)
|
|
772
|
-
body.contact.last_name = lastName;
|
|
773
|
-
if (email)
|
|
774
|
-
body.contact.email = email;
|
|
775
|
-
if (phoneNumber)
|
|
776
|
-
body.contact.phone_number = phoneNumber;
|
|
777
|
-
if (company)
|
|
778
|
-
body.contact.company = company;
|
|
779
|
-
if (title)
|
|
780
|
-
body.contact.title = title;
|
|
781
|
-
if (location)
|
|
782
|
-
body.contact.location = location;
|
|
783
|
-
responseData = await this.helpers.request({
|
|
784
|
-
method: 'PUT',
|
|
785
|
-
url: `https://api.linqapp.com/api/partner/v2/contacts/${contactId}`,
|
|
786
|
-
headers: {
|
|
787
|
-
'X-LINQ-INTEGRATION-TOKEN': credentials.integrationToken,
|
|
788
|
-
'Content-Type': 'application/json'
|
|
789
|
-
},
|
|
790
|
-
body: JSON.stringify(body),
|
|
791
|
-
json: true,
|
|
792
|
-
});
|
|
793
|
-
}
|
|
794
|
-
if (operation === 'delete') {
|
|
795
|
-
const contactId = this.getNodeParameter('contactId', i);
|
|
796
|
-
responseData = await this.helpers.request({
|
|
797
|
-
method: 'DELETE',
|
|
798
|
-
url: `https://api.linqapp.com/api/partner/v2/contacts/${contactId}`,
|
|
799
|
-
headers: { 'X-LINQ-INTEGRATION-TOKEN': credentials.integrationToken },
|
|
800
|
-
json: true,
|
|
801
|
-
});
|
|
808
|
+
catch (error) {
|
|
809
|
+
if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 429) {
|
|
810
|
+
throw new n8n_workflow_1.ApplicationError('Rate limit exceeded. Please try again after 10 seconds.');
|
|
802
811
|
}
|
|
812
|
+
throw error;
|
|
803
813
|
}
|
|
804
814
|
returnData.push({ json: responseData });
|
|
805
815
|
}
|