n8n-nodes-sendzen 1.0.3 → 1.0.4

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,8 +1,9 @@
1
- import { IAuthenticateGeneric, ICredentialType, INodeProperties } from 'n8n-workflow';
1
+ import { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
2
2
  export declare class SendZenApi implements ICredentialType {
3
3
  name: string;
4
4
  displayName: string;
5
5
  documentationUrl: string;
6
6
  properties: INodeProperties[];
7
7
  authenticate: IAuthenticateGeneric;
8
+ test?: ICredentialTestRequest | undefined;
8
9
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SendZenApi = void 0;
4
+ const constants_1 = require("../shared/constants");
4
5
  class SendZenApi {
5
6
  constructor() {
6
7
  this.name = 'sendZenApi';
@@ -30,6 +31,39 @@ class SendZenApi {
30
31
  },
31
32
  },
32
33
  };
34
+ this.test = {
35
+ request: {
36
+ baseURL: constants_1.BASE_DOMAIN,
37
+ url: '/v1/auth/api_key',
38
+ headers: {
39
+ Authorization: '=Bearer {{$credentials.apiKey}}'
40
+ },
41
+ method: 'GET',
42
+ },
43
+ rules: [
44
+ {
45
+ type: 'responseCode',
46
+ properties: {
47
+ value: 200,
48
+ message: "Valid API Key",
49
+ },
50
+ },
51
+ {
52
+ type: 'responseCode',
53
+ properties: {
54
+ value: 401,
55
+ message: "Invalid API Key",
56
+ },
57
+ },
58
+ {
59
+ type: 'responseCode',
60
+ properties: {
61
+ value: 403,
62
+ message: "Invalid API Key",
63
+ },
64
+ },
65
+ ]
66
+ };
33
67
  }
34
68
  }
35
69
  exports.SendZenApi = SendZenApi;
@@ -1,7 +1,9 @@
1
- import type { ICredentialType, INodeProperties } from 'n8n-workflow';
1
+ import type { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
2
2
  export declare class SendZenWebhookApi implements ICredentialType {
3
3
  name: string;
4
4
  displayName: string;
5
5
  documentationUrl: string;
6
6
  properties: INodeProperties[];
7
+ authenticate: IAuthenticateGeneric;
8
+ test?: ICredentialTestRequest | undefined;
7
9
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SendZenWebhookApi = void 0;
4
+ const constants_1 = require("../shared/constants");
4
5
  class SendZenWebhookApi {
5
6
  constructor() {
6
7
  this.name = 'sendZenWebhookApi';
@@ -8,14 +9,68 @@ class SendZenWebhookApi {
8
9
  this.documentationUrl = 'https://sendzen.io/docs';
9
10
  this.properties = [
10
11
  {
11
- displayName: 'Secret Key',
12
+ displayName: 'SendZen API Key',
13
+ name: 'apiKey',
14
+ type: 'string',
15
+ required: true,
16
+ typeOptions: { password: true },
17
+ default: '',
18
+ description: 'SendZen API Key. Used to verify Secret Key for incoming webhooks.',
19
+ },
20
+ {
21
+ displayName: 'SendZen Webhook Secret Key (Optional)',
12
22
  name: 'secretKey',
13
23
  type: 'string',
24
+ required: false,
14
25
  typeOptions: { password: true },
15
26
  default: '',
16
27
  description: 'Webhook signing secret from SendZen. Used to verify X-Hub-Signature-256 (sha256=...) for incoming webhooks.',
17
28
  },
18
29
  ];
30
+ this.authenticate = {
31
+ type: 'generic',
32
+ properties: {
33
+ headers: {
34
+ Authorization: '=Bearer {{$credentials.apiKey}}',
35
+ },
36
+ },
37
+ };
38
+ this.test = {
39
+ request: {
40
+ baseURL: constants_1.BASE_DOMAIN,
41
+ url: `/v1/auth/api_key`,
42
+ headers: {
43
+ Authorization: '=Bearer {{$credentials.apiKey}}'
44
+ },
45
+ qs: {
46
+ secret: '={{ encodeURIComponent($credentials.secretKey) }}',
47
+ },
48
+ method: 'GET',
49
+ },
50
+ rules: [
51
+ {
52
+ type: 'responseCode',
53
+ properties: {
54
+ value: 200,
55
+ message: "Valid API Key",
56
+ },
57
+ },
58
+ {
59
+ type: 'responseCode',
60
+ properties: {
61
+ value: 401,
62
+ message: "Invalid API Key or Secret Key",
63
+ },
64
+ },
65
+ {
66
+ type: 'responseCode',
67
+ properties: {
68
+ value: 403,
69
+ message: "Invalid API Key or Secret Key",
70
+ },
71
+ },
72
+ ]
73
+ };
19
74
  }
20
75
  }
21
76
  exports.SendZenWebhookApi = SendZenWebhookApi;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-sendzen",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Send and receive WhatsApp Cloud API messages in n8n using SendZen (actions + webhook trigger).",
5
5
  "main": "index.js",
6
6
  "keywords": [