n8n-nodes-syncmate 1.1.0 → 1.1.3

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 = {};
@@ -208,7 +208,7 @@ class WhatsAuto {
208
208
  const phoneNumber = this.getNodeParameter('phoneNumber', i);
209
209
  const message = this.getNodeParameter('message', i);
210
210
  const mediaFiles = this.getNodeParameter('mediaFiles', i);
211
- const cleanNumber = phoneNumber.trim().replace(/\s+/g, '');
211
+ const cleanNumber = String(phoneNumber).trim().replace(/\s+/g, '');
212
212
  const msgObj = {
213
213
  number: cleanNumber,
214
214
  message: message,
@@ -226,7 +226,7 @@ class WhatsAuto {
226
226
  const groupId = this.getNodeParameter('groupId', i);
227
227
  const message = this.getNodeParameter('message', i);
228
228
  const mediaFiles = this.getNodeParameter('mediaFiles', i);
229
- let cleanGroupId = groupId.trim();
229
+ let cleanGroupId = String(groupId).trim();
230
230
  if (!cleanGroupId.endsWith('@g.us')) {
231
231
  cleanGroupId = cleanGroupId.replace('@g.us', '') + '@g.us';
232
232
  }
@@ -246,7 +246,7 @@ class WhatsAuto {
246
246
  else if (operation === 'newsletter') {
247
247
  const newsletterId = this.getNodeParameter('newsletterId', i);
248
248
  const message = this.getNodeParameter('newsletterMessage', i);
249
- let cleanNewsletterId = newsletterId.trim();
249
+ let cleanNewsletterId = String(newsletterId).trim();
250
250
  if (!cleanNewsletterId.endsWith('@newsletter')) {
251
251
  cleanNewsletterId = cleanNewsletterId.replace('@newsletter', '') + '@newsletter';
252
252
  }
@@ -270,9 +270,7 @@ class WhatsAuto {
270
270
  json: true,
271
271
  };
272
272
  let response;
273
- const credentials = await this.getCredentials('assistroTokenApi');
274
- requestOptions.headers['Authorization'] = `Bearer ${credentials.accessToken}`;
275
- response = await this.helpers.httpRequest(requestOptions);
273
+ response = await this.helpers.httpRequestWithAuthentication.call(this, 'assistroTokenApi', requestOptions);
276
274
  returnData.push({
277
275
  json: response,
278
276
  pairedItem: { item: i },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-syncmate",
3
- "version": "1.1.0",
3
+ "version": "1.1.3",
4
4
  "description": "Send WhatsApp messages or media using SyncMate Assistro API.",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",
@@ -53,6 +53,7 @@
53
53
  "eslint": "^8.56.0",
54
54
  "eslint-plugin-n8n-nodes-base": "^1.16.1",
55
55
  "gulp": "^4.0.2",
56
+ "n8n-node-dev": "^1.121.16",
56
57
  "n8n-workflow": "^1.119.1",
57
58
  "prettier": "^3.3.2",
58
59
  "typescript": "~5.5.3"