@aldinokemal2104/n8n-nodes-gowa 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/LICENSE.md +19 -0
- package/README.md +102 -0
- package/dist/credentials/GOWAApi.credentials.d.ts +9 -0
- package/dist/credentials/GOWAApi.credentials.js +49 -0
- package/dist/credentials/GOWAApi.credentials.js.map +1 -0
- package/dist/nodes/GOWA/Gowa.node.d.ts +5 -0
- package/dist/nodes/GOWA/Gowa.node.js +136 -0
- package/dist/nodes/GOWA/Gowa.node.js.map +1 -0
- package/dist/nodes/GOWA/app.operations.d.ts +4 -0
- package/dist/nodes/GOWA/app.operations.js +59 -0
- package/dist/nodes/GOWA/app.operations.js.map +1 -0
- package/dist/nodes/GOWA/gowa-icon.svg +1 -0
- package/dist/nodes/GOWA/group.operations.d.ts +5 -0
- package/dist/nodes/GOWA/group.operations.js +176 -0
- package/dist/nodes/GOWA/group.operations.js.map +1 -0
- package/dist/nodes/GOWA/message.operations.d.ts +5 -0
- package/dist/nodes/GOWA/message.operations.js +166 -0
- package/dist/nodes/GOWA/message.operations.js.map +1 -0
- package/dist/nodes/GOWA/send.operations.d.ts +5 -0
- package/dist/nodes/GOWA/send.operations.js +440 -0
- package/dist/nodes/GOWA/send.operations.js.map +1 -0
- package/dist/nodes/GOWA/types.d.ts +11 -0
- package/dist/nodes/GOWA/types.js +3 -0
- package/dist/nodes/GOWA/types.js.map +1 -0
- package/dist/nodes/GOWA/user.operations.d.ts +5 -0
- package/dist/nodes/GOWA/user.operations.js +137 -0
- package/dist/nodes/GOWA/user.operations.js.map +1 -0
- package/dist/package.json +56 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/index.js +0 -0
- package/package.json +56 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright 2022 n8n
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
5
|
+
the Software without restriction, including without limitation the rights to
|
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
7
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
8
|
+
so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# n8n-nodes-gowa
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
This is an n8n community node for [GOWA (Go WhatsApp Web MultiDevice)](https://github.com/aldinokemal/go-whatsapp-web-multidevice) API integration.
|
|
6
|
+
|
|
7
|
+
GOWA provides a comprehensive WhatsApp Web API implementation written in Go, supporting multi-device functionality and extensive WhatsApp features.
|
|
8
|
+
|
|
9
|
+
[n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/reference/license/) workflow automation platform.
|
|
10
|
+
|
|
11
|
+
[Installation](#installation)
|
|
12
|
+
[Operations](#operations)
|
|
13
|
+
[Credentials](#credentials)
|
|
14
|
+
[Usage](#usage)
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n community nodes documentation.
|
|
19
|
+
|
|
20
|
+
## Operations
|
|
21
|
+
|
|
22
|
+
This node supports the following operations:
|
|
23
|
+
|
|
24
|
+
### App Management
|
|
25
|
+
|
|
26
|
+
* **Login** - Login to WhatsApp Web
|
|
27
|
+
* **Logout** - Logout from WhatsApp Web
|
|
28
|
+
* **Get Device Info** - Get device information
|
|
29
|
+
* **Reconnect** - Reconnect to WhatsApp Web
|
|
30
|
+
|
|
31
|
+
### Send Messages
|
|
32
|
+
|
|
33
|
+
* **Send Text** - Send text messages
|
|
34
|
+
* **Send Image** - Send images with optional caption
|
|
35
|
+
* **Send Audio** - Send audio files
|
|
36
|
+
* **Send File** - Send files/documents
|
|
37
|
+
* **Send Video** - Send videos with optional caption
|
|
38
|
+
* **Send Contact** - Send contact information
|
|
39
|
+
* **Send Location** - Send location coordinates
|
|
40
|
+
* **Send Poll** - Send polls with multiple options
|
|
41
|
+
|
|
42
|
+
### Message Management
|
|
43
|
+
|
|
44
|
+
* **Delete Message** - Delete a message
|
|
45
|
+
* **Revoke Message** - Revoke a message for everyone
|
|
46
|
+
* **React to Message** - Add emoji reactions to messages
|
|
47
|
+
* **Update Message** - Update message content
|
|
48
|
+
* **Read Message** - Mark message as read
|
|
49
|
+
* **Unread Message** - Mark message as unread
|
|
50
|
+
|
|
51
|
+
### Group Management
|
|
52
|
+
|
|
53
|
+
* **Create Group** - Create new WhatsApp groups
|
|
54
|
+
* **Add Participant** - Add participants to groups
|
|
55
|
+
* **Remove Participant** - Remove participants from groups
|
|
56
|
+
* **Promote Participant** - Promote participants to admin
|
|
57
|
+
* **Demote Participant** - Demote participants from admin
|
|
58
|
+
* **Leave Group** - Leave a group
|
|
59
|
+
|
|
60
|
+
### User Operations
|
|
61
|
+
|
|
62
|
+
* **Get User Info** - Get user profile information
|
|
63
|
+
* **Get Avatar** - Get user avatar image
|
|
64
|
+
* **Set Avatar** - Set user avatar image
|
|
65
|
+
* **Get Privacy Settings** - Get privacy settings
|
|
66
|
+
* **Check Contact** - Check if contact is on WhatsApp
|
|
67
|
+
|
|
68
|
+
## Credentials
|
|
69
|
+
|
|
70
|
+
This node requires GOWA API credentials:
|
|
71
|
+
|
|
72
|
+
1. **Host URL** - URL of your GOWA API server (default: <http://localhost:3000>)
|
|
73
|
+
2. **Username** - Basic auth username
|
|
74
|
+
3. **Password** - Basic auth password
|
|
75
|
+
|
|
76
|
+
The credentials use HTTP Basic Authentication to connect to your GOWA API instance.
|
|
77
|
+
|
|
78
|
+
## Usage
|
|
79
|
+
|
|
80
|
+
1. Set up your GOWA API server following the [official documentation](https://github.com/aldinokemal/go-whatsapp-web-multidevice)
|
|
81
|
+
2. Configure the GOWA API credentials in n8n
|
|
82
|
+
3. Add the GOWA node to your workflow
|
|
83
|
+
4. Select the desired resource and operation
|
|
84
|
+
5. Configure the required parameters for your operation
|
|
85
|
+
|
|
86
|
+
### Example: Send Text Message
|
|
87
|
+
|
|
88
|
+
1. Select **Send** as the resource
|
|
89
|
+
2. Select **Send Text** as the operation
|
|
90
|
+
3. Enter the phone number (with country code, without +)
|
|
91
|
+
4. Enter your message text
|
|
92
|
+
5. Execute the node
|
|
93
|
+
|
|
94
|
+
## Resources
|
|
95
|
+
|
|
96
|
+
* [n8n community nodes documentation](https://docs.n8n.io/integrations/community-nodes/)
|
|
97
|
+
* [GOWA GitHub Repository](https://github.com/aldinokemal/go-whatsapp-web-multidevice)
|
|
98
|
+
* [GOWA API Documentation](https://github.com/aldinokemal/go-whatsapp-web-multidevice/blob/main/docs/openapi.yaml)
|
|
99
|
+
|
|
100
|
+
## License
|
|
101
|
+
|
|
102
|
+
[MIT](LICENSE.md)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class GOWAApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
documentationUrl: string;
|
|
6
|
+
properties: INodeProperties[];
|
|
7
|
+
authenticate: IAuthenticateGeneric;
|
|
8
|
+
test: ICredentialTestRequest;
|
|
9
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GOWAApi = void 0;
|
|
4
|
+
class GOWAApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'goWhatsappApi';
|
|
7
|
+
this.displayName = 'GOWA API';
|
|
8
|
+
this.documentationUrl = 'https://github.com/aldinokemal/go-whatsapp-web-multidevice';
|
|
9
|
+
this.properties = [
|
|
10
|
+
{
|
|
11
|
+
displayName: 'Host URL',
|
|
12
|
+
name: 'hostUrl',
|
|
13
|
+
type: 'string',
|
|
14
|
+
default: 'http://localhost:3000',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
displayName: 'Username',
|
|
18
|
+
name: 'username',
|
|
19
|
+
type: 'string',
|
|
20
|
+
default: '',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
displayName: 'Password',
|
|
24
|
+
name: 'password',
|
|
25
|
+
type: 'string',
|
|
26
|
+
default: '',
|
|
27
|
+
typeOptions: {
|
|
28
|
+
password: true,
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
this.authenticate = {
|
|
33
|
+
type: 'generic',
|
|
34
|
+
properties: {
|
|
35
|
+
headers: {
|
|
36
|
+
Authorization: '={{"Basic "+($credentials.username + ":" + $credentials.password).base64Encode()}}',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
this.test = {
|
|
41
|
+
request: {
|
|
42
|
+
baseURL: '={{$credentials?.hostUrl}}',
|
|
43
|
+
url: '/',
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.GOWAApi = GOWAApi;
|
|
49
|
+
//# sourceMappingURL=GOWAApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GOWAApi.credentials.js","sourceRoot":"","sources":["../../credentials/GOWAApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,OAAO;IAApB;QACC,SAAI,GAAG,eAAe,CAAC;QACvB,gBAAW,GAAG,UAAU,CAAC;QACzB,qBAAgB,GAAG,4DAA4D,CAAC;QAChF,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,uBAAuB;aAChC;YACD;gBACC,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;aACX;YACD;gBACC,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE;oBACZ,QAAQ,EAAE,IAAI;iBACd;aACD;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,aAAa,EAAE,oFAAoF;iBACnG;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,4BAA4B;gBACrC,GAAG,EAAE,GAAG;aACR;SACD,CAAC;IACH,CAAC;CAAA;AA3CD,0BA2CC"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Gowa = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const app_operations_1 = require("./app.operations");
|
|
6
|
+
const send_operations_1 = require("./send.operations");
|
|
7
|
+
const message_operations_1 = require("./message.operations");
|
|
8
|
+
const group_operations_1 = require("./group.operations");
|
|
9
|
+
const user_operations_1 = require("./user.operations");
|
|
10
|
+
class Gowa {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.description = {
|
|
13
|
+
name: 'gowa',
|
|
14
|
+
displayName: 'GOWA',
|
|
15
|
+
icon: 'file:gowa-icon.svg',
|
|
16
|
+
group: ['messaging'],
|
|
17
|
+
version: 1,
|
|
18
|
+
subtitle: '={{$parameter["resource"] + ": " + $parameter["operation"]}}',
|
|
19
|
+
description: 'Interact with Go WhatsApp Web MultiDevice API',
|
|
20
|
+
defaults: {
|
|
21
|
+
name: 'GOWA',
|
|
22
|
+
},
|
|
23
|
+
inputs: ["main"],
|
|
24
|
+
outputs: ["main"],
|
|
25
|
+
credentials: [
|
|
26
|
+
{
|
|
27
|
+
name: 'goWhatsappApi',
|
|
28
|
+
required: true,
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
requestDefaults: {
|
|
32
|
+
baseURL: '={{$credentials.hostUrl}}',
|
|
33
|
+
headers: {
|
|
34
|
+
Accept: 'application/json',
|
|
35
|
+
'Content-Type': 'application/json',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
properties: [
|
|
39
|
+
{
|
|
40
|
+
displayName: 'Resource',
|
|
41
|
+
name: 'resource',
|
|
42
|
+
type: 'options',
|
|
43
|
+
noDataExpression: true,
|
|
44
|
+
options: [
|
|
45
|
+
{
|
|
46
|
+
name: 'App',
|
|
47
|
+
value: 'app',
|
|
48
|
+
description: 'App connection and device management',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'Chatting',
|
|
52
|
+
value: 'send',
|
|
53
|
+
description: 'Send messages and media',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: 'Group',
|
|
57
|
+
value: 'group',
|
|
58
|
+
description: 'Group management operations',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: 'Message',
|
|
62
|
+
value: 'message',
|
|
63
|
+
description: 'Message management operations',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: 'User',
|
|
67
|
+
value: 'user',
|
|
68
|
+
description: 'User profile and settings',
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
default: 'send',
|
|
72
|
+
},
|
|
73
|
+
...app_operations_1.appOperations,
|
|
74
|
+
...send_operations_1.sendOperations,
|
|
75
|
+
...send_operations_1.sendProperties,
|
|
76
|
+
...message_operations_1.messageOperations,
|
|
77
|
+
...message_operations_1.messageProperties,
|
|
78
|
+
...group_operations_1.groupOperations,
|
|
79
|
+
...group_operations_1.groupProperties,
|
|
80
|
+
...user_operations_1.userOperations,
|
|
81
|
+
...user_operations_1.userProperties,
|
|
82
|
+
],
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
async execute() {
|
|
86
|
+
const items = this.getInputData();
|
|
87
|
+
const returnData = [];
|
|
88
|
+
for (let i = 0; i < items.length; i++) {
|
|
89
|
+
try {
|
|
90
|
+
const resource = this.getNodeParameter('resource', i);
|
|
91
|
+
const operation = this.getNodeParameter('operation', i);
|
|
92
|
+
let responseData;
|
|
93
|
+
if (resource === 'app') {
|
|
94
|
+
responseData = await app_operations_1.executeAppOperation.call(this, operation, i);
|
|
95
|
+
}
|
|
96
|
+
else if (resource === 'send') {
|
|
97
|
+
responseData = await send_operations_1.executeSendOperation.call(this, operation, i);
|
|
98
|
+
}
|
|
99
|
+
else if (resource === 'message') {
|
|
100
|
+
responseData = await message_operations_1.executeMessageOperation.call(this, operation, i);
|
|
101
|
+
}
|
|
102
|
+
else if (resource === 'group') {
|
|
103
|
+
responseData = await group_operations_1.executeGroupOperation.call(this, operation, i);
|
|
104
|
+
}
|
|
105
|
+
else if (resource === 'user') {
|
|
106
|
+
responseData = await user_operations_1.executeUserOperation.call(this, operation, i);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown resource: ${resource}`);
|
|
110
|
+
}
|
|
111
|
+
if (Array.isArray(responseData)) {
|
|
112
|
+
returnData.push.apply(returnData, responseData);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
returnData.push({
|
|
116
|
+
json: responseData,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
if (this.continueOnFail()) {
|
|
122
|
+
returnData.push({
|
|
123
|
+
json: {
|
|
124
|
+
error: error.message,
|
|
125
|
+
},
|
|
126
|
+
});
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
throw error;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return [returnData];
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
exports.Gowa = Gowa;
|
|
136
|
+
//# sourceMappingURL=Gowa.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Gowa.node.js","sourceRoot":"","sources":["../../../nodes/GOWA/Gowa.node.ts"],"names":[],"mappings":";;;AAAA,+CAOsB;AAEtB,qDAAsE;AACtE,uDAAyF;AACzF,6DAAqG;AACrG,yDAA6F;AAC7F,uDAAyF;AAEzF,MAAa,IAAI;IAAjB;QACC,gBAAW,GAAyB;YACnC,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,MAAM;YACnB,IAAI,EAAE,oBAAoB;YAC1B,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,8DAA8D;YACxE,WAAW,EAAE,+CAA+C;YAC5D,QAAQ,EAAE;gBACT,IAAI,EAAE,MAAM;aACZ;YACD,MAAM,EAAE,QAAyB;YACjC,OAAO,EAAE,QAAyB;YAClC,WAAW,EAAE;gBACZ;oBACC,IAAI,EAAE,eAAe;oBACrB,QAAQ,EAAE,IAAI;iBACd;aACD;YACD,eAAe,EAAE;gBAChB,OAAO,EAAE,2BAA2B;gBACpC,OAAO,EAAE;oBACR,MAAM,EAAE,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C,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;oBAC3B,UAAU,CAAC,IAAI,CAAC;wBACf,IAAI,EAAE;4BACL,KAAK,EAAE,KAAK,CAAC,OAAO;yBACpB;qBACD,CAAC,CAAC;oBACH,SAAS;gBACV,CAAC;gBACD,MAAM,KAAK,CAAC;YACb,CAAC;QACF,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CAED;AA1HD,oBA0HC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.executeAppOperation = exports.appOperations = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
exports.appOperations = [
|
|
6
|
+
{
|
|
7
|
+
displayName: 'Operation',
|
|
8
|
+
name: 'operation',
|
|
9
|
+
type: 'options',
|
|
10
|
+
noDataExpression: true,
|
|
11
|
+
displayOptions: {
|
|
12
|
+
show: {
|
|
13
|
+
resource: ['app'],
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
options: [
|
|
17
|
+
{
|
|
18
|
+
name: 'Get Device Info',
|
|
19
|
+
value: 'getDeviceInfo',
|
|
20
|
+
description: 'Get device information',
|
|
21
|
+
action: 'Get device information',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'Reconnect',
|
|
25
|
+
value: 'reconnect',
|
|
26
|
+
description: 'Reconnect to WhatsApp Web',
|
|
27
|
+
action: 'Reconnect to whats app web',
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
default: 'getDeviceInfo',
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
const executeAppOperation = async function (operation, itemIndex) {
|
|
34
|
+
const credentials = await this.getCredentials('goWhatsappApi');
|
|
35
|
+
const baseUrl = credentials.hostUrl || 'http://localhost:3000';
|
|
36
|
+
const requestOptions = {
|
|
37
|
+
method: 'GET',
|
|
38
|
+
url: '',
|
|
39
|
+
body: {},
|
|
40
|
+
qs: {},
|
|
41
|
+
};
|
|
42
|
+
switch (operation) {
|
|
43
|
+
case 'getDeviceInfo':
|
|
44
|
+
requestOptions.url = `${baseUrl.replace(/\/$/, '')}/app/devices`;
|
|
45
|
+
break;
|
|
46
|
+
case 'reconnect':
|
|
47
|
+
requestOptions.url = `${baseUrl.replace(/\/$/, '')}/app/reconnect`;
|
|
48
|
+
break;
|
|
49
|
+
default:
|
|
50
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown app operation: ${operation}`);
|
|
51
|
+
}
|
|
52
|
+
const response = await this.helpers.requestWithAuthentication.call(this, 'goWhatsappApi', {
|
|
53
|
+
...requestOptions,
|
|
54
|
+
json: true,
|
|
55
|
+
});
|
|
56
|
+
return response;
|
|
57
|
+
};
|
|
58
|
+
exports.executeAppOperation = executeAppOperation;
|
|
59
|
+
//# sourceMappingURL=app.operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.operations.js","sourceRoot":"","sources":["../../../nodes/GOWA/app.operations.ts"],"names":[],"mappings":";;;AAAA,+CAKsB;AAGT,QAAA,aAAa,GAAsB;IAC/C;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,KAAK,CAAC;aACjB;SACD;QACD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,iBAAiB;gBACvB,KAAK,EAAE,eAAe;gBACtB,WAAW,EAAE,wBAAwB;gBACrC,MAAM,EAAE,wBAAwB;aAChC;YACD;gBACC,IAAI,EAAE,WAAW;gBACjB,KAAK,EAAE,WAAW;gBAClB,WAAW,EAAE,2BAA2B;gBACxC,MAAM,EAAE,4BAA4B;aACpC;SACD;QACD,OAAO,EAAE,eA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