n8n-nodes-ycloud 0.2.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 +21 -0
- package/README.md +62 -0
- package/dist/credentials/YCloudApi.credentials.d.ts +22 -0
- package/dist/credentials/YCloudApi.credentials.js +48 -0
- package/dist/credentials/YCloudApi.credentials.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/nodes/YCloud/YCloud.node.d.ts +10 -0
- package/dist/nodes/YCloud/YCloud.node.js +427 -0
- package/dist/nodes/YCloud/YCloud.node.js.map +1 -0
- package/dist/nodes/YCloud/descriptions/inboundMessageDescription.d.ts +3 -0
- package/dist/nodes/YCloud/descriptions/inboundMessageDescription.js +62 -0
- package/dist/nodes/YCloud/descriptions/inboundMessageDescription.js.map +1 -0
- package/dist/nodes/YCloud/descriptions/messageDescription.d.ts +3 -0
- package/dist/nodes/YCloud/descriptions/messageDescription.js +381 -0
- package/dist/nodes/YCloud/descriptions/messageDescription.js.map +1 -0
- package/dist/nodes/YCloud/descriptions/templateDescription.d.ts +3 -0
- package/dist/nodes/YCloud/descriptions/templateDescription.js +164 -0
- package/dist/nodes/YCloud/descriptions/templateDescription.js.map +1 -0
- package/dist/nodes/YCloud/transport/request.d.ts +8 -0
- package/dist/nodes/YCloud/transport/request.js +66 -0
- package/dist/nodes/YCloud/transport/request.js.map +1 -0
- package/dist/nodes/YCloud/utils/errors.d.ts +24 -0
- package/dist/nodes/YCloud/utils/errors.js +114 -0
- package/dist/nodes/YCloud/utils/errors.js.map +1 -0
- package/dist/nodes/YCloud/utils/validators.d.ts +3 -0
- package/dist/nodes/YCloud/utils/validators.js +19 -0
- package/dist/nodes/YCloud/utils/validators.js.map +1 -0
- package/dist/nodes/YCloud/ycloud.svg +7 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# n8n-nodes-ycloud
|
|
2
|
+
|
|
3
|
+
Community node para integrar **YCloud WhatsApp API** en n8n.
|
|
4
|
+
|
|
5
|
+
## Compatibilidad
|
|
6
|
+
|
|
7
|
+
- n8n: `>= 1.0.0`
|
|
8
|
+
- Node.js: `>= 18.17`
|
|
9
|
+
|
|
10
|
+
## Estado actual
|
|
11
|
+
|
|
12
|
+
MVP implementado con operaciones:
|
|
13
|
+
|
|
14
|
+
- `message.sendDirectly`
|
|
15
|
+
- `message.enqueue`
|
|
16
|
+
- `message.retrieve`
|
|
17
|
+
- `inboundMessage.markAsRead`
|
|
18
|
+
- `inboundMessage.typingIndicator`
|
|
19
|
+
- `template.list`
|
|
20
|
+
- `template.retrieve`
|
|
21
|
+
|
|
22
|
+
Además, `message` ahora incluye:
|
|
23
|
+
|
|
24
|
+
- selección dinámica de templates desde YCloud (`Template Source: From YCloud`)
|
|
25
|
+
- validación opcional de cantidad de placeholders del body
|
|
26
|
+
- `Template Body Variables` para mapear `{{1}}`, `{{2}}`, ...
|
|
27
|
+
- `Template Components JSON (Advanced)` para payloads complejos (header/buttons/carousel, etc.)
|
|
28
|
+
- `contextMessageId` para replies (`context.message_id`)
|
|
29
|
+
- `filterUnsubscribed` y `filterBlocked` (solo en `enqueue`)
|
|
30
|
+
|
|
31
|
+
## Credenciales
|
|
32
|
+
|
|
33
|
+
El nodo incluye credencial `YCloud API` con:
|
|
34
|
+
|
|
35
|
+
- `baseUrl` (por defecto: `https://api.ycloud.com`)
|
|
36
|
+
- `apiKey` (usada en header `X-API-Key`)
|
|
37
|
+
|
|
38
|
+
El test de credencial consulta `GET /v2/balance`.
|
|
39
|
+
|
|
40
|
+
## Desarrollo local
|
|
41
|
+
|
|
42
|
+
1. Instala dependencias: `npm install`
|
|
43
|
+
2. Compila: `npm run build`
|
|
44
|
+
3. Verifica tipos: `npm run lint`
|
|
45
|
+
|
|
46
|
+
## Cargarlo en n8n local
|
|
47
|
+
|
|
48
|
+
1. Compila el paquete con `npm run build`.
|
|
49
|
+
2. Desde este proyecto ejecuta `npm link`.
|
|
50
|
+
3. En tu instalación local de n8n ejecuta `npm link n8n-nodes-ycloud`.
|
|
51
|
+
|
|
52
|
+
## Release y despliegue
|
|
53
|
+
|
|
54
|
+
Consulta `DEPLOY.md` para el checklist de publicación (`npm`) y despliegue en n8n self-hosted (incluido Hetzner).
|
|
55
|
+
4. Reinicia n8n y busca el nodo `YCloud` en el editor.
|
|
56
|
+
|
|
57
|
+
## Notas de implementación
|
|
58
|
+
|
|
59
|
+
- Validación E.164 para `from` y `to`.
|
|
60
|
+
- Manejo explícito de errores HTTP (401, 403, 404, 429, 5xx).
|
|
61
|
+
- Retries automáticos para `429` usando `Retry-After` o backoff exponencial con jitter.
|
|
62
|
+
- En `continueOnFail`, devuelve error estructurado por item.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class YCloudApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
documentationUrl: string;
|
|
6
|
+
properties: INodeProperties[];
|
|
7
|
+
authenticate: {
|
|
8
|
+
type: "generic";
|
|
9
|
+
properties: {
|
|
10
|
+
headers: {
|
|
11
|
+
'X-API-Key': string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
test: {
|
|
16
|
+
request: {
|
|
17
|
+
baseURL: string;
|
|
18
|
+
url: string;
|
|
19
|
+
method: "GET";
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.YCloudApi = void 0;
|
|
4
|
+
class YCloudApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'yCloudApi';
|
|
7
|
+
this.displayName = 'YCloud API';
|
|
8
|
+
this.documentationUrl = 'https://docs.ycloud.com/reference/overview';
|
|
9
|
+
this.properties = [
|
|
10
|
+
{
|
|
11
|
+
displayName: 'Base URL',
|
|
12
|
+
name: 'baseUrl',
|
|
13
|
+
type: 'string',
|
|
14
|
+
default: 'https://api.ycloud.com',
|
|
15
|
+
required: true,
|
|
16
|
+
description: 'Base URL for YCloud API',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
displayName: 'API Key',
|
|
20
|
+
name: 'apiKey',
|
|
21
|
+
type: 'string',
|
|
22
|
+
typeOptions: {
|
|
23
|
+
password: true,
|
|
24
|
+
},
|
|
25
|
+
default: '',
|
|
26
|
+
required: true,
|
|
27
|
+
description: 'YCloud API key used in X-API-Key header',
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
this.authenticate = {
|
|
31
|
+
type: 'generic',
|
|
32
|
+
properties: {
|
|
33
|
+
headers: {
|
|
34
|
+
'X-API-Key': '={{$credentials.apiKey}}',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
this.test = {
|
|
39
|
+
request: {
|
|
40
|
+
baseURL: '={{$credentials.baseUrl}}',
|
|
41
|
+
url: '/v2/balance',
|
|
42
|
+
method: 'GET',
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.YCloudApi = YCloudApi;
|
|
48
|
+
//# sourceMappingURL=YCloudApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"YCloudApi.credentials.js","sourceRoot":"","sources":["../../src/credentials/YCloudApi.credentials.ts"],"names":[],"mappings":";;;AAEA,MAAa,SAAS;IAAtB;QACE,SAAI,GAAG,WAAW,CAAC;QAEnB,gBAAW,GAAG,YAAY,CAAC;QAE3B,qBAAgB,GAAG,4CAA4C,CAAC;QAEhE,eAAU,GAAsB;YAC9B;gBACE,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,wBAAwB;gBACjC,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,yBAAyB;aACvC;YACD;gBACE,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE;oBACX,QAAQ,EAAE,IAAI;iBACf;gBACD,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,yCAAyC;aACvD;SACF,CAAC;QAEF,iBAAY,GAAG;YACb,IAAI,EAAE,SAAkB;YACxB,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,WAAW,EAAE,0BAA0B;iBACxC;aACF;SACF,CAAC;QAEF,SAAI,GAAG;YACL,OAAO,EAAE;gBACP,OAAO,EAAE,2BAA2B;gBACpC,GAAG,EAAE,aAAa;gBAClB,MAAM,EAAE,KAAc;aACvB;SACF,CAAC;IACJ,CAAC;CAAA;AA7CD,8BA6CC"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.nodes = exports.credentials = void 0;
|
|
4
|
+
const YCloudApi_credentials_1 = require("./credentials/YCloudApi.credentials");
|
|
5
|
+
const YCloud_node_1 = require("./nodes/YCloud/YCloud.node");
|
|
6
|
+
exports.credentials = [YCloudApi_credentials_1.YCloudApi];
|
|
7
|
+
exports.nodes = [YCloud_node_1.YCloud];
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,+EAAgE;AAChE,4DAAoD;AAEvC,QAAA,WAAW,GAAG,CAAC,iCAAS,CAAC,CAAC;AAC1B,QAAA,KAAK,GAAG,CAAC,oBAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IExecuteFunctions, ILoadOptionsFunctions, INodeExecutionData, INodePropertyOptions, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class YCloud implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
methods: {
|
|
5
|
+
loadOptions: {
|
|
6
|
+
getTemplateOptions(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.YCloud = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const messageDescription_1 = require("./descriptions/messageDescription");
|
|
6
|
+
const inboundMessageDescription_1 = require("./descriptions/inboundMessageDescription");
|
|
7
|
+
const templateDescription_1 = require("./descriptions/templateDescription");
|
|
8
|
+
const request_1 = require("./transport/request");
|
|
9
|
+
const errors_1 = require("./utils/errors");
|
|
10
|
+
const validators_1 = require("./utils/validators");
|
|
11
|
+
const TEMPLATE_REFERENCE_SEPARATOR = '::';
|
|
12
|
+
function encodeTemplateReference(selection) {
|
|
13
|
+
return [selection.wabaId, selection.name, selection.language]
|
|
14
|
+
.map((value) => encodeURIComponent(value))
|
|
15
|
+
.join(TEMPLATE_REFERENCE_SEPARATOR);
|
|
16
|
+
}
|
|
17
|
+
function decodeTemplateReference(reference) {
|
|
18
|
+
const [wabaIdEncoded, nameEncoded, languageEncoded] = reference.split(TEMPLATE_REFERENCE_SEPARATOR);
|
|
19
|
+
const wabaId = decodeURIComponent(wabaIdEncoded !== null && wabaIdEncoded !== void 0 ? wabaIdEncoded : '');
|
|
20
|
+
const name = decodeURIComponent(nameEncoded !== null && nameEncoded !== void 0 ? nameEncoded : '');
|
|
21
|
+
const language = decodeURIComponent(languageEncoded !== null && languageEncoded !== void 0 ? languageEncoded : '');
|
|
22
|
+
if (!wabaId || !name || !language) {
|
|
23
|
+
throw new Error('Invalid template reference selected. Please select a valid template from list.');
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
wabaId,
|
|
27
|
+
name,
|
|
28
|
+
language,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function asRecord(value) {
|
|
32
|
+
if (typeof value === 'object' && value !== null) {
|
|
33
|
+
return value;
|
|
34
|
+
}
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
function extractBodyPlaceholderCount(template) {
|
|
38
|
+
var _a, _b;
|
|
39
|
+
const root = asRecord(template);
|
|
40
|
+
const components = root === null || root === void 0 ? void 0 : root.components;
|
|
41
|
+
if (!Array.isArray(components)) {
|
|
42
|
+
return 0;
|
|
43
|
+
}
|
|
44
|
+
for (const component of components) {
|
|
45
|
+
const normalizedComponent = asRecord(component);
|
|
46
|
+
if (!normalizedComponent) {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
const type = String((_a = normalizedComponent.type) !== null && _a !== void 0 ? _a : '').toLowerCase();
|
|
50
|
+
if (type !== 'body') {
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
const text = String((_b = normalizedComponent.text) !== null && _b !== void 0 ? _b : '');
|
|
54
|
+
const regex = /\{\{(\d+)\}\}/g;
|
|
55
|
+
let maxIndex = 0;
|
|
56
|
+
for (const match of text.matchAll(regex)) {
|
|
57
|
+
const current = Number(match[1]);
|
|
58
|
+
if (Number.isFinite(current) && current > maxIndex) {
|
|
59
|
+
maxIndex = current;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return maxIndex;
|
|
63
|
+
}
|
|
64
|
+
return 0;
|
|
65
|
+
}
|
|
66
|
+
function buildTemplateBodyComponents(values) {
|
|
67
|
+
return [
|
|
68
|
+
{
|
|
69
|
+
type: 'body',
|
|
70
|
+
parameters: values.map((value) => ({
|
|
71
|
+
type: 'text',
|
|
72
|
+
text: value,
|
|
73
|
+
})),
|
|
74
|
+
},
|
|
75
|
+
];
|
|
76
|
+
}
|
|
77
|
+
async function resolveTemplatePayload(ctx, itemIndex) {
|
|
78
|
+
var _a, _b;
|
|
79
|
+
const templateSource = ctx.getNodeParameter('templateSource', itemIndex);
|
|
80
|
+
let templateName;
|
|
81
|
+
let templateLanguageCode;
|
|
82
|
+
let templateWabaId;
|
|
83
|
+
if (templateSource === 'ycloud') {
|
|
84
|
+
const templateReference = ctx.getNodeParameter('templateReference', itemIndex);
|
|
85
|
+
(0, validators_1.assertRequired)(templateReference, 'templateReference');
|
|
86
|
+
const parsed = decodeTemplateReference(templateReference);
|
|
87
|
+
templateName = parsed.name;
|
|
88
|
+
templateLanguageCode = parsed.language;
|
|
89
|
+
templateWabaId = parsed.wabaId;
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
templateName = ctx.getNodeParameter('templateName', itemIndex);
|
|
93
|
+
templateLanguageCode = ctx.getNodeParameter('templateLanguageCode', itemIndex);
|
|
94
|
+
(0, validators_1.assertRequired)(templateName, 'templateName');
|
|
95
|
+
(0, validators_1.assertRequired)(templateLanguageCode, 'templateLanguageCode');
|
|
96
|
+
}
|
|
97
|
+
const templateLanguagePolicy = ctx.getNodeParameter('templateLanguagePolicy', itemIndex);
|
|
98
|
+
const rawTemplateComponentsJson = (_a = ctx.getNodeParameter('templateComponentsJson', itemIndex)) !== null && _a !== void 0 ? _a : '';
|
|
99
|
+
let templateComponents;
|
|
100
|
+
if (rawTemplateComponentsJson.trim().length > 0) {
|
|
101
|
+
let parsed;
|
|
102
|
+
try {
|
|
103
|
+
parsed = JSON.parse(rawTemplateComponentsJson);
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
throw new Error('Template Components JSON (Advanced) is not valid JSON.');
|
|
107
|
+
}
|
|
108
|
+
if (!Array.isArray(parsed)) {
|
|
109
|
+
throw new Error('Template Components JSON (Advanced) must be a JSON array.');
|
|
110
|
+
}
|
|
111
|
+
templateComponents = parsed;
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
const rawBodyVariables = (_b = ctx.getNodeParameter('templateBodyVariables.values', itemIndex, [])) !== null && _b !== void 0 ? _b : [];
|
|
115
|
+
const bodyVariableValues = rawBodyVariables
|
|
116
|
+
.map((item) => { var _a; return String((_a = item.value) !== null && _a !== void 0 ? _a : '').trim(); })
|
|
117
|
+
.filter((value) => value.length > 0);
|
|
118
|
+
if (bodyVariableValues.length > 0) {
|
|
119
|
+
templateComponents = buildTemplateBodyComponents(bodyVariableValues);
|
|
120
|
+
}
|
|
121
|
+
const shouldValidatePlaceholderCount = ctx.getNodeParameter('templateValidatePlaceholderCount', itemIndex, false);
|
|
122
|
+
if (shouldValidatePlaceholderCount && templateSource === 'ycloud' && templateWabaId) {
|
|
123
|
+
const remoteTemplate = await request_1.makeYCloudRequest.call(ctx, itemIndex, {
|
|
124
|
+
method: 'GET',
|
|
125
|
+
endpoint: `/v2/whatsapp/templates/${encodeURIComponent(templateWabaId)}/${encodeURIComponent(templateName)}/${encodeURIComponent(templateLanguageCode)}`,
|
|
126
|
+
});
|
|
127
|
+
const expectedBodyPlaceholderCount = extractBodyPlaceholderCount(remoteTemplate);
|
|
128
|
+
if (expectedBodyPlaceholderCount !== bodyVariableValues.length) {
|
|
129
|
+
throw new Error(`Template body placeholders mismatch. Expected ${expectedBodyPlaceholderCount}, received ${bodyVariableValues.length}.`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
name: templateName,
|
|
135
|
+
language: templateLanguageCode,
|
|
136
|
+
policy: templateLanguagePolicy,
|
|
137
|
+
wabaId: templateWabaId,
|
|
138
|
+
components: templateComponents,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
async function sendMessage(ctx, itemIndex, endpoint) {
|
|
142
|
+
const from = ctx.getNodeParameter('from', itemIndex);
|
|
143
|
+
const to = ctx.getNodeParameter('to', itemIndex);
|
|
144
|
+
const externalId = ctx.getNodeParameter('externalId', itemIndex);
|
|
145
|
+
const contextMessageId = ctx.getNodeParameter('contextMessageId', itemIndex);
|
|
146
|
+
const messageType = ctx.getNodeParameter('messageType', itemIndex);
|
|
147
|
+
(0, validators_1.assertRequired)(from, 'from');
|
|
148
|
+
(0, validators_1.assertRequired)(to, 'to');
|
|
149
|
+
(0, validators_1.assertE164)(from, 'from');
|
|
150
|
+
(0, validators_1.assertE164)(to, 'to');
|
|
151
|
+
const body = {
|
|
152
|
+
from,
|
|
153
|
+
to,
|
|
154
|
+
type: messageType,
|
|
155
|
+
};
|
|
156
|
+
if (externalId === null || externalId === void 0 ? void 0 : externalId.trim()) {
|
|
157
|
+
body.externalId = externalId.trim();
|
|
158
|
+
}
|
|
159
|
+
if (contextMessageId === null || contextMessageId === void 0 ? void 0 : contextMessageId.trim()) {
|
|
160
|
+
body.context = {
|
|
161
|
+
message_id: contextMessageId.trim(),
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
if (endpoint === '/v2/whatsapp/messages') {
|
|
165
|
+
const filterUnsubscribed = ctx.getNodeParameter('filterUnsubscribed', itemIndex);
|
|
166
|
+
const filterBlocked = ctx.getNodeParameter('filterBlocked', itemIndex);
|
|
167
|
+
if (filterUnsubscribed) {
|
|
168
|
+
body.filterUnsubscribed = true;
|
|
169
|
+
}
|
|
170
|
+
if (filterBlocked) {
|
|
171
|
+
body.filterBlocked = true;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
if (messageType === 'text') {
|
|
175
|
+
const textBody = ctx.getNodeParameter('textBody', itemIndex);
|
|
176
|
+
const textPreviewUrl = ctx.getNodeParameter('textPreviewUrl', itemIndex);
|
|
177
|
+
(0, validators_1.assertRequired)(textBody, 'textBody');
|
|
178
|
+
body.text = {
|
|
179
|
+
body: textBody,
|
|
180
|
+
preview_url: textPreviewUrl,
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
if (messageType === 'image') {
|
|
184
|
+
const imageUrl = ctx.getNodeParameter('imageUrl', itemIndex);
|
|
185
|
+
(0, validators_1.assertRequired)(imageUrl, 'imageUrl');
|
|
186
|
+
body.image = { link: imageUrl };
|
|
187
|
+
}
|
|
188
|
+
if (messageType === 'template') {
|
|
189
|
+
const templatePayload = await resolveTemplatePayload(ctx, itemIndex);
|
|
190
|
+
const templateData = {
|
|
191
|
+
name: templatePayload.name,
|
|
192
|
+
language: {
|
|
193
|
+
code: templatePayload.language,
|
|
194
|
+
policy: templatePayload.policy,
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
if (templatePayload.components && templatePayload.components.length > 0) {
|
|
198
|
+
templateData.components = templatePayload.components;
|
|
199
|
+
}
|
|
200
|
+
body.template = templateData;
|
|
201
|
+
}
|
|
202
|
+
return request_1.makeYCloudRequest.call(ctx, itemIndex, {
|
|
203
|
+
method: 'POST',
|
|
204
|
+
endpoint,
|
|
205
|
+
body,
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
async function executeSingle(ctx, itemIndex) {
|
|
209
|
+
const resource = ctx.getNodeParameter('resource', itemIndex);
|
|
210
|
+
const operation = ctx.getNodeParameter('operation', itemIndex);
|
|
211
|
+
if (resource === 'message') {
|
|
212
|
+
if (operation === 'sendDirectly') {
|
|
213
|
+
return sendMessage(ctx, itemIndex, '/v2/whatsapp/messages/sendDirectly');
|
|
214
|
+
}
|
|
215
|
+
if (operation === 'enqueue') {
|
|
216
|
+
return sendMessage(ctx, itemIndex, '/v2/whatsapp/messages');
|
|
217
|
+
}
|
|
218
|
+
if (operation === 'retrieve') {
|
|
219
|
+
const messageId = ctx.getNodeParameter('messageId', itemIndex);
|
|
220
|
+
(0, validators_1.assertRequired)(messageId, 'messageId');
|
|
221
|
+
return request_1.makeYCloudRequest.call(ctx, itemIndex, {
|
|
222
|
+
method: 'GET',
|
|
223
|
+
endpoint: `/v2/whatsapp/messages/${encodeURIComponent(messageId)}`,
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
if (resource === 'template') {
|
|
228
|
+
if (operation === 'list') {
|
|
229
|
+
const page = ctx.getNodeParameter('templateListPage', itemIndex);
|
|
230
|
+
const limit = ctx.getNodeParameter('templateListLimit', itemIndex);
|
|
231
|
+
const includeTotal = ctx.getNodeParameter('templateListIncludeTotal', itemIndex);
|
|
232
|
+
const filterWabaId = ctx.getNodeParameter('templateListFilterWabaId', itemIndex);
|
|
233
|
+
const filterName = ctx.getNodeParameter('templateListFilterName', itemIndex);
|
|
234
|
+
const filterLanguage = ctx.getNodeParameter('templateListFilterLanguage', itemIndex);
|
|
235
|
+
const qs = {
|
|
236
|
+
page,
|
|
237
|
+
limit,
|
|
238
|
+
};
|
|
239
|
+
if (includeTotal) {
|
|
240
|
+
qs.includeTotal = true;
|
|
241
|
+
}
|
|
242
|
+
if (filterWabaId === null || filterWabaId === void 0 ? void 0 : filterWabaId.trim()) {
|
|
243
|
+
qs['filter.wabaId'] = filterWabaId.trim();
|
|
244
|
+
}
|
|
245
|
+
if (filterName === null || filterName === void 0 ? void 0 : filterName.trim()) {
|
|
246
|
+
qs['filter.name'] = filterName.trim();
|
|
247
|
+
}
|
|
248
|
+
if (filterLanguage === null || filterLanguage === void 0 ? void 0 : filterLanguage.trim()) {
|
|
249
|
+
qs['filter.language'] = filterLanguage.trim();
|
|
250
|
+
}
|
|
251
|
+
return request_1.makeYCloudRequest.call(ctx, itemIndex, {
|
|
252
|
+
method: 'GET',
|
|
253
|
+
endpoint: '/v2/whatsapp/templates',
|
|
254
|
+
qs,
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
if (operation === 'retrieve') {
|
|
258
|
+
const wabaId = ctx.getNodeParameter('templateGetWabaId', itemIndex);
|
|
259
|
+
const name = ctx.getNodeParameter('templateGetName', itemIndex);
|
|
260
|
+
const language = ctx.getNodeParameter('templateGetLanguage', itemIndex);
|
|
261
|
+
(0, validators_1.assertRequired)(wabaId, 'templateGetWabaId');
|
|
262
|
+
(0, validators_1.assertRequired)(name, 'templateGetName');
|
|
263
|
+
(0, validators_1.assertRequired)(language, 'templateGetLanguage');
|
|
264
|
+
return request_1.makeYCloudRequest.call(ctx, itemIndex, {
|
|
265
|
+
method: 'GET',
|
|
266
|
+
endpoint: `/v2/whatsapp/templates/${encodeURIComponent(wabaId)}/${encodeURIComponent(name)}/${encodeURIComponent(language)}`,
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
if (resource === 'inboundMessage') {
|
|
271
|
+
const wamid = ctx.getNodeParameter('wamid', itemIndex);
|
|
272
|
+
(0, validators_1.assertRequired)(wamid, 'wamid');
|
|
273
|
+
if (operation === 'markAsRead') {
|
|
274
|
+
return request_1.makeYCloudRequest.call(ctx, itemIndex, {
|
|
275
|
+
method: 'POST',
|
|
276
|
+
endpoint: `/v2/whatsapp/inboundMessages/${encodeURIComponent(wamid)}/markAsRead`,
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
if (operation === 'typingIndicator') {
|
|
280
|
+
const from = ctx.getNodeParameter('from', itemIndex);
|
|
281
|
+
(0, validators_1.assertRequired)(from, 'from');
|
|
282
|
+
(0, validators_1.assertE164)(from, 'from');
|
|
283
|
+
return request_1.makeYCloudRequest.call(ctx, itemIndex, {
|
|
284
|
+
method: 'POST',
|
|
285
|
+
endpoint: `/v2/whatsapp/inboundMessages/${encodeURIComponent(wamid)}/typingIndicator`,
|
|
286
|
+
body: { from },
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), `Unsupported operation: ${resource}.${operation}`, {
|
|
291
|
+
itemIndex,
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
class YCloud {
|
|
295
|
+
constructor() {
|
|
296
|
+
this.description = {
|
|
297
|
+
displayName: 'YCloud',
|
|
298
|
+
name: 'ycloud',
|
|
299
|
+
icon: 'file:ycloud.svg',
|
|
300
|
+
group: ['transform'],
|
|
301
|
+
version: 1,
|
|
302
|
+
subtitle: '={{$parameter["resource"] + ": " + $parameter["operation"]}}',
|
|
303
|
+
description: 'YCloud WhatsApp API integration',
|
|
304
|
+
defaults: {
|
|
305
|
+
name: 'YCloud',
|
|
306
|
+
},
|
|
307
|
+
inputs: ['main'],
|
|
308
|
+
outputs: ['main'],
|
|
309
|
+
credentials: [
|
|
310
|
+
{
|
|
311
|
+
name: 'yCloudApi',
|
|
312
|
+
required: true,
|
|
313
|
+
},
|
|
314
|
+
],
|
|
315
|
+
properties: [
|
|
316
|
+
{
|
|
317
|
+
displayName: 'Resource',
|
|
318
|
+
name: 'resource',
|
|
319
|
+
type: 'options',
|
|
320
|
+
noDataExpression: true,
|
|
321
|
+
options: [
|
|
322
|
+
{
|
|
323
|
+
name: 'Message',
|
|
324
|
+
value: 'message',
|
|
325
|
+
description: 'Send and retrieve WhatsApp messages',
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
name: 'Inbound Message',
|
|
329
|
+
value: 'inboundMessage',
|
|
330
|
+
description: 'Inbound message actions',
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
name: 'Template',
|
|
334
|
+
value: 'template',
|
|
335
|
+
description: 'List and retrieve WhatsApp templates',
|
|
336
|
+
},
|
|
337
|
+
],
|
|
338
|
+
default: 'message',
|
|
339
|
+
},
|
|
340
|
+
...messageDescription_1.messageOperations,
|
|
341
|
+
...messageDescription_1.messageFields,
|
|
342
|
+
...inboundMessageDescription_1.inboundMessageOperations,
|
|
343
|
+
...inboundMessageDescription_1.inboundMessageFields,
|
|
344
|
+
...templateDescription_1.templateOperations,
|
|
345
|
+
...templateDescription_1.templateFields,
|
|
346
|
+
],
|
|
347
|
+
};
|
|
348
|
+
this.methods = {
|
|
349
|
+
loadOptions: {
|
|
350
|
+
async getTemplateOptions() {
|
|
351
|
+
var _a, _b;
|
|
352
|
+
const credentials = await this.getCredentials('yCloudApi');
|
|
353
|
+
const baseUrlRaw = (_a = credentials.baseUrl) !== null && _a !== void 0 ? _a : 'https://api.ycloud.com';
|
|
354
|
+
const baseUrl = baseUrlRaw.replace(/\/+$/, '');
|
|
355
|
+
const templateWabaIdRaw = (_b = this.getCurrentNodeParameter('templateWabaId')) !== null && _b !== void 0 ? _b : '';
|
|
356
|
+
const qs = {
|
|
357
|
+
page: 1,
|
|
358
|
+
limit: 100,
|
|
359
|
+
};
|
|
360
|
+
if (templateWabaIdRaw.trim()) {
|
|
361
|
+
qs['filter.wabaId'] = templateWabaIdRaw.trim();
|
|
362
|
+
}
|
|
363
|
+
const response = (await this.helpers.httpRequestWithAuthentication.call(this, 'yCloudApi', {
|
|
364
|
+
method: 'GET',
|
|
365
|
+
url: `${baseUrl}/v2/whatsapp/templates`,
|
|
366
|
+
qs,
|
|
367
|
+
json: true,
|
|
368
|
+
}));
|
|
369
|
+
const items = Array.isArray(response.items) ? response.items : [];
|
|
370
|
+
return items
|
|
371
|
+
.map((item) => {
|
|
372
|
+
var _a, _b, _c, _d;
|
|
373
|
+
const wabaId = String((_a = item.wabaId) !== null && _a !== void 0 ? _a : '').trim();
|
|
374
|
+
const name = String((_b = item.name) !== null && _b !== void 0 ? _b : '').trim();
|
|
375
|
+
const language = String((_c = item.language) !== null && _c !== void 0 ? _c : '').trim();
|
|
376
|
+
const status = String((_d = item.status) !== null && _d !== void 0 ? _d : '').trim();
|
|
377
|
+
if (!wabaId || !name || !language) {
|
|
378
|
+
return undefined;
|
|
379
|
+
}
|
|
380
|
+
const optionName = status ? `${name} (${language}) - ${status}` : `${name} (${language})`;
|
|
381
|
+
return {
|
|
382
|
+
name: optionName,
|
|
383
|
+
value: encodeTemplateReference({
|
|
384
|
+
wabaId,
|
|
385
|
+
name,
|
|
386
|
+
language,
|
|
387
|
+
}),
|
|
388
|
+
description: `WABA: ${wabaId}`,
|
|
389
|
+
};
|
|
390
|
+
})
|
|
391
|
+
.filter((option) => option !== undefined);
|
|
392
|
+
},
|
|
393
|
+
},
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
async execute() {
|
|
397
|
+
const items = this.getInputData();
|
|
398
|
+
const returnData = [];
|
|
399
|
+
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
|
|
400
|
+
try {
|
|
401
|
+
const json = await executeSingle(this, itemIndex);
|
|
402
|
+
returnData.push({ json });
|
|
403
|
+
}
|
|
404
|
+
catch (error) {
|
|
405
|
+
const normalized = error instanceof errors_1.YCloudApiError ? error.normalized : (0, errors_1.normalizeYCloudError)(error);
|
|
406
|
+
if (this.continueOnFail()) {
|
|
407
|
+
returnData.push({
|
|
408
|
+
json: {
|
|
409
|
+
success: false,
|
|
410
|
+
error: normalized.userMessage,
|
|
411
|
+
details: normalized,
|
|
412
|
+
itemIndex,
|
|
413
|
+
},
|
|
414
|
+
});
|
|
415
|
+
continue;
|
|
416
|
+
}
|
|
417
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), normalized.userMessage, {
|
|
418
|
+
itemIndex,
|
|
419
|
+
description: normalized.rawMessage,
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
return [returnData];
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
exports.YCloud = YCloud;
|
|
427
|
+
//# sourceMappingURL=YCloud.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"YCloud.node.js","sourceRoot":"","sources":["../../../src/nodes/YCloud/YCloud.node.ts"],"names":[],"mappings":";;;AASA,+CAAkD;AAClD,0EAAqF;AACrF,wFAGkD;AAClD,4EAAwF;AACxF,iDAAwD;AACxD,2CAAsE;AACtE,mDAAgE;AAWhE,MAAM,4BAA4B,GAAG,IAAI,CAAC;AAE1C,SAAS,uBAAuB,CAAC,SAA4B;IAC3D,OAAO,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,QAAQ,CAAC;SAC1D,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;SACzC,IAAI,CAAC,4BAA4B,CAAC,CAAC;AACxC,CAAC;AAED,SAAS,uBAAuB,CAAC,SAAiB;IAChD,MAAM,CAAC,aAAa,EAAE,WAAW,EAAE,eAAe,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAEpG,MAAM,MAAM,GAAG,kBAAkB,CAAC,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,EAAE,CAAC,CAAC;IACvD,MAAM,IAAI,GAA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