@theotherwillembotha/node-red-whatsapp 0.0.55 → 0.3.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 +33 -21
- package/build/GenerateNodes.js +5 -7
- package/build/Nodes.html +1451 -524
- package/build/Nodes.js +52397 -14
- package/build/Plugins.html +37 -0
- package/build/Plugins.js +45964 -55
- package/build/index.js +1 -0
- package/build/runtime/NodeManagerRuntime.js +140 -0
- package/build/whatsapp/node/WhatsappAccountConfigNode.js +7 -2
- package/build/whatsapp/node/WhatsappDynamicSendMessageNode.js +112 -0
- package/build/whatsapp/node/WhatsappGroupConfigNode.js +19 -8
- package/build/whatsapp/node/WhatsappReceiveMessageNode.js +2 -2
- package/build/whatsapp/node/WhatsappSendMessageNode.js +55 -33
- package/build/whatsapp/service/WhatsappClient.js +140 -14
- package/build/whatsapp/service/WhatsappService.js +85 -23
- package/build/whatsapp/service/WhatsappStore.js +10 -7
- package/package.json +10 -8
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @theotherwillembotha/node-red-whatsapp
|
|
2
2
|
|
|
3
|
-
Node-RED nodes for WhatsApp messaging via the [Baileys](https://github.com/WhiskeySockets/Baileys) library. Supports sending and receiving messages to/from WhatsApp groups, with persistent session management and per-message-type filtering.
|
|
3
|
+
Node-RED nodes for WhatsApp messaging via the [Baileys](https://github.com/WhiskeySockets/Baileys) library. Supports sending and receiving messages to/from WhatsApp groups and individual contacts, with persistent session management and per-message-type filtering.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -9,17 +9,6 @@ Node-RED nodes for WhatsApp messaging via the [Baileys](https://github.com/Whisk
|
|
|
9
9
|
|
|
10
10
|
---
|
|
11
11
|
|
|
12
|
-
> [!IMPORTANT]
|
|
13
|
-
> **This plugin requires [`@theotherwillembotha/node-red-plugincore`](https://github.com/theotherwillembotha/nodered_plugincore) to be installed.**
|
|
14
|
-
>
|
|
15
|
-
> `node-red-plugincore` is declared as a dependency and npm will install it automatically alongside this package. However, due to a [known Node-RED limitation](https://github.com/node-red/node-red/issues/3529), packages that arrive as transitive npm dependencies are only discovered by the Node-RED runtime on the **next startup**.
|
|
16
|
-
>
|
|
17
|
-
> **You have two options:**
|
|
18
|
-
> - Install [`@theotherwillembotha/node-red-plugincore`](https://flows.nodered.org/node/@theotherwillembotha/node-red-plugincore) via the palette manager or `npm install` **first**, then install this plugin — both will be available immediately without a restart.
|
|
19
|
-
> - Install this plugin directly — `node-red-plugincore` will be installed automatically alongside it. **Restart Node-RED** once and both packages will be fully loaded.
|
|
20
|
-
|
|
21
|
-
---
|
|
22
|
-
|
|
23
12
|
## Prerequisites
|
|
24
13
|
|
|
25
14
|
- Node.js >= 18
|
|
@@ -54,6 +43,8 @@ Manages a WhatsApp Web session. Handles QR-code pairing and persists session cre
|
|
|
54
43
|
|
|
55
44
|
**Linking an account** — open the node editor and click **Link Account**. A QR code is displayed; scan it with WhatsApp on your phone (Linked Devices). Once scanned, the session is saved and reconnected automatically on each restart. To unlink, click **Unlink Account** and remove the linked device from WhatsApp on your phone.
|
|
56
45
|
|
|
46
|
+
**Claiming an existing account** — if a WhatsApp session was linked outside of a config node (e.g. from a previous deployment), unclaimed accounts appear in a dropdown. Select one and click **Claim** to adopt it.
|
|
47
|
+
|
|
57
48
|
---
|
|
58
49
|
|
|
59
50
|
### WhatsApp Group (config node)
|
|
@@ -68,7 +59,7 @@ References a WhatsApp group within a linked account. Used as the target for Send
|
|
|
68
59
|
| *account* | The WhatsApp Account config node that owns this group |
|
|
69
60
|
| *group* | The WhatsApp group to use — populated from groups available on the selected account |
|
|
70
61
|
|
|
71
|
-
Click **Create New Group** to create a new WhatsApp group directly from Node-RED.
|
|
62
|
+
Click **Create New Group** to create a new WhatsApp group directly from Node-RED. The group members list allows adding, removing, and promoting/demoting participants.
|
|
72
63
|
|
|
73
64
|
---
|
|
74
65
|
|
|
@@ -83,14 +74,32 @@ Sends a message to a WhatsApp group when triggered by an incoming Node-RED messa
|
|
|
83
74
|
| *name* | Display label |
|
|
84
75
|
| *group* | The WhatsApp Group config node to send to |
|
|
85
76
|
|
|
86
|
-
**
|
|
77
|
+
**Messages** — each row in the messages list is sent as a separate WhatsApp message. Supported types:
|
|
78
|
+
|
|
79
|
+
| Type | Value sources |
|
|
80
|
+
|------|---------------|
|
|
81
|
+
| Text | `msg`, `flow`, `global`, `str` |
|
|
82
|
+
| Image | `msg`, `flow`, `global` |
|
|
83
|
+
| Video | `msg`, `flow`, `global` |
|
|
84
|
+
| Document | `msg`, `flow`, `global` (with optional filename and MIME type) |
|
|
85
|
+
|
|
86
|
+
The node resolves each field's value against the incoming message (for `msg` type) or from context, then sends to the group.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
### WhatsApp Dynamic Send Message
|
|
91
|
+
|
|
92
|
+
Sends one or more WhatsApp messages to a recipient resolved at runtime — for example, replying directly to the sender of a group message.
|
|
93
|
+
|
|
94
|
+
| Property | Description |
|
|
95
|
+
|----------|-------------|
|
|
96
|
+
| *name* | Display label |
|
|
97
|
+
| *account* | The WhatsApp Account config node to send from |
|
|
98
|
+
| *recipient* | The target JID, resolved from `msg`, `flow`, `global`, or a static string. Defaults to `msg.payload.sender.id` |
|
|
87
99
|
|
|
88
|
-
|
|
89
|
-
|-------|----------------|
|
|
90
|
-
| Send Text | `msg`, `flow`, `global`, `str` |
|
|
91
|
-
| Send Image | `msg`, `flow`, `global` |
|
|
100
|
+
If the recipient JID ends with `@lid` (newer WhatsApp addressing), the node automatically resolves it to the corresponding phone-number JID via the contact store before sending.
|
|
92
101
|
|
|
93
|
-
The
|
|
102
|
+
The messages list supports the same types as Send Message (Text, Image, Video, Document).
|
|
94
103
|
|
|
95
104
|
---
|
|
96
105
|
|
|
@@ -107,7 +116,7 @@ Outputs a Node-RED message for each incoming WhatsApp message in a group.
|
|
|
107
116
|
| *own messages* | Whether to forward messages sent by this account |
|
|
108
117
|
| *output path* | Where in the output `msg` to place the WhatsApp message (or which `flow`/`global` context variable to write to) |
|
|
109
118
|
|
|
110
|
-
**Accept filters** — each message type can be individually enabled or disabled. Enabled by default: Text, Extended Text, Image, Video, Album. Available types: Text, Extended Text, Image, Video, Album, Document, Contact, Template,
|
|
119
|
+
**Accept filters** — each message type can be individually enabled or disabled. Enabled by default: Text, Extended Text, Image, Video, Album. Available types: Text, Extended Text, Image, Video, Album, Document, Contact, Template, Location, Event, Event Response, Sticker.
|
|
111
120
|
|
|
112
121
|
**Output message** — the WhatsApp message object is placed at the configured output path (default: `msg.payload`). The object includes:
|
|
113
122
|
|
|
@@ -136,10 +145,13 @@ Session credentials and the SQLite message store are written to `/data/whatsapp/
|
|
|
136
145
|
| Package | Description |
|
|
137
146
|
|---------|-------------|
|
|
138
147
|
| [node-red-plugincore](https://www.npmjs.com/package/@theotherwillembotha/node-red-plugincore) | Core framework |
|
|
139
|
-
| [node-red-telemetry](https://www.npmjs.com/package/@theotherwillembotha/node-red-telemetry) | Structured logging
|
|
148
|
+
| [node-red-telemetry](https://www.npmjs.com/package/@theotherwillembotha/node-red-telemetry) | Structured logging flow node |
|
|
140
149
|
| [node-red-loki](https://www.npmjs.com/package/@theotherwillembotha/node-red-loki) | Grafana Loki log transport |
|
|
150
|
+
| [node-red-prometheus](https://www.npmjs.com/package/@theotherwillembotha/node-red-prometheus) | Prometheus metrics provider |
|
|
141
151
|
| [node-red-circuitbreaker](https://www.npmjs.com/package/@theotherwillembotha/node-red-circuitbreaker) | Circuit breaker fault tolerance |
|
|
142
152
|
| [node-red-zookeeper](https://www.npmjs.com/package/@theotherwillembotha/node-red-zookeeper) | Apache ZooKeeper integration |
|
|
153
|
+
| [node-red-reolink](https://www.npmjs.com/package/@theotherwillembotha/node-red-reolink) | Reolink camera integration |
|
|
154
|
+
| [node-red-temporal](https://www.npmjs.com/package/@theotherwillembotha/node-red-temporal) | Temporal.io workflow integration |
|
|
143
155
|
| [node-red-whatsapp](https://www.npmjs.com/package/@theotherwillembotha/node-red-whatsapp) | WhatsApp messaging (this package) |
|
|
144
156
|
|
|
145
157
|
## License
|
package/build/GenerateNodes.js
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const node_red_plugincore_1 = require("@theotherwillembotha/node-red-plugincore");
|
|
4
|
-
// services.
|
|
5
4
|
const WhatsappService_1 = require("./whatsapp/service/WhatsappService");
|
|
6
|
-
// nodes.
|
|
7
5
|
const WhatsappAccountConfigNode_1 = require("./whatsapp/node/WhatsappAccountConfigNode");
|
|
8
6
|
const WhatsappGroupConfigNode_1 = require("./whatsapp/node/WhatsappGroupConfigNode");
|
|
9
7
|
const WhatsappSendMessageNode_1 = require("./whatsapp/node/WhatsappSendMessageNode");
|
|
8
|
+
const WhatsappDynamicSendMessageNode_1 = require("./whatsapp/node/WhatsappDynamicSendMessageNode");
|
|
10
9
|
const WhatsappReceiveMessageNode_1 = require("./whatsapp/node/WhatsappReceiveMessageNode");
|
|
11
|
-
new node_red_plugincore_1.NodeGenerator("./src/")
|
|
12
|
-
|
|
10
|
+
new node_red_plugincore_1.NodeGenerator("./src/whatsapp/")
|
|
11
|
+
.registerService(node_red_plugincore_1.NodeTypeService)
|
|
13
12
|
.registerService(WhatsappService_1.WhatsappService)
|
|
14
|
-
// nodes
|
|
15
13
|
.registerNode(WhatsappAccountConfigNode_1.WhatsappAccountConfigNode)
|
|
16
14
|
.registerNode(WhatsappGroupConfigNode_1.WhatsappGroupConfigNode)
|
|
17
15
|
.registerNode(WhatsappSendMessageNode_1.WhatsappSendMessageNode)
|
|
16
|
+
.registerNode(WhatsappDynamicSendMessageNode_1.WhatsappDynamicSendMessageNode)
|
|
18
17
|
.registerNode(WhatsappReceiveMessageNode_1.WhatsappReceiveMessageNode)
|
|
19
|
-
|
|
20
|
-
.generate("./build/Nodes", "./build/Plugins");
|
|
18
|
+
.generate("./build/Nodes", "./build/Plugins", "@theotherwillembotha/node-red-whatsapp");
|
|
21
19
|
process.exit(0);
|