n8n-nodes-whatsapp-retentionstack 0.1.1 → 0.2.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.
package/README.md CHANGED
@@ -3,7 +3,17 @@
3
3
  n8n community nodes for the [WhatsApp Messaging API by Retention Stack](https://whatsapp-messaging.retentionstack.agency).
4
4
  Send WhatsApp text, images, files, videos, locations and OTPs from any workflow, and trigger workflows on incoming messages.
5
5
 
6
- No Meta approval queue. No WhatsApp Business account. 5 minutes from subscribe to first message.
6
+ No Meta approval queue. No WhatsApp Business account. 5 minutes from sign-in to first message.
7
+
8
+ ## Credentials
9
+
10
+ 1. Sign in at [whatsapp-messaging.retentionstack.agency/start](https://whatsapp-messaging.retentionstack.agency/start) and link your number.
11
+ 2. Copy a key from the console:
12
+ - Session token (`ch_live_...`): one number. Leave every node's Session field as `default`.
13
+ - Account key (`ak_live_...`): every number on your account. Enter the session name in each node's Session field.
14
+ 3. In n8n, create a WhatsApp by Retention Stack API credential and paste the key.
15
+
16
+ Upgrading from 0.1.x: earlier versions used a RapidAPI key. Replace it with a session token or account key from the console; RapidAPI keys no longer work with this node.
7
17
 
8
18
  ## Nodes
9
19
 
@@ -1,9 +1,9 @@
1
- import type { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
2
- export declare const BASE_URL = "https://whatsapp-messaging-bot.p.rapidapi.com";
3
- export declare const RAPIDAPI_HOST = "whatsapp-messaging-bot.p.rapidapi.com";
1
+ import type { Icon, IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare const BASE_URL = "https://wp-rapidapi.retentionstack.agency";
4
3
  export declare class WhatsAppRetentionStackApi implements ICredentialType {
5
4
  name: string;
6
5
  displayName: string;
6
+ icon: Icon;
7
7
  documentationUrl: string;
8
8
  properties: INodeProperties[];
9
9
  authenticate: IAuthenticateGeneric;
@@ -1,29 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WhatsAppRetentionStackApi = exports.RAPIDAPI_HOST = exports.BASE_URL = void 0;
4
- exports.BASE_URL = 'https://whatsapp-messaging-bot.p.rapidapi.com';
5
- exports.RAPIDAPI_HOST = 'whatsapp-messaging-bot.p.rapidapi.com';
3
+ exports.WhatsAppRetentionStackApi = exports.BASE_URL = void 0;
4
+ exports.BASE_URL = 'https://wp-rapidapi.retentionstack.agency';
6
5
  class WhatsAppRetentionStackApi {
7
6
  constructor() {
8
7
  this.name = 'whatsAppRetentionStackApi';
9
8
  this.displayName = 'WhatsApp by Retention Stack API';
10
- this.documentationUrl = 'https://whatsapp-messaging.retentionstack.agency/docs';
9
+ this.icon = { light: 'file:whatsapp.svg', dark: 'file:whatsapp.dark.svg' };
10
+ this.documentationUrl = 'https://whatsapp-messaging.retentionstack.agency/docs/guides/authentication';
11
11
  this.properties = [
12
12
  {
13
- displayName: 'RapidAPI Key',
13
+ displayName: 'API Key',
14
14
  name: 'apiKey',
15
15
  type: 'string',
16
16
  typeOptions: { password: true },
17
17
  default: '',
18
- description: 'Your X-RapidAPI-Key. Subscribe (free plan, no credit card) at rapidapi.com/jevil257/api/whatsapp-messaging-bot.',
18
+ description: 'A session token (ch_live_...) for one number, or an account key (ak_live_...) for every number. Get both at whatsapp-messaging.retentionstack.agency/app.',
19
19
  },
20
20
  ];
21
21
  this.authenticate = {
22
22
  type: 'generic',
23
23
  properties: {
24
24
  headers: {
25
- 'x-rapidapi-key': '={{$credentials.apiKey}}',
26
- 'x-rapidapi-host': exports.RAPIDAPI_HOST,
25
+ Authorization: '=Bearer {{$credentials.apiKey}}',
27
26
  },
28
27
  },
29
28
  };
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><circle cx="32" cy="32" r="32" fill="#25D366"/><path fill="#0b141a" d="M35.5 12 20 36h10l-3.5 16L44 28H34z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><circle cx="32" cy="32" r="32" fill="#128C7E"/><path fill="#fff" d="M35.5 12 20 36h10l-3.5 16L44 28H34z"/></svg>
@@ -13,7 +13,7 @@ const op = (name, value, method, url) => {
13
13
  const route = `${method} ${url.replace(/\{\{\$parameter\.(\w+)\}\}/g, '{$1}')}`;
14
14
  const action = endpoints_1.ENDPOINTS[route];
15
15
  if (!action)
16
- throw new Error(`No summary in openapi.json for ${route}; run npm run gen`);
16
+ throw new n8n_workflow_1.UserError(`No summary in openapi.json for ${route}; run npm run gen`);
17
17
  return { name, value, action, description: route, routing: { request: { method, url: url.includes('{{') ? `=${url}` : url } } };
18
18
  };
19
19
  const show = (resource, operation) => ({
@@ -49,7 +49,7 @@ const str = (displayName, name, resource, ops, extra = {}) => ({
49
49
  ...show(resource, ops),
50
50
  ...extra,
51
51
  });
52
- const session = (resource, ops, routing = {}) => str('Session', 'session', resource, ops, { default: 'default', required: true, description: 'Name of the connected WhatsApp session (the number you paired)', ...routing });
52
+ const session = (resource, ops, routing = {}) => str('Session', 'session', resource, ops, { default: 'default', required: true, description: 'Leave as default with a session token. With an account key, enter the session name.', ...routing });
53
53
  const chatId = (resource, ops, routing = body('chatId')) => str('Chat ID', 'chatId', resource, ops, { required: true, placeholder: '1234567890', description: 'Phone number with country code (no +), or a group/channel ID', ...routing });
54
54
  const groupId = (ops) => str('Group ID', 'groupId', 'group', ops, { required: true, placeholder: '120363012345678901@g.us' });
55
55
  const extra = (resource, ops, options) => ({
@@ -133,7 +133,7 @@ const message = [
133
133
  str('Options', 'pollOptions', 'message', ['sendPoll'], { required: true, placeholder: 'Yes, No, Maybe', description: 'Comma-separated poll options (2 to 12)', ...csv('poll.options') }),
134
134
  { displayName: 'Allow Multiple Answers', name: 'multipleAnswers', type: 'boolean', default: false, ...show('message', ['sendPoll']), ...body('poll.multipleAnswers') },
135
135
  // get many
136
- { displayName: 'Limit', name: 'limit', type: 'number', default: 100, typeOptions: { minValue: 1 }, description: 'Max number of results to return', ...show('message', ['getMany']), ...query('limit') },
136
+ { displayName: 'Limit', name: 'limit', type: 'number', default: 50, typeOptions: { minValue: 1 }, description: 'Max number of results to return', ...show('message', ['getMany']), ...query('limit') },
137
137
  { displayName: 'Download Media', name: 'downloadMedia', type: 'boolean', default: false, ...show('message', ['getMany']), ...query('downloadMedia') },
138
138
  // additional fields, scoped so nothing unsupported is sent
139
139
  extra('message', ['sendText'], [
@@ -259,7 +259,7 @@ const group = [
259
259
  default: {},
260
260
  ...show('group', ['getMany']),
261
261
  options: [
262
- { displayName: 'Limit', name: 'limit', type: 'number', default: 10, typeOptions: { minValue: 1 }, description: 'Max number of results to return', ...query('limit') },
262
+ { displayName: 'Limit', name: 'limit', type: 'number', default: 50, typeOptions: { minValue: 1 }, description: 'Max number of results to return', ...query('limit') },
263
263
  { displayName: 'Offset', name: 'offset', type: 'number', default: 0, ...query('offset') },
264
264
  { displayName: 'Sort By', name: 'sortBy', type: 'options', options: [{ name: 'ID', value: 'id' }, { name: 'Subject', value: 'subject' }], default: 'subject', ...query('sortBy') },
265
265
  { displayName: 'Sort Order', name: 'sortOrder', type: 'options', options: [{ name: 'Ascending', value: 'asc' }, { name: 'Descending', value: 'desc' }], default: 'asc', ...query('sortOrder') },
@@ -295,7 +295,7 @@ class WhatsAppRetentionStack {
295
295
  this.description = {
296
296
  displayName: 'WhatsApp by Retention Stack',
297
297
  name: 'whatsAppRetentionStack',
298
- icon: 'file:whatsapp.svg',
298
+ icon: { light: 'file:whatsapp.svg', dark: 'file:whatsapp.dark.svg' },
299
299
  group: ['output'],
300
300
  version: 1,
301
301
  subtitle: '={{ $parameter["operation"] + ": " + $parameter["resource"] }}',
@@ -12,14 +12,14 @@ const EVENTS = [
12
12
  { name: 'Message Revoked', value: 'message.revoked' },
13
13
  { name: 'Group Join', value: 'group.join' },
14
14
  { name: 'Group Leave', value: 'group.leave' },
15
- { name: 'Session Status', value: 'session.status', description: 'Session connected, disconnected, etc.' },
15
+ { name: 'Session Status', value: 'session.status', description: 'Session connected, disconnected, or other state changes' },
16
16
  ];
17
17
  class WhatsAppRetentionStackTrigger {
18
18
  constructor() {
19
19
  this.description = {
20
20
  displayName: 'WhatsApp by Retention Stack Trigger',
21
21
  name: 'whatsAppRetentionStackTrigger',
22
- icon: 'file:whatsapp.svg',
22
+ icon: { light: 'file:whatsapp.svg', dark: 'file:whatsapp.dark.svg' },
23
23
  group: ['trigger'],
24
24
  version: 1,
25
25
  subtitle: '={{ $parameter["events"].join(", ") }}',
@@ -36,7 +36,7 @@ class WhatsAppRetentionStackTrigger {
36
36
  type: 'string',
37
37
  default: 'default',
38
38
  required: true,
39
- description: 'Name of the connected WhatsApp session to listen on',
39
+ description: 'Session to listen on. Leave as default with a session token; with an account key, enter the session name.',
40
40
  },
41
41
  {
42
42
  displayName: 'Events',
@@ -61,7 +61,10 @@ class WhatsAppRetentionStackTrigger {
61
61
  });
62
62
  return JSON.stringify(res).includes(url);
63
63
  }
64
- catch {
64
+ catch (error) {
65
+ // Not proof the webhook is absent — the lookup itself failed. Log it so a
66
+ // bad session or key is visible, and report "not registered" so create() runs.
67
+ this.logger.warn(`WhatsApp trigger: could not check webhooks for session "${session}": ${error instanceof Error ? error.message : String(error)}`);
65
68
  return false;
66
69
  }
67
70
  },
@@ -88,8 +91,10 @@ class WhatsAppRetentionStackTrigger {
88
91
  json: true,
89
92
  });
90
93
  }
91
- catch {
92
- // webhook already gone; nothing to clean up
94
+ catch (error) {
95
+ // Deactivation should still succeed if the webhook is already gone, but a
96
+ // real failure would otherwise leave it registered silently.
97
+ this.logger.warn(`WhatsApp trigger: could not remove webhook for session "${session}": ${error instanceof Error ? error.message : String(error)}`);
93
98
  }
94
99
  return true;
95
100
  },
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><circle cx="32" cy="32" r="32" fill="#25D366"/><path fill="#0b141a" d="M35.5 12 20 36h10l-3.5 16L44 28H34z"/></svg>
@@ -1 +1 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><circle cx="32" cy="32" r="32" fill="#25D366"/><path fill="#fff" d="M35.5 12 20 36h10l-3.5 16L44 28H34z"/></svg>
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><circle cx="32" cy="32" r="32" fill="#128C7E"/><path fill="#fff" d="M35.5 12 20 36h10l-3.5 16L44 28H34z"/></svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-whatsapp-retentionstack",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "n8n nodes for the WhatsApp Messaging API by Retention Stack. Send WhatsApp text, images, files and OTPs, and trigger workflows on incoming messages. No Meta approval needed.",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",
@@ -8,8 +8,7 @@
8
8
  "whatsapp",
9
9
  "whatsapp-api",
10
10
  "messaging",
11
- "otp",
12
- "rapidapi"
11
+ "otp"
13
12
  ],
14
13
  "license": "MIT",
15
14
  "homepage": "https://whatsapp-messaging.retentionstack.agency",
@@ -26,11 +25,12 @@
26
25
  "dist"
27
26
  ],
28
27
  "scripts": {
29
- "build": "rm -rf dist && tsc && cp nodes/WhatsAppRetentionStack/*.svg dist/nodes/WhatsAppRetentionStack/",
28
+ "build": "rm -rf dist && tsc && cp nodes/WhatsAppRetentionStack/*.svg dist/nodes/WhatsAppRetentionStack/ && cp credentials/*.svg dist/credentials/",
30
29
  "dev": "tsc --watch",
31
- "test": "npm run build && node test/smoke.mjs",
30
+ "test": "npm run build && npm run lint && node test/smoke.mjs",
32
31
  "prepublishOnly": "npm test",
33
- "gen": "node scripts/gen.mjs"
32
+ "gen": "node scripts/gen.mjs",
33
+ "lint": "eslint credentials nodes package.json"
34
34
  },
35
35
  "n8n": {
36
36
  "n8nNodesApiVersion": 1,
@@ -46,8 +46,12 @@
46
46
  "n8n-workflow": "*"
47
47
  },
48
48
  "devDependencies": {
49
+ "@n8n/eslint-plugin-community-nodes": "^0.31.0",
49
50
  "@types/node": "^22.0.0",
51
+ "eslint": "9.29.0",
52
+ "eslint-plugin-n8n-nodes-base": "^2.0.0",
50
53
  "n8n-workflow": "^2.16.0",
51
- "typescript": "^5.5.4"
54
+ "typescript": "^5.5.4",
55
+ "typescript-eslint": "^8.69.0"
52
56
  }
53
57
  }