n8n-nodes-wavy 1.0.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 ADDED
@@ -0,0 +1,34 @@
1
+ # n8n-nodes-wavy
2
+
3
+ This is an n8n community node for sending messages via the Wavy WhatsApp Gateway.
4
+
5
+ ## Features
6
+
7
+ - **Send Text**: Send standard text messages.
8
+ - **Send Media**: Send images, videos, audio, or documents via URL.
9
+ - **Send Interactive**: Send complex interactive messages (Native Flow, Buttons, etc.) using JSON payloads.
10
+ - **Send Carousel**: Send scrolling card carousels using JSON payloads.
11
+
12
+ ## Prerequisites
13
+
14
+ - An active Wavy instance.
15
+ - An API Key and the Base URL of your Wavy instance.
16
+
17
+ ## Installation
18
+
19
+ You can install this node via the community nodes panel in n8n settings.
20
+
21
+ ```bash
22
+ npm install n8n-nodes-wavy
23
+ ```
24
+
25
+ ## Credentials
26
+
27
+ To use this node, you need to configure the **Wavy API** credentials:
28
+
29
+ - **Base URL**: The protocol and domain/IP of your Wavy instance (e.g., `https://your-wavy.com`).
30
+ - **API Key**: Your Wavy API key for authentication.
31
+
32
+ ## License
33
+
34
+ MIT
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WavyApi = void 0;
4
+ class WavyApi {
5
+ constructor() {
6
+ this.name = 'wavyApi';
7
+ this.displayName = 'Wavy API';
8
+ this.documentationUrl = 'https://your-wavy-instance.com/docs';
9
+ this.properties = [
10
+ {
11
+ displayName: 'Base URL',
12
+ name: 'baseUrl',
13
+ type: 'string',
14
+ default: '',
15
+ placeholder: 'https://your-wavy-instance.com',
16
+ required: true,
17
+ },
18
+ {
19
+ displayName: 'API Key',
20
+ name: 'apiKey',
21
+ type: 'string',
22
+ typeOptions: {
23
+ password: true,
24
+ },
25
+ default: '',
26
+ required: true,
27
+ },
28
+ ];
29
+ }
30
+ }
31
+ exports.WavyApi = WavyApi;
@@ -0,0 +1,171 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Wavy = void 0;
4
+ class Wavy {
5
+ constructor() {
6
+ this.description = {
7
+ displayName: 'Wavy WhatsApp',
8
+ name: 'wavy',
9
+ icon: 'file:wavy.svg',
10
+ group: ['transform'],
11
+ version: 1,
12
+ description: 'Send messages via Wavy WhatsApp Gateway',
13
+ defaults: {
14
+ name: 'Wavy WhatsApp',
15
+ },
16
+ inputs: ['main'],
17
+ outputs: ['main'],
18
+ credentials: [
19
+ {
20
+ name: 'wavyApi',
21
+ required: true,
22
+ },
23
+ ],
24
+ properties: [
25
+ {
26
+ displayName: 'Operation',
27
+ name: 'operation',
28
+ type: 'options',
29
+ noDataExpression: true,
30
+ options: [
31
+ {
32
+ name: 'Send Text',
33
+ value: 'sendText',
34
+ description: 'Send a text message',
35
+ action: 'Send a text message',
36
+ },
37
+ {
38
+ name: 'Send Media',
39
+ value: 'sendMedia',
40
+ description: 'Send an image or file',
41
+ action: 'Send an image or file',
42
+ },
43
+ {
44
+ name: 'Send Interactive',
45
+ value: 'sendInteractive',
46
+ description: 'Send buttons or products',
47
+ action: 'Send buttons or products',
48
+ },
49
+ {
50
+ name: 'Send Carousel',
51
+ value: 'sendCarousel',
52
+ description: 'Send a carousel of cards',
53
+ action: 'Send a carousel of cards',
54
+ },
55
+ ],
56
+ default: 'sendText',
57
+ },
58
+ {
59
+ displayName: 'Phone Number',
60
+ name: 'phoneNumber',
61
+ type: 'string',
62
+ required: true,
63
+ default: '',
64
+ placeholder: '62812345678',
65
+ description: 'Recipient phone number with country code',
66
+ },
67
+ {
68
+ displayName: 'Message',
69
+ name: 'message',
70
+ type: 'string',
71
+ required: true,
72
+ default: '',
73
+ displayOptions: {
74
+ show: {
75
+ operation: ['sendText'],
76
+ },
77
+ },
78
+ },
79
+ {
80
+ displayName: 'Media URL',
81
+ name: 'mediaUrl',
82
+ type: 'string',
83
+ required: true,
84
+ default: '',
85
+ displayOptions: {
86
+ show: {
87
+ operation: ['sendMedia'],
88
+ },
89
+ },
90
+ },
91
+ {
92
+ displayName: 'Caption',
93
+ name: 'caption',
94
+ type: 'string',
95
+ default: '',
96
+ displayOptions: {
97
+ show: {
98
+ operation: ['sendMedia'],
99
+ },
100
+ },
101
+ },
102
+ {
103
+ displayName: 'Payload (JSON)',
104
+ name: 'payload',
105
+ type: 'json',
106
+ required: true,
107
+ default: '{}',
108
+ displayOptions: {
109
+ show: {
110
+ operation: ['sendInteractive', 'sendCarousel'],
111
+ },
112
+ },
113
+ description: 'The interactive/carousel message payload',
114
+ },
115
+ ],
116
+ };
117
+ }
118
+ async execute() {
119
+ const items = this.getInputData();
120
+ const returnData = [];
121
+ const credentials = await this.getCredentials('wavyApi');
122
+ for (let i = 0; i < items.length; i++) {
123
+ try {
124
+ const operation = this.getNodeParameter('operation', i);
125
+ const to = this.getNodeParameter('phoneNumber', i);
126
+ let endpoint = '';
127
+ let body = { to };
128
+ if (operation === 'sendText') {
129
+ endpoint = '/api/send';
130
+ body.message = this.getNodeParameter('message', i);
131
+ }
132
+ else if (operation === 'sendMedia') {
133
+ endpoint = '/api/send-media-url';
134
+ body.mediaUrl = this.getNodeParameter('mediaUrl', i);
135
+ body.message = this.getNodeParameter('caption', i);
136
+ }
137
+ else if (operation === 'sendInteractive') {
138
+ endpoint = '/api/send-interactive';
139
+ const payload = this.getNodeParameter('payload', i);
140
+ body = Object.assign(Object.assign({}, body), payload);
141
+ }
142
+ else if (operation === 'sendCarousel') {
143
+ endpoint = '/api/send-carousel';
144
+ const payload = this.getNodeParameter('payload', i);
145
+ body = Object.assign(Object.assign({}, body), payload);
146
+ }
147
+ const options = {
148
+ method: 'POST',
149
+ uri: `${credentials.baseUrl}${endpoint}`,
150
+ body,
151
+ headers: {
152
+ 'Authorization': `Bearer ${credentials.apiKey}`,
153
+ 'Content-Type': 'application/json',
154
+ },
155
+ json: true,
156
+ };
157
+ const response = await this.helpers.request(options);
158
+ returnData.push({ json: response });
159
+ }
160
+ catch (error) {
161
+ if (this.continueOnFail()) {
162
+ returnData.push({ json: { error: error.message } });
163
+ continue;
164
+ }
165
+ throw error;
166
+ }
167
+ }
168
+ return [returnData];
169
+ }
170
+ }
171
+ exports.Wavy = Wavy;
@@ -0,0 +1,5 @@
1
+ <svg width="100" height="100" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <circle cx="50" cy="50" r="45" fill="#4f46e5"/>
3
+ <path d="M30 50C30 40 38 30 50 30C62 30 70 40 70 50C70 60 62 70 50 70C38 70 30 60 30 50Z" stroke="white" stroke-width="5"/>
4
+ <path d="M40 50L45 55L60 45" stroke="white" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
5
+ </svg>
package/index.js ADDED
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const Wavy_node_1 = require("./dist/nodes/Wavy/Wavy.node");
4
+ const WavyApi_credentials_1 = require("./dist/credentials/WavyApi.credentials");
5
+ module.exports = {
6
+ nodes: [Wavy_node_1.Wavy],
7
+ credentials: [WavyApi_credentials_1.WavyApi],
8
+ };
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "n8n-nodes-wavy",
3
+ "version": "1.0.0",
4
+ "description": "n8n community node for Wavy WhatsApp Gateway",
5
+ "files": [
6
+ "dist",
7
+ "index.js",
8
+ "README.md"
9
+ ],
10
+ "keywords": [
11
+ "n8n-community-node-package",
12
+ "whatsapp",
13
+ "wavy",
14
+ "baileys"
15
+ ],
16
+ "license": "MIT",
17
+ "main": "index.js",
18
+ "scripts": {
19
+ "build": "tsc",
20
+ "watch": "tsc -w"
21
+ },
22
+ "n8n": {
23
+ "nodes": [
24
+ "dist/nodes/Wavy/Wavy.node.js"
25
+ ],
26
+ "credentials": [
27
+ "dist/credentials/WavyApi.credentials.js"
28
+ ]
29
+ },
30
+ "devDependencies": {
31
+ "n8n-workflow": "^0.110.0",
32
+ "typescript": "~4.5.4"
33
+ }
34
+ }