n8n-nodes-unlimited-messaging 0.1.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.
@@ -0,0 +1,9 @@
1
+ import type { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class UnlimitedMessagingApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ documentationUrl: string;
6
+ properties: INodeProperties[];
7
+ authenticate: IAuthenticateGeneric;
8
+ test: ICredentialTestRequest;
9
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnlimitedMessagingApi = void 0;
4
+ class UnlimitedMessagingApi {
5
+ constructor() {
6
+ this.name = 'unlimitedMessagingApi';
7
+ this.displayName = 'Unlimited Messaging API';
8
+ this.documentationUrl = 'https://docs.unlimitedmessaging.app';
9
+ this.properties = [
10
+ {
11
+ displayName: 'API Token',
12
+ name: 'apiToken',
13
+ type: 'string',
14
+ typeOptions: { password: true },
15
+ default: '',
16
+ hint: 'Generate your token at https://app.unlimitedmessaging.app/settings/tokens',
17
+ },
18
+ ];
19
+ // Injects "Authorization: Bearer <token>" on every request automatically
20
+ this.authenticate = {
21
+ type: 'generic',
22
+ properties: {
23
+ headers: {
24
+ Authorization: '=Bearer {{$credentials.apiToken}}',
25
+ },
26
+ },
27
+ };
28
+ // n8n uses this to let users test their credential in the UI
29
+ this.test = {
30
+ request: {
31
+ baseURL: 'https://api.unlimitedmessaging.app',
32
+ url: '/sim',
33
+ method: 'GET',
34
+ },
35
+ };
36
+ }
37
+ }
38
+ exports.UnlimitedMessagingApi = UnlimitedMessagingApi;
@@ -0,0 +1,5 @@
1
+ import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class UnlimitedMessaging implements INodeType {
3
+ description: INodeTypeDescription;
4
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
+ }
@@ -0,0 +1,287 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnlimitedMessaging = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const BASE_URL = 'https://api.unlimitedmessaging.app';
6
+ // httpRequestWithAuthentication requires `this: IAllExecuteFunctions` (union type in n8n-workflow 2.x).
7
+ // IExecuteFunctions is a member of that union, so we cast for the .call() invocation.
8
+ function request(ctx, credentialName, options) {
9
+ return ctx.helpers.httpRequestWithAuthentication.call(ctx, credentialName, options);
10
+ }
11
+ class UnlimitedMessaging {
12
+ constructor() {
13
+ this.description = {
14
+ displayName: 'Unlimited Messaging',
15
+ name: 'unlimitedMessaging',
16
+ icon: 'file:unlimitedmessaging.svg',
17
+ group: ['transform'],
18
+ version: 1,
19
+ subtitle: '={{$parameter["operation"] + " " + $parameter["resource"]}}',
20
+ description: 'Send and receive WhatsApp messages via the Unlimited Messaging API',
21
+ defaults: { name: 'Unlimited Messaging' },
22
+ inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
23
+ outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
24
+ credentials: [
25
+ {
26
+ name: 'unlimitedMessagingApi',
27
+ required: true,
28
+ },
29
+ ],
30
+ properties: [
31
+ // ─── Resource ──────────────────────────────────────────────────────────
32
+ {
33
+ displayName: 'Resource',
34
+ name: 'resource',
35
+ type: 'options',
36
+ noDataExpression: true,
37
+ options: [
38
+ { name: 'Message', value: 'message' },
39
+ { name: 'SIM', value: 'sim' },
40
+ ],
41
+ default: 'message',
42
+ },
43
+ // ─── Message operations ─────────────────────────────────────────────
44
+ {
45
+ displayName: 'Operation',
46
+ name: 'operation',
47
+ type: 'options',
48
+ noDataExpression: true,
49
+ displayOptions: { show: { resource: ['message'] } },
50
+ options: [
51
+ {
52
+ name: 'Send',
53
+ value: 'send',
54
+ description: 'Send a WhatsApp message',
55
+ action: 'Send a message',
56
+ },
57
+ {
58
+ name: 'Get',
59
+ value: 'get',
60
+ description: 'Get a message by ID',
61
+ action: 'Get a message',
62
+ },
63
+ {
64
+ name: 'List',
65
+ value: 'list',
66
+ description: 'List messages with optional filters',
67
+ action: 'List messages',
68
+ },
69
+ ],
70
+ default: 'send',
71
+ },
72
+ // ─── SIM operations ─────────────────────────────────────────────────
73
+ {
74
+ displayName: 'Operation',
75
+ name: 'operation',
76
+ type: 'options',
77
+ noDataExpression: true,
78
+ displayOptions: { show: { resource: ['sim'] } },
79
+ options: [
80
+ {
81
+ name: 'List',
82
+ value: 'list',
83
+ description: 'List all linked SIM cards (WhatsApp accounts)',
84
+ action: 'List SIMs',
85
+ },
86
+ ],
87
+ default: 'list',
88
+ },
89
+ // ─── Message > Send ─────────────────────────────────────────────────
90
+ {
91
+ displayName: 'Recipient',
92
+ name: 'recipient',
93
+ type: 'string',
94
+ required: true,
95
+ default: '',
96
+ placeholder: '+33612345678',
97
+ description: 'Phone number of the recipient in E.164 format',
98
+ displayOptions: { show: { resource: ['message'], operation: ['send'] } },
99
+ },
100
+ {
101
+ displayName: 'Text',
102
+ name: 'text',
103
+ type: 'string',
104
+ required: true,
105
+ default: '',
106
+ typeOptions: { rows: 3 },
107
+ description: 'Message content (max 1 600 characters)',
108
+ displayOptions: { show: { resource: ['message'], operation: ['send'] } },
109
+ },
110
+ {
111
+ displayName: 'SIM ID',
112
+ name: 'simId',
113
+ type: 'string',
114
+ default: '',
115
+ description: 'ID of the SIM card (WhatsApp account) to send from. Leave empty to let Unlimited Messaging pick one automatically.',
116
+ displayOptions: { show: { resource: ['message'], operation: ['send'] } },
117
+ },
118
+ // ─── Message > Get ──────────────────────────────────────────────────
119
+ {
120
+ displayName: 'Message ID',
121
+ name: 'messageId',
122
+ type: 'string',
123
+ required: true,
124
+ default: '',
125
+ description: 'ID of the message to retrieve',
126
+ displayOptions: { show: { resource: ['message'], operation: ['get'] } },
127
+ },
128
+ // ─── Message > List ─────────────────────────────────────────────────
129
+ {
130
+ displayName: 'Return All',
131
+ name: 'returnAll',
132
+ type: 'boolean',
133
+ default: false,
134
+ description: 'Whether to return all results by paginating automatically, or only the first page',
135
+ displayOptions: { show: { resource: ['message'], operation: ['list'] } },
136
+ },
137
+ {
138
+ displayName: 'Limit',
139
+ name: 'limit',
140
+ type: 'number',
141
+ default: 20,
142
+ typeOptions: { minValue: 1, maxValue: 100 },
143
+ description: 'Max number of messages to return',
144
+ displayOptions: {
145
+ show: { resource: ['message'], operation: ['list'], returnAll: [false] },
146
+ },
147
+ },
148
+ {
149
+ displayName: 'Filters',
150
+ name: 'filters',
151
+ type: 'collection',
152
+ placeholder: 'Add Filter',
153
+ default: {},
154
+ displayOptions: { show: { resource: ['message'], operation: ['list'] } },
155
+ options: [
156
+ {
157
+ displayName: 'Status',
158
+ name: 'status',
159
+ type: 'options',
160
+ options: [
161
+ { name: 'Delivered', value: 'DELIVERED' },
162
+ { name: 'Failed', value: 'FAILED' },
163
+ { name: 'Pending', value: 'PENDING' },
164
+ { name: 'Read', value: 'READ' },
165
+ { name: 'Sending', value: 'SENDING' },
166
+ { name: 'Sent', value: 'SENT' },
167
+ ],
168
+ default: 'SENT',
169
+ description: 'Filter messages by delivery status',
170
+ },
171
+ {
172
+ displayName: 'SIM ID',
173
+ name: 'simId',
174
+ type: 'string',
175
+ default: '',
176
+ description: 'Filter messages from a specific SIM card',
177
+ },
178
+ {
179
+ displayName: 'Search',
180
+ name: 'search',
181
+ type: 'string',
182
+ default: '',
183
+ description: 'Full-text search in message content',
184
+ },
185
+ ],
186
+ },
187
+ ],
188
+ };
189
+ }
190
+ async execute() {
191
+ const items = this.getInputData();
192
+ const results = [];
193
+ for (let i = 0; i < items.length; i++) {
194
+ try {
195
+ const resource = this.getNodeParameter('resource', i);
196
+ const operation = this.getNodeParameter('operation', i);
197
+ let responseData;
198
+ if (resource === 'message') {
199
+ if (operation === 'send') {
200
+ const recipient = this.getNodeParameter('recipient', i);
201
+ const text = this.getNodeParameter('text', i);
202
+ const simId = this.getNodeParameter('simId', i);
203
+ const body = { recipient, text };
204
+ if (simId)
205
+ body.simId = simId;
206
+ responseData = await request(this, 'unlimitedMessagingApi', {
207
+ method: 'POST',
208
+ url: `${BASE_URL}/message`,
209
+ body,
210
+ json: true,
211
+ });
212
+ }
213
+ else if (operation === 'get') {
214
+ const messageId = this.getNodeParameter('messageId', i);
215
+ responseData = await request(this, 'unlimitedMessagingApi', {
216
+ method: 'GET',
217
+ url: `${BASE_URL}/message/${messageId}`,
218
+ json: true,
219
+ });
220
+ }
221
+ else if (operation === 'list') {
222
+ const returnAll = this.getNodeParameter('returnAll', i);
223
+ const filters = this.getNodeParameter('filters', i);
224
+ // Strip empty strings so they don't appear in the query string
225
+ const cleanFilters = Object.fromEntries(Object.entries(filters).filter(([, v]) => v !== '' && v !== null && v !== undefined));
226
+ if (returnAll) {
227
+ const all = [];
228
+ let page = 1;
229
+ let totalPages = 1;
230
+ do {
231
+ const resp = await request(this, 'unlimitedMessagingApi', {
232
+ method: 'GET',
233
+ url: `${BASE_URL}/message`,
234
+ qs: { page, limit: 100, ...cleanFilters },
235
+ json: true,
236
+ });
237
+ all.push(...resp.data);
238
+ totalPages = resp.totalPages;
239
+ page++;
240
+ } while (page <= totalPages);
241
+ responseData = all;
242
+ }
243
+ else {
244
+ const limit = this.getNodeParameter('limit', i);
245
+ const resp = await request(this, 'unlimitedMessagingApi', {
246
+ method: 'GET',
247
+ url: `${BASE_URL}/message`,
248
+ qs: { page: 1, limit, ...cleanFilters },
249
+ json: true,
250
+ });
251
+ responseData = resp.data;
252
+ }
253
+ }
254
+ else {
255
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
256
+ }
257
+ }
258
+ else if (resource === 'sim') {
259
+ if (operation === 'list') {
260
+ responseData = (await request(this, 'unlimitedMessagingApi', {
261
+ method: 'GET',
262
+ url: `${BASE_URL}/sim`,
263
+ json: true,
264
+ }));
265
+ }
266
+ else {
267
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
268
+ }
269
+ }
270
+ else {
271
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown resource: ${resource}`);
272
+ }
273
+ const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(Array.isArray(responseData) ? responseData : [responseData]), { itemData: { item: i } });
274
+ results.push(...executionData);
275
+ }
276
+ catch (error) {
277
+ if (this.continueOnFail()) {
278
+ results.push({ json: { error: error.message }, pairedItem: { item: i } });
279
+ continue;
280
+ }
281
+ throw error;
282
+ }
283
+ }
284
+ return [results];
285
+ }
286
+ }
287
+ exports.UnlimitedMessaging = UnlimitedMessaging;
@@ -0,0 +1,13 @@
1
+ {
2
+ "node": "n8n-nodes-unlimited-messaging.unlimitedMessaging",
3
+ "nodeVersion": "1.0",
4
+ "codexVersion": "1.0",
5
+ "categories": ["Communication"],
6
+ "resources": {
7
+ "primaryDocumentation": [
8
+ {
9
+ "url": "https://docs.unlimitedmessaging.app"
10
+ }
11
+ ]
12
+ }
13
+ }
@@ -0,0 +1,10 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 300" width="300" height="300">
2
+ <defs>
3
+ <style><![CDATA[
4
+ @import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,800&display=swap');
5
+ ]]></style>
6
+ </defs>
7
+ <rect width="300" height="300" fill="#ffffff"/>
8
+ <text x="150" y="140" text-anchor="middle" font-family="'Bricolage Grotesque', sans-serif" font-weight="800" font-size="48" letter-spacing="-0.03em" fill="#0D1F16">Unlimited</text>
9
+ <text x="150" y="184" text-anchor="middle" font-family="'Bricolage Grotesque', sans-serif" font-weight="800" font-size="48" letter-spacing="-0.03em" fill="#075E54">Messaging</text>
10
+ </svg>
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "n8n-nodes-unlimited-messaging",
3
+ "version": "0.1.0",
4
+ "description": "n8n community node for Unlimited Messaging — send and receive WhatsApp messages in your workflows on unlimitedmessaging.app",
5
+ "keywords": [
6
+ "n8n-community-node-package",
7
+ "whatsapp",
8
+ "messaging",
9
+ "unlimited-messaging",
10
+ "whatsapp-api",
11
+ "n8n"
12
+ ],
13
+ "license": "MIT",
14
+ "homepage": "https://unlimitedmessaging.app",
15
+ "author": {
16
+ "name": "Ilian",
17
+ "email": "ilian572@gmail.com",
18
+ "url": "https://ilianazz.com"
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "https://github.com/unlimitedmessaging/unlimited-messaging-sdk.git",
23
+ "directory": "sdk/n8n"
24
+ },
25
+ "bugs": {
26
+ "url": "https://github.com/unlimitedmessaging/unlimited-messaging-sdk/issues"
27
+ },
28
+ "files": [
29
+ "dist"
30
+ ],
31
+ "n8n": {
32
+ "n8nNodesApiVersion": 1,
33
+ "credentials": [
34
+ "dist/credentials/UnlimitedMessagingApi.credentials.js"
35
+ ],
36
+ "nodes": [
37
+ "dist/nodes/UnlimitedMessaging/UnlimitedMessaging.node.js"
38
+ ]
39
+ },
40
+ "scripts": {
41
+ "build": "tsc -p tsconfig.json && copyfiles -u 1 \"nodes/**/*.svg\" \"nodes/**/*.json\" dist/nodes/",
42
+ "dev": "tsc -p tsconfig.json --watch",
43
+ "prepublishOnly": "npm run build"
44
+ },
45
+ "devDependencies": {
46
+ "@types/node": "^18.0.0",
47
+ "copyfiles": "^2.4.1",
48
+ "n8n-workflow": "*",
49
+ "typescript": "^5.0.0"
50
+ },
51
+ "peerDependencies": {
52
+ "n8n-workflow": "*"
53
+ },
54
+ "engines": {
55
+ "node": ">=18"
56
+ }
57
+ }