@astervia/n8n-nodes-wacraft 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.
- package/README.md +191 -0
- package/dist/credentials/WacraftApi.credentials.d.ts +8 -0
- package/dist/credentials/WacraftApi.credentials.js +56 -0
- package/dist/credentials/WacraftApi.credentials.js.map +1 -0
- package/dist/nodes/Wacraft/GenericFunctions.d.ts +12 -0
- package/dist/nodes/Wacraft/GenericFunctions.js +131 -0
- package/dist/nodes/Wacraft/GenericFunctions.js.map +1 -0
- package/dist/nodes/Wacraft/Wacraft.node.d.ts +5 -0
- package/dist/nodes/Wacraft/Wacraft.node.js +1043 -0
- package/dist/nodes/Wacraft/Wacraft.node.js.map +1 -0
- package/dist/nodes/Wacraft/wacraft.svg +4 -0
- package/package.json +55 -0
package/README.md
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# @astervia/n8n-nodes-wacraft
|
|
2
|
+
|
|
3
|
+
n8n community node for [wacraft](https://github.com/Astervia/wacraft-server) — a WhatsApp Cloud API backend server. This node lets you manage contacts, send messages, handle media, and retrieve templates directly from your n8n workflows.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
### Community node (recommended)
|
|
8
|
+
|
|
9
|
+
1. Open your n8n instance.
|
|
10
|
+
2. Go to **Settings > Community Nodes**.
|
|
11
|
+
3. Search for `@astervia/n8n-nodes-wacraft` and click **Install**.
|
|
12
|
+
|
|
13
|
+
### Manual installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
cd ~/.n8n/custom
|
|
17
|
+
npm install @astervia/n8n-nodes-wacraft
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Then restart n8n.
|
|
21
|
+
|
|
22
|
+
### Development (npm link)
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
git clone https://github.com/Astervia/n8n-nodes-wacraft.git
|
|
26
|
+
cd n8n-nodes-wacraft
|
|
27
|
+
npm install
|
|
28
|
+
npm run build
|
|
29
|
+
npm link
|
|
30
|
+
|
|
31
|
+
cd ~/.n8n
|
|
32
|
+
npm link @astervia/n8n-nodes-wacraft
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Restart n8n. The **Wacraft** node will appear in the node picker.
|
|
36
|
+
|
|
37
|
+
## Credentials
|
|
38
|
+
|
|
39
|
+
Create a **Wacraft API** credential with the following fields:
|
|
40
|
+
|
|
41
|
+
| Field | Description |
|
|
42
|
+
| ------------------------ | --------------------------------------------------------------------------------------- |
|
|
43
|
+
| **Base URL** | Your wacraft server URL (e.g. `http://localhost:6900`). No trailing slash. |
|
|
44
|
+
| **Username (Email)** | The email used to sign in. |
|
|
45
|
+
| **Password** | The account password. |
|
|
46
|
+
| **Default Workspace ID** | UUID sent as `X-Workspace-ID` header on every request. Can be overridden per operation. |
|
|
47
|
+
|
|
48
|
+
### Authentication flow
|
|
49
|
+
|
|
50
|
+
The node authenticates via `POST /user/oauth/token` using the **password** grant type. Tokens are cached in memory and automatically refreshed using the **refresh_token** grant before expiry. If a refresh fails, the node falls back to a fresh password grant.
|
|
51
|
+
|
|
52
|
+
## Resources and operations
|
|
53
|
+
|
|
54
|
+
### Contact
|
|
55
|
+
|
|
56
|
+
| Operation | Description |
|
|
57
|
+
| ------------ | ----------------------------------------------------------------------------------------------------- |
|
|
58
|
+
| **Get Many** | Retrieve a paginated list of contacts with optional filters (name, email, sort order, limit, offset). |
|
|
59
|
+
| **Create** | Create a new contact (name, email, photo path). |
|
|
60
|
+
| **Update** | Update an existing contact by ID. |
|
|
61
|
+
| **Delete** | Delete a contact by ID. |
|
|
62
|
+
|
|
63
|
+
### Message
|
|
64
|
+
|
|
65
|
+
| Operation | Description |
|
|
66
|
+
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
67
|
+
| **Get Many** | Retrieve a paginated list of messages with filters (from/to ID, messaging product ID, date range). |
|
|
68
|
+
| **Search by Content** | Search messages using ILIKE text matching against content fields. |
|
|
69
|
+
| **Send WhatsApp Message** | Send a WhatsApp message to a messaging product contact. Accepts the message payload as JSON following the WhatsApp Cloud API format. |
|
|
70
|
+
| **Mark as Read** | Mark the latest message in a conversation as read (shows double blue check). |
|
|
71
|
+
| **Send Typing** | Mark as read and display a typing indicator to the WhatsApp user. |
|
|
72
|
+
|
|
73
|
+
### Messaging Product
|
|
74
|
+
|
|
75
|
+
| Operation | Description |
|
|
76
|
+
| ------------ | ------------------------------------------------------ |
|
|
77
|
+
| **Get Many** | Retrieve messaging products (currently only WhatsApp). |
|
|
78
|
+
|
|
79
|
+
### Messaging Product Contact
|
|
80
|
+
|
|
81
|
+
| Operation | Description |
|
|
82
|
+
| ------------------------- | ---------------------------------------------------------------------------- |
|
|
83
|
+
| **Get Many** | Retrieve messaging product contacts with filters. |
|
|
84
|
+
| **Get WhatsApp Contacts** | Retrieve WhatsApp-specific contacts with phone number and WA ID filters. |
|
|
85
|
+
| **Search by Content** | Search contacts by content text using ILIKE. |
|
|
86
|
+
| **Create** | Create a messaging product contact linking a contact to a messaging product. |
|
|
87
|
+
| **Create WhatsApp** | Create a WhatsApp contact with phone number and WA ID. |
|
|
88
|
+
| **Delete** | Delete a messaging product contact by ID. |
|
|
89
|
+
| **Block** | Block a messaging product contact. |
|
|
90
|
+
| **Unblock** | Unblock a messaging product contact. |
|
|
91
|
+
|
|
92
|
+
### Media
|
|
93
|
+
|
|
94
|
+
| Operation | Description |
|
|
95
|
+
| ------------ | ------------------------------------------------------------------------- |
|
|
96
|
+
| **Get Info** | Get media info including a temporary download URL (expires in 5 minutes). |
|
|
97
|
+
| **Download** | Download WhatsApp media by ID. Returns binary data. |
|
|
98
|
+
| **Upload** | Upload a media file to WhatsApp. Accepts a binary property and MIME type. |
|
|
99
|
+
|
|
100
|
+
### Template
|
|
101
|
+
|
|
102
|
+
| Operation | Description |
|
|
103
|
+
| ------------ | ---------------------------------------------------------------------------------------------------------------------------------- |
|
|
104
|
+
| **Get Many** | Retrieve WhatsApp message templates with filters for category, status, quality score, language, name, and cursor-based pagination. |
|
|
105
|
+
|
|
106
|
+
## Workspace ID override
|
|
107
|
+
|
|
108
|
+
Every operation includes an optional **Workspace ID Override** field. When set, it replaces the default workspace ID from the credentials for that specific execution. This is useful when a single n8n instance interacts with multiple wacraft workspaces.
|
|
109
|
+
|
|
110
|
+
## Sending a WhatsApp message
|
|
111
|
+
|
|
112
|
+
The **Send WhatsApp Message** operation requires:
|
|
113
|
+
|
|
114
|
+
- **To ID**: The messaging product contact ID (not a phone number).
|
|
115
|
+
- **Sender Data (JSON)**: The WhatsApp Cloud API message payload.
|
|
116
|
+
|
|
117
|
+
Example sender data for a text message:
|
|
118
|
+
|
|
119
|
+
```json
|
|
120
|
+
{
|
|
121
|
+
"messaging_product": "whatsapp",
|
|
122
|
+
"type": "text",
|
|
123
|
+
"text": {
|
|
124
|
+
"body": "Hello from n8n!"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Example sender data for a template message:
|
|
130
|
+
|
|
131
|
+
```json
|
|
132
|
+
{
|
|
133
|
+
"messaging_product": "whatsapp",
|
|
134
|
+
"type": "template",
|
|
135
|
+
"template": {
|
|
136
|
+
"name": "hello_world",
|
|
137
|
+
"language": {
|
|
138
|
+
"code": "en_US"
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Testing with Docker
|
|
145
|
+
|
|
146
|
+
Build and run a custom n8n image with the node pre-installed using Docker Compose:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
docker compose -f docker-compose.test.yml up --build
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Open `http://localhost:5678` and the **Wacraft** node will appear in the node picker.
|
|
153
|
+
|
|
154
|
+
If your wacraft server is running on the host machine, use `http://host.docker.internal:6900` as the base URL. The compose file already includes the `extra_hosts` mapping so `host.docker.internal` resolves correctly on all platforms including Linux.
|
|
155
|
+
|
|
156
|
+
## Development
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
npm install # Install dependencies
|
|
160
|
+
npm run build # Compile TypeScript and copy icons
|
|
161
|
+
npm run dev # Watch mode for TypeScript
|
|
162
|
+
npm run lint # Lint with ESLint
|
|
163
|
+
npm run lint:fix # Lint and auto-fix
|
|
164
|
+
npm run format # Format code with Prettier
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Project structure
|
|
168
|
+
|
|
169
|
+
```
|
|
170
|
+
n8n-nodes-wacraft/
|
|
171
|
+
├── .github/workflows/
|
|
172
|
+
│ ├── codeql-analysis.yml # CodeQL SAST scanning
|
|
173
|
+
│ ├── quality-and-security.yml # Lint, format, audit, build on push/PR
|
|
174
|
+
│ └── release.yml # Publish to npm on GitHub Release
|
|
175
|
+
├── credentials/
|
|
176
|
+
│ └── WacraftApi.credentials.ts # Credential definition
|
|
177
|
+
├── nodes/Wacraft/
|
|
178
|
+
│ ├── GenericFunctions.ts # Auth helpers and API request functions
|
|
179
|
+
│ ├── Wacraft.node.ts # Node definition with all resources
|
|
180
|
+
│ └── wacraft.svg # Node icon
|
|
181
|
+
├── Dockerfile.test
|
|
182
|
+
├── docker-compose.test.yml
|
|
183
|
+
├── eslint.config.mjs
|
|
184
|
+
├── gulpfile.js
|
|
185
|
+
├── package.json
|
|
186
|
+
└── tsconfig.json
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## License
|
|
190
|
+
|
|
191
|
+
[MIT](https://opensource.org/licenses/MIT)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ICredentialTestRequest, ICredentialType, INodeProperties } from "n8n-workflow";
|
|
2
|
+
export declare class WacraftApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
documentationUrl: string;
|
|
6
|
+
properties: INodeProperties[];
|
|
7
|
+
test: ICredentialTestRequest;
|
|
8
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WacraftApi = void 0;
|
|
4
|
+
class WacraftApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = "wacraftApi";
|
|
7
|
+
this.displayName = "Wacraft API";
|
|
8
|
+
this.documentationUrl = "https://github.com/Astervia/wacraft-server";
|
|
9
|
+
this.properties = [
|
|
10
|
+
{
|
|
11
|
+
displayName: "Base URL",
|
|
12
|
+
name: "baseUrl",
|
|
13
|
+
type: "string",
|
|
14
|
+
default: "http://localhost:6900",
|
|
15
|
+
placeholder: "https://your-wacraft-server.com",
|
|
16
|
+
description: "The base URL of your wacraft server (no trailing slash)",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
displayName: "Username (Email)",
|
|
20
|
+
name: "username",
|
|
21
|
+
type: "string",
|
|
22
|
+
default: "",
|
|
23
|
+
placeholder: "user@mail.com",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
displayName: "Password",
|
|
27
|
+
name: "password",
|
|
28
|
+
type: "string",
|
|
29
|
+
typeOptions: { password: true },
|
|
30
|
+
default: "",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
displayName: "Default Workspace ID",
|
|
34
|
+
name: "workspaceId",
|
|
35
|
+
type: "string",
|
|
36
|
+
default: "",
|
|
37
|
+
description: "Default workspace UUID sent as X-Workspace-ID header. Can be overridden per operation.",
|
|
38
|
+
},
|
|
39
|
+
];
|
|
40
|
+
// The credential test hits the token endpoint with password grant
|
|
41
|
+
this.test = {
|
|
42
|
+
request: {
|
|
43
|
+
baseURL: "={{$credentials.baseUrl}}",
|
|
44
|
+
url: "/user/oauth/token",
|
|
45
|
+
method: "POST",
|
|
46
|
+
body: {
|
|
47
|
+
grant_type: "password",
|
|
48
|
+
username: "={{$credentials.username}}",
|
|
49
|
+
password: "={{$credentials.password}}",
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.WacraftApi = WacraftApi;
|
|
56
|
+
//# sourceMappingURL=WacraftApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WacraftApi.credentials.js","sourceRoot":"","sources":["../../credentials/WacraftApi.credentials.ts"],"names":[],"mappings":";;;AAEA,MAAa,UAAU;IAAvB;QACI,SAAI,GAAG,YAAY,CAAC;QACpB,gBAAW,GAAG,aAAa,CAAC;QAC5B,qBAAgB,GAAG,4CAA4C,CAAC;QAEhE,eAAU,GAAsB;YAC5B;gBACI,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,uBAAuB;gBAChC,WAAW,EAAE,iCAAiC;gBAC9C,WAAW,EAAE,yDAAyD;aACzE;YACD;gBACI,WAAW,EAAE,kBAAkB;gBAC/B,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,eAAe;aAC/B;YACD;gBACI,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;aACd;YACD;gBACI,WAAW,EAAE,sBAAsB;gBACnC,IAAI,EAAE,aAAa;gBACnB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EACP,wFAAwF;aAC/F;SACJ,CAAC;QAEF,kEAAkE;QAClE,SAAI,GAA2B;YAC3B,OAAO,EAAE;gBACL,OAAO,EAAE,2BAA2B;gBACpC,GAAG,EAAE,mBAAmB;gBACxB,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE;oBACF,UAAU,EAAE,UAAU;oBACtB,QAAQ,EAAE,4BAA4B;oBACtC,QAAQ,EAAE,4BAA4B;iBACzC;aACJ;SACJ,CAAC;IACN,CAAC;CAAA;AAnDD,gCAmDC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IExecuteFunctions, IHookFunctions, ILoadOptionsFunctions, IHttpRequestMethods, IDataObject } from "n8n-workflow";
|
|
2
|
+
/**
|
|
3
|
+
* Makes an authenticated request to the wacraft API.
|
|
4
|
+
*
|
|
5
|
+
* - Automatically obtains / refreshes tokens.
|
|
6
|
+
* - Sends X-Workspace-ID header (parameter override > credential default).
|
|
7
|
+
*/
|
|
8
|
+
export declare function wacraftApiRequest(this: IExecuteFunctions | IHookFunctions | ILoadOptionsFunctions, method: IHttpRequestMethods, endpoint: string, body?: IDataObject | IDataObject[] | undefined, qs?: IDataObject, overrideWorkspaceId?: string): Promise<any>;
|
|
9
|
+
/**
|
|
10
|
+
* Makes an authenticated multipart/form-data request (used for media upload).
|
|
11
|
+
*/
|
|
12
|
+
export declare function wacraftApiRequestMultipart(this: IExecuteFunctions, endpoint: string, formData: IDataObject, overrideWorkspaceId?: string): Promise<any>;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.wacraftApiRequestMultipart = exports.wacraftApiRequest = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const tokenCache = new Map();
|
|
6
|
+
/**
|
|
7
|
+
* Obtains (or refreshes) a bearer token and returns it.
|
|
8
|
+
*/
|
|
9
|
+
async function getAccessToken() {
|
|
10
|
+
const credentials = await this.getCredentials("wacraftApi");
|
|
11
|
+
const baseUrl = credentials.baseUrl;
|
|
12
|
+
const username = credentials.username;
|
|
13
|
+
const password = credentials.password;
|
|
14
|
+
const cacheKey = `${username}@${baseUrl}`;
|
|
15
|
+
const cached = tokenCache.get(cacheKey);
|
|
16
|
+
if (cached && cached.expiresAt > Date.now() + 30000) {
|
|
17
|
+
// still valid (with 30 s margin)
|
|
18
|
+
return cached.accessToken;
|
|
19
|
+
}
|
|
20
|
+
// Try refresh first, fall back to password grant
|
|
21
|
+
let body;
|
|
22
|
+
if (cached === null || cached === void 0 ? void 0 : cached.refreshToken) {
|
|
23
|
+
body = {
|
|
24
|
+
grant_type: "refresh_token",
|
|
25
|
+
refresh_token: cached.refreshToken,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
body = {
|
|
30
|
+
grant_type: "password",
|
|
31
|
+
username,
|
|
32
|
+
password,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
const options = {
|
|
36
|
+
method: "POST",
|
|
37
|
+
url: `${baseUrl}/user/oauth/token`,
|
|
38
|
+
body,
|
|
39
|
+
json: true,
|
|
40
|
+
};
|
|
41
|
+
let response;
|
|
42
|
+
try {
|
|
43
|
+
response = (await this.helpers.httpRequest(options));
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
// If refresh failed, retry with password
|
|
47
|
+
if (cached === null || cached === void 0 ? void 0 : cached.refreshToken) {
|
|
48
|
+
const retryOptions = {
|
|
49
|
+
method: "POST",
|
|
50
|
+
url: `${baseUrl}/user/oauth/token`,
|
|
51
|
+
body: {
|
|
52
|
+
grant_type: "password",
|
|
53
|
+
username,
|
|
54
|
+
password,
|
|
55
|
+
},
|
|
56
|
+
json: true,
|
|
57
|
+
};
|
|
58
|
+
response = (await this.helpers.httpRequest(retryOptions));
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
throw error;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const accessToken = response.access_token;
|
|
65
|
+
const refreshToken = response.refresh_token;
|
|
66
|
+
const expiresIn = response.expires_in || 3600;
|
|
67
|
+
tokenCache.set(cacheKey, {
|
|
68
|
+
accessToken,
|
|
69
|
+
refreshToken,
|
|
70
|
+
expiresAt: Date.now() + expiresIn * 1000,
|
|
71
|
+
});
|
|
72
|
+
return accessToken;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Makes an authenticated request to the wacraft API.
|
|
76
|
+
*
|
|
77
|
+
* - Automatically obtains / refreshes tokens.
|
|
78
|
+
* - Sends X-Workspace-ID header (parameter override > credential default).
|
|
79
|
+
*/
|
|
80
|
+
async function wacraftApiRequest(method, endpoint, body = undefined, qs = {}, overrideWorkspaceId) {
|
|
81
|
+
const credentials = await this.getCredentials("wacraftApi");
|
|
82
|
+
const baseUrl = credentials.baseUrl.replace(/\/+$/, "");
|
|
83
|
+
const workspaceId = overrideWorkspaceId || credentials.workspaceId;
|
|
84
|
+
const token = await getAccessToken.call(this);
|
|
85
|
+
const options = {
|
|
86
|
+
method,
|
|
87
|
+
url: `${baseUrl}${endpoint}`,
|
|
88
|
+
qs,
|
|
89
|
+
json: true,
|
|
90
|
+
headers: {
|
|
91
|
+
Authorization: `Bearer ${token}`,
|
|
92
|
+
...(workspaceId ? { "X-Workspace-ID": workspaceId } : {}),
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
if (body !== undefined) {
|
|
96
|
+
options.body = body;
|
|
97
|
+
}
|
|
98
|
+
try {
|
|
99
|
+
return await this.helpers.httpRequest(options);
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
exports.wacraftApiRequest = wacraftApiRequest;
|
|
106
|
+
/**
|
|
107
|
+
* Makes an authenticated multipart/form-data request (used for media upload).
|
|
108
|
+
*/
|
|
109
|
+
async function wacraftApiRequestMultipart(endpoint, formData, overrideWorkspaceId) {
|
|
110
|
+
const credentials = await this.getCredentials("wacraftApi");
|
|
111
|
+
const baseUrl = credentials.baseUrl.replace(/\/+$/, "");
|
|
112
|
+
const workspaceId = overrideWorkspaceId || credentials.workspaceId;
|
|
113
|
+
const token = await getAccessToken.call(this);
|
|
114
|
+
const options = {
|
|
115
|
+
method: "POST",
|
|
116
|
+
url: `${baseUrl}${endpoint}`,
|
|
117
|
+
headers: {
|
|
118
|
+
Authorization: `Bearer ${token}`,
|
|
119
|
+
...(workspaceId ? { "X-Workspace-ID": workspaceId } : {}),
|
|
120
|
+
},
|
|
121
|
+
body: formData,
|
|
122
|
+
};
|
|
123
|
+
try {
|
|
124
|
+
return await this.helpers.httpRequest(options);
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
exports.wacraftApiRequestMultipart = wacraftApiRequestMultipart;
|
|
131
|
+
//# sourceMappingURL=GenericFunctions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GenericFunctions.js","sourceRoot":"","sources":["../../../nodes/Wacraft/GenericFunctions.ts"],"names":[],"mappings":";;;AAAA,+CAQsB;AAYtB,MAAM,UAAU,GAAG,IAAI,GAAG,EAAsB,CAAC;AAEjD;;GAEG;AACH,KAAK,UAAU,cAAc;IAGzB,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;IAC5D,MAAM,OAAO,GAAG,WAAW,CAAC,OAAiB,CAAC;IAC9C,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAkB,CAAC;IAChD,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAkB,CAAC;IAChD,MAAM,QAAQ,GAAG,GAAG,QAAQ,IAAI,OAAO,EAAE,CAAC;IAE1C,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACxC,IAAI,MAAM,IAAI,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,KAAM,EAAE,CAAC;QACnD,iCAAiC;QACjC,OAAO,MAAM,CAAC,WAAW,CAAC;IAC9B,CAAC;IAED,iDAAiD;IACjD,IAAI,IAAiB,CAAC;IACtB,IAAI,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,YAA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