@jep182/n8n-nodes-whatsthat 0.4.3 → 0.5.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
@@ -1,125 +1,204 @@
1
1
  # @jep182/n8n-nodes-whatsthat
2
2
 
3
- WhatsThat is an n8n community package for sending WhatsApp messages, with multiple sessions.
3
+ WhatsThat lets you connect one or more WhatsApp numbers inside n8n, link chats or groups with simple names, send messages, and react to incoming events.
4
4
 
5
- It lets you:
5
+ In the n8n node picker, you will find:
6
6
 
7
- - manage multiple sessions and numbers
8
- - connect with pairing code or QR
9
- - discover chats and groups
10
- - link chats/groups to friendly aliases
11
- - send text, media, documents, reactions, contacts, locations, and polls
12
- - receive inbound events through a trigger node
7
+ - `WhatsThat` actions
8
+ - `WhatsThat Trigger`
13
9
 
14
- ## Included Nodes
10
+ You also need one credential:
15
11
 
16
- ### `WhatsThat Session`
12
+ - `WhatsThat Runtime`
17
13
 
18
- Use this node to:
14
+ ## Before You Start
19
15
 
20
- - connect a session
21
- - wait for a session to become connected
22
- - list sessions
23
- - inspect session status
24
- - disconnect a session
25
- - remove a session
16
+ Create `WhatsThat Runtime` credentials and choose a persistent storage path, for example:
26
17
 
27
- When pairing is available, the node returns:
18
+ ```text
19
+ /home/node/.n8n/whatsthat
20
+ ```
28
21
 
29
- - `pairingCode`
30
- - `qrCodeUrl`
31
- - `qr`
32
- - `qrDataUrl`
22
+ This folder is used to store session files and local metadata.
33
23
 
34
- ### `WhatsThat Targets`
24
+ The action nodes all appear under the same name, `WhatsThat`, but with different purposes:
35
25
 
36
- Use this node to:
26
+ - session actions
27
+ - linked chat actions
28
+ - message actions
37
29
 
38
- - list discovered chats and groups
39
- - list linked aliases
40
- - link a target to an alias
41
- - unlink an alias
30
+ ## How To Connect Your Number
42
31
 
43
- ### `WhatsThat Message`
32
+ 1. Add a `WhatsThat` node.
33
+ 2. Choose the action for sessions.
34
+ 3. Set `Operation` to `Connect Session`.
35
+ 4. Fill in:
36
+ - `Session Name`: a stable internal name like `main-phone`
37
+ - `Display Name`: a friendly label like `Luca phone`
38
+ - `WhatsApp Number`: optional, only if you want a pairing code instead of relying only on QR
39
+ 5. Run the node.
40
+ 6. In the output, open `qrCodeUrl`.
44
41
 
45
- Use this node to send:
42
+ Open `qrCodeUrl` as the standard and recommended way to connect the number.
46
43
 
47
- - text
48
- - image
49
- - video
50
- - audio
51
- - document
52
- - reaction
53
- - location
54
- - contact
55
- - poll
44
+ Important:
56
45
 
57
- For images and videos, the node can decide internally whether to send them as:
46
+ - open `qrCodeUrl` whenever possible
47
+ - do not rely on `pairingCode`
48
+ - `pairingCode` is not stable and may fail or stop working depending on the session state and device behavior
49
+ - `qrDataUrl` is available only if you specifically need the raw embedded QR image data
58
50
 
59
- - native media
60
- - file/document attachment
51
+ Example:
61
52
 
62
- ### `WhatsThat Trigger`
53
+ ```text
54
+ Session Name: main-phone
55
+ Display Name: Luca phone
56
+ WhatsApp Number: 393331234567
57
+ ```
63
58
 
64
- Use this node to listen for:
59
+ ## How To Wait Until The Number Is Fully Connected
65
60
 
66
- - incoming messages
67
- - your own sent messages
68
- - session pairing events
69
- - session connected/disconnected events
70
- - group updates
61
+ After `Connect Session`, add another `WhatsThat` node:
71
62
 
72
- ## How It Works
63
+ 1. Choose the action for sessions
64
+ 2. Set `Operation` to `Wait Until Connect`
65
+ 3. Use the same `Session Name`
66
+ 4. Choose how many seconds to wait in `Timeout Seconds`
73
67
 
74
- WhatsThat embeds Baileys directly in n8n.
68
+ This second node waits for the already-started session to become fully connected.
75
69
 
76
- - session auth files are stored on disk
77
- - session metadata and linked targets are stored as local JSON files under the runtime storage path
70
+ ## How To Link A Group Or Chat Manually
78
71
 
79
- ## Quick Start
72
+ 1. Add a `WhatsThat` node
73
+ 2. Choose the action for linked chats
74
+ 3. Start with `Operation = List Discovered Chats`
75
+ 4. Pick the chat or group you want to use
76
+ 5. Change to `Operation = Link Chat`
77
+ 6. Fill in:
78
+ - `Session Name`
79
+ - `Chat JID`
80
+ - `Linked Chat`: the simple name you want to use later, for example `support` or `team`
80
81
 
81
- 1. Create `WhatsThat Runtime` credentials.
82
- 2. Set a storage path, for example:
82
+ Example:
83
83
 
84
84
  ```text
85
- /home/node/.n8n/whatsthat
85
+ Linked Chat: support
86
86
  ```
87
87
 
