n8n-nodes-syncmate 1.0.23 → 1.1.1

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/README.md CHANGED
@@ -11,7 +11,7 @@ Send WhatsApp messages or media using **SyncMate Assistro API** in n8n workflows
11
11
 
12
12
  - Send text messages via WhatsApp
13
13
  - Send images, videos, documents, and other media
14
- - OAuth2 authentication with Assistro API
14
+ - API Token authentication with Assistro API
15
15
  - Designed for **n8n workflows**
16
16
  - Easy to integrate into existing automation
17
17
 
@@ -1,7 +1,8 @@
1
- import { ICredentialType, INodeProperties } from 'n8n-workflow';
1
+ import { ICredentialType, INodeProperties, IAuthenticateGeneric } from 'n8n-workflow';
2
2
  export declare class AssistroTokenApi implements ICredentialType {
3
3
  name: string;
4
4
  displayName: string;
5
5
  documentationUrl: string;
6
6
  properties: INodeProperties[];
7
+ authenticate: IAuthenticateGeneric;
7
8
  }
@@ -16,6 +16,14 @@ class AssistroTokenApi {
16
16
  description: 'The JWT Access Token provided by Assistro',
17
17
  },
18
18
  ];
19
+ this.authenticate = {
20
+ type: 'generic',
21
+ properties: {
22
+ headers: {
23
+ Authorization: '={{"Bearer " + $credentials.accessToken}}',
24
+ },
25
+ },
26
+ };
19
27
  }
20
28
  }
21
29
  exports.AssistroTokenApi = AssistroTokenApi;
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ // This file is generated during build
2
+ // It exports all nodes and credentials for n8n
3
+ module.exports = {};
@@ -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',
@@ -230,7 +200,6 @@ class WhatsAuto {
230
200
  var _a;
231
201
  const items = this.getInputData();
232
202
  const returnData = [];
233
- const authMethod = this.getNodeParameter('authentication', 0);
234
203
  for (let i = 0; i < items.length; i++) {
235
204
  try {
236
205
  const operation = this.getNodeParameter('operation', i);
@@ -239,7 +208,7 @@ class WhatsAuto {
239
208
  const phoneNumber = this.getNodeParameter('phoneNumber', i);
240
209
  const message = this.getNodeParameter('message', i);
241
210
  const mediaFiles = this.getNodeParameter('mediaFiles', i);
242
- const cleanNumber = phoneNumber.trim().replace(/\s+/g, '');
211
+ const cleanNumber = String(phoneNumber).trim().replace(/\s+/g, '');
243
212
  const msgObj = {
244
213
  number: cleanNumber,
245
214
  message: message,
@@ -257,7 +226,7 @@ class WhatsAuto {
257
226
  const groupId = this.getNodeParameter('groupId', i);
258
227
  const message = this.getNodeParameter('message', i);
259
228
  const mediaFiles = this.getNodeParameter('mediaFiles', i);
260
- let cleanGroupId = groupId.trim();
229
+ let cleanGroupId = String(groupId).trim();
261
230
  if (!cleanGroupId.endsWith('@g.us')) {
262
231
  cleanGroupId = cleanGroupId.replace('@g.us', '') + '@g.us';
263
232
  }
@@ -277,7 +246,7 @@ class WhatsAuto {
277
246
  else if (operation === 'newsletter') {
278
247
  const newsletterId = this.getNodeParameter('newsletterId', i);
279
248
  const message = this.getNodeParameter('newsletterMessage', i);
280
- let cleanNewsletterId = newsletterId.trim();
249
+ let cleanNewsletterId = String(newsletterId).trim();
281
250
  if (!cleanNewsletterId.endsWith('@newsletter')) {
282
251
  cleanNewsletterId = cleanNewsletterId.replace('@newsletter', '') + '@newsletter';
283
252
  }
@@ -289,13 +258,7 @@ class WhatsAuto {
289
258
  }],
290
259
  };
291
260
  }
292
- let endpointUri = '';
293
- if (authMethod === 'oAuth2') {
294
- endpointUri = 'https://app.assistro.co/api/v1/wapushplus/singlePass/message';
295
- }
296
- else {
297
- endpointUri = 'https://app.assistro.co/api/v1/wapushplus/single/message';
298
- }
261
+ const endpointUri = 'https://app.assistro.co/api/v1/wapushplus/single/message';
299
262
  const requestOptions = {
300
263
  method: 'POST',
301
264
  url: endpointUri,
@@ -307,14 +270,9 @@ class WhatsAuto {
307
270
  json: true,
308
271
  };
309
272
  let response;
310
- if (authMethod === 'oAuth2') {
311
- response = await this.helpers.httpRequestWithAuthentication.call(this, 'assistroOAuth2Api', requestOptions);
312
- }
313
- else {
314
- const credentials = await this.getCredentials('assistroTokenApi');
315
- requestOptions.headers['Authorization'] = `Bearer ${credentials.accessToken}`;
316
- response = await this.helpers.httpRequest(requestOptions);
317
- }
273
+ const credentials = await this.getCredentials('assistroTokenApi');
274
+ requestOptions.headers['Authorization'] = `Bearer ${credentials.accessToken}`;
275
+ response = await this.helpers.httpRequest(requestOptions);
318
276
  returnData.push({
319
277
  json: response,
320
278
  pairedItem: { item: i },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-syncmate",
3
- "version": "1.0.23",
3
+ "version": "1.1.1",
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/AssistroOAuth2Api.credentials.js"
47
+ "dist/credentials/AssistroTokenApi.credentials.js"
48
48
  ]
49
49
  },
50
50
  "devDependencies": {
@@ -1,8 +0,0 @@
1
- import type { ICredentialType, INodeProperties } from 'n8n-workflow';
2
- export declare class AssistroOAuth2Api implements ICredentialType {
3
- name: string;
4
- extends: string[];
5
- displayName: string;
6
- documentationUrl: string;
7
- properties: INodeProperties[];
8
- }
@@ -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;