n8n-nodes-syncmate 1.0.22 → 1.1.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.
|
@@ -22,39 +22,9 @@ class WhatsAuto {
|
|
|
22
22
|
{
|
|
23
23
|
name: 'assistroTokenApi',
|
|
24
24
|
required: true,
|
|
25
|
-
displayOptions: {
|
|
26
|
-
show: {
|
|
27
|
-
authentication: ['jwt'],
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
name: 'assistroOAuth2Api',
|
|
33
|
-
required: true,
|
|
34
|
-
displayOptions: {
|
|
35
|
-
show: {
|
|
36
|
-
authentication: ['oAuth2'],
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
25
|
},
|
|
40
26
|
],
|
|
41
27
|
properties: [
|
|
42
|
-
{
|
|
43
|
-
displayName: 'Authentication',
|
|
44
|
-
name: 'authentication',
|
|
45
|
-
type: 'options',
|
|
46
|
-
options: [
|
|
47
|
-
{
|
|
48
|
-
name: 'API Token (JWT)',
|
|
49
|
-
value: 'jwt',
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
name: 'OAuth2',
|
|
53
|
-
value: 'oAuth2',
|
|
54
|
-
},
|
|
55
|
-
],
|
|
56
|
-
default: 'jwt',
|
|
57
|
-
},
|
|
58
28
|
{
|
|
59
29
|
displayName: 'Resource',
|
|
60
30
|
name: 'resource',
|
|
@@ -227,9 +197,9 @@ class WhatsAuto {
|
|
|
227
197
|
};
|
|
228
198
|
}
|
|
229
199
|
async execute() {
|
|
200
|
+
var _a;
|
|
230
201
|
const items = this.getInputData();
|
|
231
202
|
const returnData = [];
|
|
232
|
-
const authMethod = this.getNodeParameter('authentication', 0);
|
|
233
203
|
for (let i = 0; i < items.length; i++) {
|
|
234
204
|
try {
|
|
235
205
|
const operation = this.getNodeParameter('operation', i);
|
|
@@ -288,13 +258,7 @@ class WhatsAuto {
|
|
|
288
258
|
}],
|
|
289
259
|
};
|
|
290
260
|
}
|
|
291
|
-
|
|
292
|
-
if (authMethod === 'oAuth2') {
|
|
293
|
-
endpointUri = 'https://app.assistro.co/api/v1/wapushplus/singlePass/message';
|
|
294
|
-
}
|
|
295
|
-
else {
|
|
296
|
-
endpointUri = 'https://app.assistro.co/api/v1/wapushplus/single/message';
|
|
297
|
-
}
|
|
261
|
+
const endpointUri = 'https://app.assistro.co/api/v1/wapushplus/single/message';
|
|
298
262
|
const requestOptions = {
|
|
299
263
|
method: 'POST',
|
|
300
264
|
url: endpointUri,
|
|
@@ -306,35 +270,26 @@ class WhatsAuto {
|
|
|
306
270
|
json: true,
|
|
307
271
|
};
|
|
308
272
|
let response;
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
else {
|
|
313
|
-
const credentials = await this.getCredentials('assistroTokenApi');
|
|
314
|
-
requestOptions.headers['Authorization'] = `Bearer ${credentials.accessToken}`;
|
|
315
|
-
response = await this.helpers.httpRequest(requestOptions);
|
|
316
|
-
}
|
|
273
|
+
const credentials = await this.getCredentials('assistroTokenApi');
|
|
274
|
+
requestOptions.headers['Authorization'] = `Bearer ${credentials.accessToken}`;
|
|
275
|
+
response = await this.helpers.httpRequest(requestOptions);
|
|
317
276
|
returnData.push({
|
|
318
277
|
json: response,
|
|
319
278
|
pairedItem: { item: i },
|
|
320
279
|
});
|
|
321
280
|
}
|
|
322
281
|
catch (error) {
|
|
323
|
-
console.error(`[WhatsAuto] Item ${i} Failed:`, error.message);
|
|
324
|
-
if (error.response) {
|
|
325
|
-
console.error(`[WhatsAuto] Error Response Body:`, error.response.body);
|
|
326
|
-
}
|
|
327
282
|
if (this.continueOnFail()) {
|
|
328
283
|
returnData.push({
|
|
329
284
|
json: {
|
|
330
285
|
error: error.message,
|
|
286
|
+
details: ((_a = error.response) === null || _a === void 0 ? void 0 : _a.body) || undefined,
|
|
331
287
|
},
|
|
332
288
|
pairedItem: { item: i },
|
|
333
289
|
});
|
|
334
290
|
continue;
|
|
335
291
|
}
|
|
336
|
-
|
|
337
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Failed to send message: ${errorMsg}`, { itemIndex: i });
|
|
292
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, { itemIndex: i });
|
|
338
293
|
}
|
|
339
294
|
}
|
|
340
295
|
return [returnData];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-syncmate",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Send WhatsApp messages or media using SyncMate Assistro API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"dist/nodes/WhatsAuto/WhatsAuto.node.js"
|
|
45
45
|
],
|
|
46
46
|
"credentials": [
|
|
47
|
-
"dist/credentials/
|
|
47
|
+
"dist/credentials/AssistroTokenApi.credentials.js"
|
|
48
48
|
]
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AssistroOAuth2Api = void 0;
|
|
4
|
-
class AssistroOAuth2Api {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.name = 'assistroOAuth2Api';
|
|
7
|
-
this.extends = ['oAuth2Api'];
|
|
8
|
-
this.displayName = 'Assistro OAuth2 API';
|
|
9
|
-
this.documentationUrl = 'https://docs.assistro.co/oauth';
|
|
10
|
-
this.properties = [
|
|
11
|
-
{
|
|
12
|
-
displayName: 'Grant Type',
|
|
13
|
-
name: 'grantType',
|
|
14
|
-
type: 'hidden',
|
|
15
|
-
default: 'authorizationCode',
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
displayName: 'Authorization URL',
|
|
19
|
-
name: 'authUrl',
|
|
20
|
-
type: 'hidden',
|
|
21
|
-
default: 'https://app.assistro.co/oauth/authorize',
|
|
22
|
-
required: true,
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
displayName: 'Access Token URL',
|
|
26
|
-
name: 'accessTokenUrl',
|
|
27
|
-
type: 'hidden',
|
|
28
|
-
default: 'https://app.assistro.co/oauth/token',
|
|
29
|
-
required: true,
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
displayName: 'Client ID',
|
|
33
|
-
name: 'clientId',
|
|
34
|
-
type: 'hidden',
|
|
35
|
-
default: '7',
|
|
36
|
-
required: true,
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
displayName: 'Client Secret',
|
|
40
|
-
name: 'clientSecret',
|
|
41
|
-
type: 'hidden',
|
|
42
|
-
typeOptions: { password: true },
|
|
43
|
-
default: 'Hu7Q7ruHo9tOp2MEmBvBA45bn5atNESD7naEURHw',
|
|
44
|
-
required: true,
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
displayName: 'Scope',
|
|
48
|
-
name: 'scope',
|
|
49
|
-
type: 'hidden',
|
|
50
|
-
default: 'all',
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
displayName: 'Auth URI Query Parameters',
|
|
54
|
-
name: 'authQueryParameters',
|
|
55
|
-
type: 'hidden',
|
|
56
|
-
default: 'integration_name=n8n',
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
displayName: 'Authentication',
|
|
60
|
-
name: 'authentication',
|
|
61
|
-
type: 'hidden',
|
|
62
|
-
default: 'header',
|
|
63
|
-
},
|
|
64
|
-
];
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
exports.AssistroOAuth2Api = AssistroOAuth2Api;
|