88
- 3. Add `WhatsThat Session`.
89
- 4. Choose `Connect Session`, then provide:
90
- - `Session ID (Internal)`: a stable unique ID such as `main-phone`
91
- - `Label (Visible Name)`: a human-readable name such as `Luca personal phone`
92
- - optional `Phone Number For Pairing`: full number with country code, digits only, without `00` or `+`
93
- 5. Run the node and use the returned `pairingCode`, `qrCodeUrl`, or `qrDataUrl` to connect the device.
94
- 6. Add another `WhatsThat Session` node with `Ensure Session`.
95
- 7. Set `Return When` to `Connected` so the workflow waits until the already-started session finishes pairing.
96
- 8. Use `WhatsThat Targets` to discover and link chats/groups.
97
- 9. Use `WhatsThat Message` to send messages by alias or raw JID.
88
+ After that, you can send messages by choosing that linked chat instead of writing the raw JID every time.
98
89
 
99
- Example workflow:
90
+ ## How To Link A Group Or Chat From WhatsApp
100
91
 
101
- - [`examples/register-number.workflow.json`](./examples/register-number.workflow.json)
92
+ Use `WhatsThat Trigger`.
102
93
 
103
- ## Media Delivery
94
+ 1. Add a `WhatsThat Trigger` node
95
+ 2. Select the same `Session Name`
96
+ 3. Set `Event` to `Link Chat Command`
97
+ 4. Leave the default command or change it
104
98
 
105
- For `Image` and `Video` messages:
99
+ By default, users can send a message like:
106
100
 
107
- - `Native Media` sends them as normal media with preview
108
- - `As File` sends them as a document/file attachment
101
+ ```text
102
+ /link-whatsthat support
103
+ ```
109
104
 
110
- ## Notes
105
+ If that message is sent inside a group or chat, WhatsThat links that conversation with alias `support`.
111
106
 
112
- - This package runs an active WebSocket client inside n8n.
113
- - For production, use persistent storage for the auth directory.
114
- - Use one n8n instance as the runtime owner for these sessions.
107
+ This is useful when you want users to self-register a group without opening n8n.
115
108
 
116
- ## Thanks
109
+ ## How To Send A Message To A Linked Chat
110
+
111
+ 1. Add a `WhatsThat` node
112
+ 2. Choose the action for sending messages
113
+ 3. Set `Session Name`
114
+ 4. Set `Send Message To` to `Linked Chat`
115
+ 5. Choose a linked chat from the dropdown
116
+ 6. Choose `Message Type`
117
+ 7. Write the message
118
+
119
+ Example:
120
+
121
+ ```text
122
+ Send Message To: Linked Chat
123
+ Linked Chat: support
124
+ Message Type: Text
125
+ Message: Hello from n8n
126
+ ```
127
+
128
+ ## How To Send A Message To A Number
129
+
130
+ 1. Add a `WhatsThat` node
131
+ 2. Choose the action for sending messages
132
+ 3. Set `Send Message To` to `WhatsApp Number`
133
+ 4. Enter the number with country code, digits only, without `00` and without `+`
134
+
135
+ Example:
136
+
137
+ ```text
138
+ WhatsApp Number: 393331234567
139
+ ```
140
+
141
+ ## How To Send A Message To Yourself
117
142
 
118
- This project relies on [Baileys](https://github.com/WhiskeySockets/Baileys), the open-source TypeScript/Node.js library that powers the messaging client layer.
143
+ 1. Add a `WhatsThat` node
144
+ 2. Choose the action for sending messages
145
+ 3. Set `Send Message To` to `Yourself`
119
146
 
120
- Please review the Baileys project, its license, and its usage notes before running it in production:
147
+ WhatsThat uses the number already connected for that session.
148
+
149
+ This is useful for testing.
150
+
151
+ ## How To Send Media
152
+
153
+ For images and videos you can choose:
154
+
155
+ - `Native Media`
156
+ - `As File`
157
+
158
+ Use `Media URL` for the file you want to send.
159
+
160
+ Examples:
161
+
162
+ - send an image preview normally
163
+ - send a PDF as a document
164
+ - send a video as a file attachment
165
+
166
+ ## How To Receive Events
167
+
168
+ Use `WhatsThat Trigger` when you want to react to:
169
+
170
+ - incoming messages
171
+ - your own sent messages
172
+ - pairing events
173
+ - connection events
174
+ - group updates
175
+
176
+ Common examples:
177
+
178
+ - start a workflow when a message arrives
179
+ - auto-link a chat with `/link-whatsthat support`
180
+ - continue a workflow when a session becomes connected
181
+
182
+ ## Example Workflow
183
+
184
+ You can import this example:
185
+
186
+ - [`examples/register-number.workflow.json`](./examples/register-number.workflow.json)
187
+
188
+ It shows the basic flow:
189
+
190
+ 1. `Connect Session`
191
+ 2. `Wait Until Connect`
192
+
193
+ ## Notes
194
+
195
+ - Use one persistent n8n instance as the owner of these sessions
196
+ - Keep the runtime storage path persistent
197
+ - If n8n restarts, active in-memory sockets are restarted from the saved session files
198
+
199
+ ## Thanks
121
200
 
122
- - [Baileys repository](https://github.com/WhiskeySockets/Baileys)
201
+ This project uses [Baileys](https://github.com/WhiskeySockets/Baileys).
123
202
 
124
203
  ## License
125
204
 
@@ -0,0 +1,10 @@
1
+ import type { IExecuteFunctions, ILoadOptionsFunctions, INodeExecutionData, INodePropertyOptions, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class WhatsThat implements INodeType {
3
+ methods: {
4
+ loadOptions: {
5
+ getLinkedAliases(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
6
+ };
7
+ };
8
+ description: INodeTypeDescription;
9
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
10
+ }