@growsalesai/n8n-nodes-ycloud 0.1.8 → 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/dist/nodes/YCloud/YCloud.node.d.ts +8 -3
- package/dist/nodes/YCloud/YCloud.node.js +62 -2093
- package/dist/nodes/YCloud/YCloud.node.js.map +1 -1
- package/dist/nodes/YCloud/actions/balance.action.d.ts +2 -0
- package/dist/nodes/YCloud/actions/balance.action.js +8 -0
- package/dist/nodes/YCloud/actions/balance.action.js.map +1 -0
- package/dist/nodes/YCloud/actions/contact.action.d.ts +2 -0
- package/dist/nodes/YCloud/actions/contact.action.js +68 -0
- package/dist/nodes/YCloud/actions/contact.action.js.map +1 -0
- package/dist/nodes/YCloud/actions/customEvent.action.d.ts +2 -0
- package/dist/nodes/YCloud/actions/customEvent.action.js +65 -0
- package/dist/nodes/YCloud/actions/customEvent.action.js.map +1 -0
- package/dist/nodes/YCloud/actions/email.action.d.ts +2 -0
- package/dist/nodes/YCloud/actions/email.action.js +28 -0
- package/dist/nodes/YCloud/actions/email.action.js.map +1 -0
- package/dist/nodes/YCloud/actions/index.d.ts +17 -0
- package/dist/nodes/YCloud/actions/index.js +54 -0
- package/dist/nodes/YCloud/actions/index.js.map +1 -0
- package/dist/nodes/YCloud/actions/sms.action.d.ts +2 -0
- package/dist/nodes/YCloud/actions/sms.action.js +42 -0
- package/dist/nodes/YCloud/actions/sms.action.js.map +1 -0
- package/dist/nodes/YCloud/actions/unsubscriber.action.d.ts +2 -0
- package/dist/nodes/YCloud/actions/unsubscriber.action.js +38 -0
- package/dist/nodes/YCloud/actions/unsubscriber.action.js.map +1 -0
- package/dist/nodes/YCloud/actions/verification.action.d.ts +2 -0
- package/dist/nodes/YCloud/actions/verification.action.js +34 -0
- package/dist/nodes/YCloud/actions/verification.action.js.map +1 -0
- package/dist/nodes/YCloud/actions/voice.action.d.ts +2 -0
- package/dist/nodes/YCloud/actions/voice.action.js +31 -0
- package/dist/nodes/YCloud/actions/voice.action.js.map +1 -0
- package/dist/nodes/YCloud/actions/webhookEndpoint.action.d.ts +2 -0
- package/dist/nodes/YCloud/actions/webhookEndpoint.action.js +53 -0
- package/dist/nodes/YCloud/actions/webhookEndpoint.action.js.map +1 -0
- package/dist/nodes/YCloud/actions/whatsappBusinessAccount.action.d.ts +2 -0
- package/dist/nodes/YCloud/actions/whatsappBusinessAccount.action.js +22 -0
- package/dist/nodes/YCloud/actions/whatsappBusinessAccount.action.js.map +1 -0
- package/dist/nodes/YCloud/actions/whatsappCalling.action.d.ts +2 -0
- package/dist/nodes/YCloud/actions/whatsappCalling.action.js +37 -0
- package/dist/nodes/YCloud/actions/whatsappCalling.action.js.map +1 -0
- package/dist/nodes/YCloud/actions/whatsappFlow.action.d.ts +2 -0
- package/dist/nodes/YCloud/actions/whatsappFlow.action.js +61 -0
- package/dist/nodes/YCloud/actions/whatsappFlow.action.js.map +1 -0
- package/dist/nodes/YCloud/actions/whatsappInboundMessage.action.d.ts +2 -0
- package/dist/nodes/YCloud/actions/whatsappInboundMessage.action.js +16 -0
- package/dist/nodes/YCloud/actions/whatsappInboundMessage.action.js.map +1 -0
- package/dist/nodes/YCloud/actions/whatsappMedia.action.d.ts +2 -0
- package/dist/nodes/YCloud/actions/whatsappMedia.action.js +33 -0
- package/dist/nodes/YCloud/actions/whatsappMedia.action.js.map +1 -0
- package/dist/nodes/YCloud/actions/whatsappMessage.action.d.ts +2 -0
- package/dist/nodes/YCloud/actions/whatsappMessage.action.js +114 -0
- package/dist/nodes/YCloud/actions/whatsappMessage.action.js.map +1 -0
- package/dist/nodes/YCloud/actions/whatsappPhoneNumber.action.d.ts +2 -0
- package/dist/nodes/YCloud/actions/whatsappPhoneNumber.action.js +73 -0
- package/dist/nodes/YCloud/actions/whatsappPhoneNumber.action.js.map +1 -0
- package/dist/nodes/YCloud/actions/whatsappTemplate.action.d.ts +2 -0
- package/dist/nodes/YCloud/actions/whatsappTemplate.action.js +60 -0
- package/dist/nodes/YCloud/actions/whatsappTemplate.action.js.map +1 -0
- package/dist/nodes/YCloud/descriptions/balance.description.d.ts +2 -0
- package/dist/nodes/YCloud/descriptions/balance.description.js +15 -0
- package/dist/nodes/YCloud/descriptions/balance.description.js.map +1 -0
- package/dist/nodes/YCloud/descriptions/contact.description.d.ts +2 -0
- package/dist/nodes/YCloud/descriptions/contact.description.js +75 -0
- package/dist/nodes/YCloud/descriptions/contact.description.js.map +1 -0
- package/dist/nodes/YCloud/descriptions/customEvent.description.d.ts +2 -0
- package/dist/nodes/YCloud/descriptions/customEvent.description.js +93 -0
- package/dist/nodes/YCloud/descriptions/customEvent.description.js.map +1 -0
- package/dist/nodes/YCloud/descriptions/email.description.d.ts +2 -0
- package/dist/nodes/YCloud/descriptions/email.description.js +68 -0
- package/dist/nodes/YCloud/descriptions/email.description.js.map +1 -0
- package/dist/nodes/YCloud/descriptions/index.d.ts +2 -0
- package/dist/nodes/YCloud/descriptions/index.js +67 -0
- package/dist/nodes/YCloud/descriptions/index.js.map +1 -0
- package/dist/nodes/YCloud/descriptions/shared.d.ts +3 -0
- package/dist/nodes/YCloud/descriptions/shared.js +19 -0
- package/dist/nodes/YCloud/descriptions/shared.js.map +1 -0
- package/dist/nodes/YCloud/descriptions/sms.description.d.ts +2 -0
- package/dist/nodes/YCloud/descriptions/sms.description.js +67 -0
- package/dist/nodes/YCloud/descriptions/sms.description.js.map +1 -0
- package/dist/nodes/YCloud/descriptions/unsubscriber.description.d.ts +2 -0
- package/dist/nodes/YCloud/descriptions/unsubscriber.description.js +56 -0
- package/dist/nodes/YCloud/descriptions/unsubscriber.description.js.map +1 -0
- package/dist/nodes/YCloud/descriptions/verification.description.d.ts +2 -0
- package/dist/nodes/YCloud/descriptions/verification.description.js +77 -0
- package/dist/nodes/YCloud/descriptions/verification.description.js.map +1 -0
- package/dist/nodes/YCloud/descriptions/voice.description.d.ts +2 -0
- package/dist/nodes/YCloud/descriptions/voice.description.js +54 -0
- package/dist/nodes/YCloud/descriptions/voice.description.js.map +1 -0
- package/dist/nodes/YCloud/descriptions/webhookEndpoint.description.d.ts +2 -0
- package/dist/nodes/YCloud/descriptions/webhookEndpoint.description.js +91 -0
- package/dist/nodes/YCloud/descriptions/webhookEndpoint.description.js.map +1 -0
- package/dist/nodes/YCloud/descriptions/whatsappBusinessAccount.description.d.ts +2 -0
- package/dist/nodes/YCloud/descriptions/whatsappBusinessAccount.description.js +30 -0
- package/dist/nodes/YCloud/descriptions/whatsappBusinessAccount.description.js.map +1 -0
- package/dist/nodes/YCloud/descriptions/whatsappCalling.description.d.ts +2 -0
- package/dist/nodes/YCloud/descriptions/whatsappCalling.description.js +69 -0
- package/dist/nodes/YCloud/descriptions/whatsappCalling.description.js.map +1 -0
- package/dist/nodes/YCloud/descriptions/whatsappFlow.description.d.ts +2 -0
- package/dist/nodes/YCloud/descriptions/whatsappFlow.description.js +94 -0
- package/dist/nodes/YCloud/descriptions/whatsappFlow.description.js.map +1 -0
- package/dist/nodes/YCloud/descriptions/whatsappInboundMessage.description.d.ts +2 -0
- package/dist/nodes/YCloud/descriptions/whatsappInboundMessage.description.js +28 -0
- package/dist/nodes/YCloud/descriptions/whatsappInboundMessage.description.js.map +1 -0
- package/dist/nodes/YCloud/descriptions/whatsappMedia.description.d.ts +2 -0
- package/dist/nodes/YCloud/descriptions/whatsappMedia.description.js +34 -0
- package/dist/nodes/YCloud/descriptions/whatsappMedia.description.js.map +1 -0
- package/dist/nodes/YCloud/descriptions/whatsappMessage.description.d.ts +2 -0
- package/dist/nodes/YCloud/descriptions/whatsappMessage.description.js +240 -0
- package/dist/nodes/YCloud/descriptions/whatsappMessage.description.js.map +1 -0
- package/dist/nodes/YCloud/descriptions/whatsappPhoneNumber.description.d.ts +2 -0
- package/dist/nodes/YCloud/descriptions/whatsappPhoneNumber.description.js +92 -0
- package/dist/nodes/YCloud/descriptions/whatsappPhoneNumber.description.js.map +1 -0
- package/dist/nodes/YCloud/descriptions/whatsappTemplate.description.d.ts +2 -0
- package/dist/nodes/YCloud/descriptions/whatsappTemplate.description.js +87 -0
- package/dist/nodes/YCloud/descriptions/whatsappTemplate.description.js.map +1 -0
- package/dist/nodes/YCloud/methods/index.d.ts +13 -0
- package/dist/nodes/YCloud/methods/index.js +50 -0
- package/dist/nodes/YCloud/methods/index.js.map +1 -0
- package/dist/nodes/YCloud/methods/listSearch.d.ts +4 -0
- package/dist/nodes/YCloud/methods/listSearch.js +63 -0
- package/dist/nodes/YCloud/methods/listSearch.js.map +1 -0
- package/dist/nodes/YCloud/methods/loadOptions.d.ts +3 -0
- package/dist/nodes/YCloud/methods/loadOptions.js +74 -0
- package/dist/nodes/YCloud/methods/loadOptions.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.execute = execute;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const GenericFunctions_1 = require("../GenericFunctions");
|
|
6
|
+
async function execute(i, operation) {
|
|
7
|
+
if (operation === 'send') {
|
|
8
|
+
const channel = this.getNodeParameter('verificationChannel', i);
|
|
9
|
+
const to = this.getNodeParameter('verificationTo', i);
|
|
10
|
+
const af = this.getNodeParameter('additionalFields', i);
|
|
11
|
+
const body = { channel, to };
|
|
12
|
+
if (af.code)
|
|
13
|
+
body.code = af.code;
|
|
14
|
+
if (af.language)
|
|
15
|
+
body.language = af.language;
|
|
16
|
+
if (af.senderId)
|
|
17
|
+
body.senderId = af.senderId;
|
|
18
|
+
if (af.signature)
|
|
19
|
+
body.signature = af.signature;
|
|
20
|
+
return GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/verify/verifications', body);
|
|
21
|
+
}
|
|
22
|
+
if (operation === 'check') {
|
|
23
|
+
const code = this.getNodeParameter('verificationCode', i);
|
|
24
|
+
const identification = this.getNodeParameter('verificationIdentification', i);
|
|
25
|
+
const body = { code };
|
|
26
|
+
if (identification.verificationId)
|
|
27
|
+
body.verificationId = identification.verificationId;
|
|
28
|
+
if (identification.to)
|
|
29
|
+
body.to = identification.to;
|
|
30
|
+
return GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/verify/verificationChecks', body);
|
|
31
|
+
}
|
|
32
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=verification.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verification.action.js","sourceRoot":"","sources":["../../../../nodes/YCloud/actions/verification.action.ts"],"names":[],"mappings":";;AAIA,0BAuBC;AA1BD,+CAAkD;AAClD,0DAAuD;AAEhD,KAAK,UAAU,OAAO,CAA0B,CAAS,EAAE,SAAiB;IACjF,IAAI,SAAS,KAAK,MAAM,EAAE,CAAC;QACzB,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,qBAAqB,EAAE,CAAC,CAAW,CAAC;QAC1E,MAAM,EAAE,GAAG,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,EAAE,CAAC,CAAW,CAAC;QAChE,MAAM,EAAE,GAAG,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,CAAC,CAAgB,CAAC;QACvE,MAAM,IAAI,GAAgB,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;QAC1C,IAAI,EAAE,CAAC,IAAI;YAAE,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC;QACjC,IAAI,EAAE,CAAC,QAAQ;YAAE,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC,QAAQ,CAAC;QAC7C,IAAI,EAAE,CAAC,QAAQ;YAAE,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC,QAAQ,CAAC;QAC7C,IAAI,EAAE,CAAC,SAAS;YAAE,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC,SAAS,CAAC;QAChD,OAAO,mCAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,uBAAuB,EAAE,IAAI,CAAC,CAAC;IAC5E,CAAC;IAED,IAAI,SAAS,KAAK,OAAO,EAAE,CAAC;QAC1B,MAAM,IAAI,GAAG,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,CAAC,CAAW,CAAC;QACpE,MAAM,cAAc,GAAG,IAAI,CAAC,gBAAgB,CAAC,4BAA4B,EAAE,CAAC,CAAgB,CAAC;QAC7F,MAAM,IAAI,GAAgB,EAAE,IAAI,EAAE,CAAC;QACnC,IAAI,cAAc,CAAC,cAAc;YAAE,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC,cAAc,CAAC;QACvF,IAAI,cAAc,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE,GAAG,cAAc,CAAC,EAAE,CAAC;QACnD,OAAO,mCAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,4BAA4B,EAAE,IAAI,CAAC,CAAC;IACjF,CAAC;IAED,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,sBAAsB,SAAS,EAAE,CAAC,CAAC;AAClF,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.execute = execute;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const GenericFunctions_1 = require("../GenericFunctions");
|
|
6
|
+
async function execute(i, operation) {
|
|
7
|
+
if (operation === 'send') {
|
|
8
|
+
const to = this.getNodeParameter('voiceTo', i);
|
|
9
|
+
const verificationCode = this.getNodeParameter('voiceCode', i);
|
|
10
|
+
const af = this.getNodeParameter('additionalFields', i);
|
|
11
|
+
const body = { to, verificationCode };
|
|
12
|
+
if (af.language)
|
|
13
|
+
body.language = af.language;
|
|
14
|
+
if (af.externalId)
|
|
15
|
+
body.externalId = af.externalId;
|
|
16
|
+
if (af.callbackUrl)
|
|
17
|
+
body.callbackUrl = af.callbackUrl;
|
|
18
|
+
return GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/voices', body);
|
|
19
|
+
}
|
|
20
|
+
if (operation === 'list') {
|
|
21
|
+
const returnAll = this.getNodeParameter('returnAll', i);
|
|
22
|
+
if (returnAll) {
|
|
23
|
+
return GenericFunctions_1.ycloudApiRequestAllItems.call(this, 'GET', '/voices');
|
|
24
|
+
}
|
|
25
|
+
const limit = this.getNodeParameter('limit', i);
|
|
26
|
+
const resp = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', '/voices', {}, { limit });
|
|
27
|
+
return resp.items || [];
|
|
28
|
+
}
|
|
29
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=voice.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"voice.action.js","sourceRoot":"","sources":["../../../../nodes/YCloud/actions/voice.action.ts"],"names":[],"mappings":";;AAIA,0BAuBC;AA1BD,+CAAkD;AAClD,0DAAiF;AAE1E,KAAK,UAAU,OAAO,CAA0B,CAAS,EAAE,SAAiB;IACjF,IAAI,SAAS,KAAK,MAAM,EAAE,CAAC;QACzB,MAAM,EAAE,GAAG,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC,CAAW,CAAC;QACzD,MAAM,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,CAAC,CAAW,CAAC;QACzE,MAAM,EAAE,GAAG,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,CAAC,CAAgB,CAAC;QACvE,MAAM,IAAI,GAAgB,EAAE,EAAE,EAAE,gBAAgB,EAAE,CAAC;QACnD,IAAI,EAAE,CAAC,QAAQ;YAAE,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC,QAAQ,CAAC;QAC7C,IAAI,EAAE,CAAC,UAAU;YAAE,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC,UAAU,CAAC;QACnD,IAAI,EAAE,CAAC,WAAW;YAAE,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC,WAAW,CAAC;QACtD,OAAO,mCAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IAC9D,CAAC;IAED,IAAI,SAAS,KAAK,MAAM,EAAE,CAAC;QACzB,MAAM,SAAS,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,CAAC,CAAY,CAAC;QACnE,IAAI,SAAS,EAAE,CAAC;YACd,OAAO,2CAAwB,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;QAC/D,CAAC;QACD,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAW,CAAC;QAC1D,MAAM,IAAI,GAAG,MAAM,mCAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAChF,OAAQ,IAAI,CAAC,KAAuB,IAAI,EAAE,CAAC;IAC7C,CAAC;IAED,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,sBAAsB,SAAS,EAAE,CAAC,CAAC;AAClF,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.execute = execute;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const GenericFunctions_1 = require("../GenericFunctions");
|
|
6
|
+
async function execute(i, operation) {
|
|
7
|
+
if (operation === 'create') {
|
|
8
|
+
const url = this.getNodeParameter('webhookUrl', i);
|
|
9
|
+
const enabledEvents = this.getNodeParameter('webhookEvents', i);
|
|
10
|
+
const af = this.getNodeParameter('additionalFields', i);
|
|
11
|
+
const body = { url, enabledEvents };
|
|
12
|
+
if (af.description)
|
|
13
|
+
body.description = af.description;
|
|
14
|
+
if (af.status)
|
|
15
|
+
body.status = af.status;
|
|
16
|
+
return GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/webhookEndpoints', body);
|
|
17
|
+
}
|
|
18
|
+
if (operation === 'list') {
|
|
19
|
+
const returnAll = this.getNodeParameter('returnAll', i);
|
|
20
|
+
if (returnAll) {
|
|
21
|
+
return GenericFunctions_1.ycloudApiRequestAllItems.call(this, 'GET', '/webhookEndpoints');
|
|
22
|
+
}
|
|
23
|
+
const limit = this.getNodeParameter('limit', i);
|
|
24
|
+
const resp = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', '/webhookEndpoints', {}, { limit });
|
|
25
|
+
return resp.items || [];
|
|
26
|
+
}
|
|
27
|
+
if (operation === 'retrieve') {
|
|
28
|
+
const id = this.getNodeParameter('webhookEndpointId', i);
|
|
29
|
+
return GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `/webhookEndpoints/${id}`);
|
|
30
|
+
}
|
|
31
|
+
if (operation === 'update') {
|
|
32
|
+
const id = this.getNodeParameter('webhookEndpointId', i);
|
|
33
|
+
const af = this.getNodeParameter('additionalFields', i);
|
|
34
|
+
const body = {};
|
|
35
|
+
if (af.url)
|
|
36
|
+
body.url = af.url;
|
|
37
|
+
if (af.description)
|
|
38
|
+
body.description = af.description;
|
|
39
|
+
if (af.status)
|
|
40
|
+
body.status = af.status;
|
|
41
|
+
return GenericFunctions_1.ycloudApiRequest.call(this, 'PATCH', `/webhookEndpoints/${id}`, body);
|
|
42
|
+
}
|
|
43
|
+
if (operation === 'delete') {
|
|
44
|
+
const id = this.getNodeParameter('webhookEndpointId', i);
|
|
45
|
+
return GenericFunctions_1.ycloudApiRequest.call(this, 'DELETE', `/webhookEndpoints/${id}`);
|
|
46
|
+
}
|
|
47
|
+
if (operation === 'rotateSecret') {
|
|
48
|
+
const id = this.getNodeParameter('webhookEndpointId', i);
|
|
49
|
+
return GenericFunctions_1.ycloudApiRequest.call(this, 'POST', `/webhookEndpoints/${id}/rotateSecret`);
|
|
50
|
+
}
|
|
51
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=webhookEndpoint.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhookEndpoint.action.js","sourceRoot":"","sources":["../../../../nodes/YCloud/actions/webhookEndpoint.action.ts"],"names":[],"mappings":";;AAIA,0BA+CC;AAlDD,+CAAkD;AAClD,0DAAiF;AAE1E,KAAK,UAAU,OAAO,CAA0B,CAAS,EAAE,SAAiB;IACjF,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;QAC3B,MAAM,GAAG,GAAG,IAAI,CAAC,gBAAgB,CAAC,YAAY,EAAE,CAAC,CAAW,CAAC;QAC7D,MAAM,aAAa,GAAG,IAAI,CAAC,gBAAgB,CAAC,eAAe,EAAE,CAAC,CAAa,CAAC;QAC5E,MAAM,EAAE,GAAG,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,CAAC,CAAgB,CAAC;QACvE,MAAM,IAAI,GAAgB,EAAE,GAAG,EAAE,aAAa,EAAE,CAAC;QACjD,IAAI,EAAE,CAAC,WAAW;YAAE,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC,WAAW,CAAC;QACtD,IAAI,EAAE,CAAC,MAAM;YAAE,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,MAAM,CAAC;QACvC,OAAO,mCAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,mBAAmB,EAAE,IAAI,CAAC,CAAC;IACxE,CAAC;IAED,IAAI,SAAS,KAAK,MAAM,EAAE,CAAC;QACzB,MAAM,SAAS,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,CAAC,CAAY,CAAC;QACnE,IAAI,SAAS,EAAE,CAAC;YACd,OAA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I,SAAS,KAAK,QAAQ,EAAE,CAAC;QAC3B,MAAM,EAAE,GAAG,IAAI,CAAC,gBAAgB,CAAC,mBAAmB,EAAE,CAAC,CAAW,CAAC;QACnE,OAAO,mCAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,qBAAqB,EAAE,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED,IAAI,SAAS,KAAK,cAAc,EAAE,CAAC;QACjC,MAAM,EAAE,GAAG,IAAI,CAAC,gBAAgB,CAAC,mBAAmB,EAAE,CAAC,CAAW,CAAC;QACnE,OAAO,mCAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,qBAAqB,EAAE,eAAe,CAAC,CAAC;IACrF,CAAC;IAED,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,sBAAsB,SAAS,EAAE,CAAC,CAAC;AAClF,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.execute = execute;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const GenericFunctions_1 = require("../GenericFunctions");
|
|
6
|
+
async function execute(i, operation) {
|
|
7
|
+
if (operation === 'list') {
|
|
8
|
+
const returnAll = this.getNodeParameter('returnAll', i);
|
|
9
|
+
if (returnAll) {
|
|
10
|
+
return GenericFunctions_1.ycloudApiRequestAllItems.call(this, 'GET', '/whatsapp/businessAccounts');
|
|
11
|
+
}
|
|
12
|
+
const limit = this.getNodeParameter('limit', i);
|
|
13
|
+
const resp = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', '/whatsapp/businessAccounts', {}, { limit });
|
|
14
|
+
return resp.items || [];
|
|
15
|
+
}
|
|
16
|
+
if (operation === 'retrieve') {
|
|
17
|
+
const id = this.getNodeParameter('wabaId', i);
|
|
18
|
+
return GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `/whatsapp/businessAccounts/${id}`);
|
|
19
|
+
}
|
|
20
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=whatsappBusinessAccount.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whatsappBusinessAccount.action.js","sourceRoot":"","sources":["../../../../nodes/YCloud/actions/whatsappBusinessAccount.action.ts"],"names":[],"mappings":";;AAIA,0BAiBC;AApBD,+CAAkD;AAClD,0DAAiF;AAE1E,KAAK,UAAU,OAAO,CAA0B,CAAS,EAAE,SAAiB;IACjF,IAAI,SAAS,KAAK,MAAM,EAAE,CAAC;QACzB,MAAM,SAAS,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,CAAC,CAAY,CAAC;QACnE,IAAI,SAAS,EAAE,CAAC;YACd,OAAO,2CAAwB,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,4BAA4B,CAAC,CAAC;QAClF,CAAC;QACD,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAW,CAAC;QAC1D,MAAM,IAAI,GAAG,MAAM,mCAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,4BAA4B,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QACnG,OAAQ,IAAI,CAAC,KAAuB,IAAI,EAAE,CAAC;IAC7C,CAAC;IAED,IAAI,SAAS,KAAK,UAAU,EAAE,CAAC;QAC7B,MAAM,EAAE,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC,CAAW,CAAC;QACxD,OAAO,mCAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,8BAA8B,EAAE,EAAE,CAAC,CAAC;IAChF,CAAC;IAED,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,sBAAsB,SAAS,EAAE,CAAC,CAAC;AAClF,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.execute = execute;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const GenericFunctions_1 = require("../GenericFunctions");
|
|
6
|
+
async function execute(i, operation) {
|
|
7
|
+
if (operation === 'connect') {
|
|
8
|
+
const from = this.getNodeParameter('callingFrom', i);
|
|
9
|
+
const to = this.getNodeParameter('callingTo', i);
|
|
10
|
+
const sdp = this.getNodeParameter('callingSdp', i);
|
|
11
|
+
return GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/whatsapp/calls/connect', { from, to, sdpType: 'offer', sdp });
|
|
12
|
+
}
|
|
13
|
+
if (operation === 'preAccept') {
|
|
14
|
+
const phoneId = this.getNodeParameter('callingPhoneId', i);
|
|
15
|
+
const wacid = this.getNodeParameter('callingWacid', i);
|
|
16
|
+
const sdp = this.getNodeParameter('callingSdp', i);
|
|
17
|
+
return GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/whatsapp/calls/preAccept', { phoneId, wacid, sdpType: 'answer', sdp });
|
|
18
|
+
}
|
|
19
|
+
if (operation === 'accept') {
|
|
20
|
+
const phoneId = this.getNodeParameter('callingPhoneId', i);
|
|
21
|
+
const wacid = this.getNodeParameter('callingWacid', i);
|
|
22
|
+
const sdp = this.getNodeParameter('callingSdp', i);
|
|
23
|
+
return GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/whatsapp/calls/accept', { phoneId, wacid, sdpType: 'answer', sdp });
|
|
24
|
+
}
|
|
25
|
+
if (operation === 'terminate') {
|
|
26
|
+
const phoneId = this.getNodeParameter('callingPhoneId', i);
|
|
27
|
+
const wacid = this.getNodeParameter('callingWacid', i);
|
|
28
|
+
return GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/whatsapp/calls/terminate', { phoneId, wacid });
|
|
29
|
+
}
|
|
30
|
+
if (operation === 'reject') {
|
|
31
|
+
const phoneId = this.getNodeParameter('callingPhoneId', i);
|
|
32
|
+
const wacid = this.getNodeParameter('callingWacid', i);
|
|
33
|
+
return GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/whatsapp/calls/reject', { phoneId, wacid });
|
|
34
|
+
}
|
|
35
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=whatsappCalling.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whatsappCalling.action.js","sourceRoot":"","sources":["../../../../nodes/YCloud/actions/whatsappCalling.action.ts"],"names":[],"mappings":";;AAIA,0BAmCC;AAtCD,+CAAkD;AAClD,0DAAuD;AAEhD,KAAK,UAAU,OAAO,CAA0B,CAAS,EAAE,SAAiB;IACjF,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,MAAM,IAAI,GAAG,IAAI,CAAC,gBAAgB,CAAC,aAAa,EAAE,CAAC,CAAW,CAAC;QAC/D,MAAM,EAAE,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,CAAC,CAAW,CAAC;QAC3D,MAAM,GAAG,GAAG,IAAI,CAAC,gBAAgB,CAAC,YAAY,EAAE,CAAC,CAAW,CAAC;QAC7D,OAAO,mCAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,yBAAyB,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;IAC7G,CAAC;IAED,IAAI,SAAS,KAAK,WAAW,EAAE,CAAC;QAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,EAAE,CAAC,CAAW,CAAC;QACrE,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,cAAc,EAAE,CAAC,CAAW,CAAC;QACjE,MAAM,GAAG,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C;QACjE,OAAO,mCAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,wBAAwB,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;IAC3F,CAAC;IAED,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,sBAAsB,SAAS,EAAE,CAAC,CAAC;AAClF,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.execute = execute;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const GenericFunctions_1 = require("../GenericFunctions");
|
|
6
|
+
async function execute(i, operation) {
|
|
7
|
+
if (operation === 'create') {
|
|
8
|
+
const wabaId = this.getNodeParameter('flowWabaId', i);
|
|
9
|
+
const name = this.getNodeParameter('flowName', i);
|
|
10
|
+
const categories = [this.getNodeParameter('flowCategory', i)];
|
|
11
|
+
const af = this.getNodeParameter('additionalFields', i);
|
|
12
|
+
const body = { wabaId, name, categories };
|
|
13
|
+
if (af.flowJson)
|
|
14
|
+
body.flowJson = af.flowJson;
|
|
15
|
+
return GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/whatsapp/flows', body);
|
|
16
|
+
}
|
|
17
|
+
if (operation === 'list') {
|
|
18
|
+
const returnAll = this.getNodeParameter('returnAll', i);
|
|
19
|
+
if (returnAll) {
|
|
20
|
+
return GenericFunctions_1.ycloudApiRequestAllItems.call(this, 'GET', '/whatsapp/flows');
|
|
21
|
+
}
|
|
22
|
+
const limit = this.getNodeParameter('limit', i);
|
|
23
|
+
const resp = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', '/whatsapp/flows', {}, { limit });
|
|
24
|
+
return resp.items || [];
|
|
25
|
+
}
|
|
26
|
+
if (operation === 'retrieve') {
|
|
27
|
+
const flowId = this.getNodeParameter('flowId', i);
|
|
28
|
+
return GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `/whatsapp/flows/${flowId}`);
|
|
29
|
+
}
|
|
30
|
+
if (operation === 'updateMetadata') {
|
|
31
|
+
const flowId = this.getNodeParameter('flowId', i);
|
|
32
|
+
const af = this.getNodeParameter('additionalFields', i);
|
|
33
|
+
const body = {};
|
|
34
|
+
if (af.name)
|
|
35
|
+
body.name = af.name;
|
|
36
|
+
return GenericFunctions_1.ycloudApiRequest.call(this, 'PATCH', `/whatsapp/flows/${flowId}/metadata`, body);
|
|
37
|
+
}
|
|
38
|
+
if (operation === 'updateStructure') {
|
|
39
|
+
const flowId = this.getNodeParameter('flowId', i);
|
|
40
|
+
const flowJson = this.getNodeParameter('flowAssetJson', i);
|
|
41
|
+
return GenericFunctions_1.ycloudApiRequest.call(this, 'PATCH', `/whatsapp/flows/${flowId}/assets`, { flowJson });
|
|
42
|
+
}
|
|
43
|
+
if (operation === 'delete') {
|
|
44
|
+
const flowId = this.getNodeParameter('flowId', i);
|
|
45
|
+
return GenericFunctions_1.ycloudApiRequest.call(this, 'DELETE', `/whatsapp/flows/${flowId}`);
|
|
46
|
+
}
|
|
47
|
+
if (operation === 'publish') {
|
|
48
|
+
const flowId = this.getNodeParameter('flowId', i);
|
|
49
|
+
return GenericFunctions_1.ycloudApiRequest.call(this, 'POST', `/whatsapp/flows/${flowId}/publish`);
|
|
50
|
+
}
|
|
51
|
+
if (operation === 'deprecate') {
|
|
52
|
+
const flowId = this.getNodeParameter('flowId', i);
|
|
53
|
+
return GenericFunctions_1.ycloudApiRequest.call(this, 'POST', `/whatsapp/flows/${flowId}/deprecate`);
|
|
54
|
+
}
|
|
55
|
+
if (operation === 'preview') {
|
|
56
|
+
const flowId = this.getNodeParameter('flowId', i);
|
|
57
|
+
return GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `/whatsapp/flows/${flowId}/preview`);
|
|
58
|
+
}
|
|
59
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=whatsappFlow.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whatsappFlow.action.js","sourceRoot":"","sources":["../../../../nodes/YCloud/actions/whatsappFlow.action.ts"],"names":[],"mappings":";;AAIA,0BA6DC;AAhED,+CAAkD;AAClD,0DAAiF;AAE1E,KAAK,UAAU,OAAO,CAA0B,CAAS,EAAE,SAAiB;IACjF,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;QAC3B,MAAM,MAAM,GAAG,IAAI,CAAC,gBAAgB,CAAC,YAAY,EAAE,CAAC,CAAW,CAAC;QAChE,MAAM,IAAI,GAAG,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC,CAAW,CAAC;QAC5D,MAAM,UAAU,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,cAAc,EAAE,CAAC,CAAW,CAAC,CAAC;QACxE,MAAM,EAAE,GAAG,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,CAAC,CAAgB,CAAC;QACvE,MAAM,IAAI,GAAgB,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;QACvD,IAAI,EAAE,CAAC,QAAQ;YAAE,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC,QAAQ,CAAC;QAC7C,OAAO,mCAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,iBAAiB,EAAE,IAAI,CAAC,CAAC;IACtE,CAAC;IAED,IAAI,SAAS,KAAK,MAAM,EAAE,CAAC;QACzB,MAAM,SAAS,GAAG,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,CAAC,CAAY,CAAC;QACnE,IAAI,SAAS,EAAE,CAAC;YACd,OAAO,2CAAwB,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAC;QACvE,CAAC;QACD,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAW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AC;IAED,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;QAC3B,MAAM,MAAM,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC,CAAW,CAAC;QAC5D,OAAO,mCAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,mBAAmB,MAAM,EAAE,CAAC,CAAC;IAC5E,CAAC;IAED,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,MAAM,MAAM,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC,CAAW,CAAC;QAC5D,OAAO,mCAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,mBAAmB,MAAM,UAAU,CAAC,CAAC;IAClF,CAAC;IAED,IAAI,SAAS,KAAK,WAAW,EAAE,CAAC;QAC9B,MAAM,MAAM,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC,CAAW,CAAC;QAC5D,OAAO,mCAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,mBAAmB,MAAM,YAAY,CAAC,CAAC;IACpF,CAAC;IAED,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,MAAM,MAAM,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC,CAAW,CAAC;QAC5D,OAAO,mCAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,mBAAmB,MAAM,UAAU,CAAC,CAAC;IACjF,CAAC;IAED,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,sBAAsB,SAAS,EAAE,CAAC,CAAC;AAClF,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.execute = execute;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const GenericFunctions_1 = require("../GenericFunctions");
|
|
6
|
+
async function execute(i, operation) {
|
|
7
|
+
const msgId = this.getNodeParameter('inboundMessageId', i);
|
|
8
|
+
if (operation === 'markAsRead') {
|
|
9
|
+
return GenericFunctions_1.ycloudApiRequest.call(this, 'POST', `/whatsapp/inboundMessages/${msgId}/markAsRead`);
|
|
10
|
+
}
|
|
11
|
+
if (operation === 'typingIndicator') {
|
|
12
|
+
return GenericFunctions_1.ycloudApiRequest.call(this, 'POST', `/whatsapp/inboundMessages/${msgId}/typingIndicator`);
|
|
13
|
+
}
|
|
14
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=whatsappInboundMessage.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whatsappInboundMessage.action.js","sourceRoot":"","sources":["../../../../nodes/YCloud/actions/whatsappInboundMessage.action.ts"],"names":[],"mappings":";;AAIA,0BAYC;AAfD,+CAAkD;AAClD,0DAAuD;AAEhD,KAAK,UAAU,OAAO,CAA0B,CAAS,EAAE,SAAiB;IACjF,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,CAAC,CAAW,CAAC;IAErE,IAAI,SAAS,KAAK,YAAY,EAAE,CAAC;QAC/B,OAAO,mCAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,6BAA6B,KAAK,aAAa,CAAC,CAAC;IAC9F,CAAC;IAED,IAAI,SAAS,KAAK,iBAAiB,EAAE,CAAC;QACpC,OAAO,mCAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,6BAA6B,KAAK,kBAAkB,CAAC,CAAC;IACnG,CAAC;IAED,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,sBAAsB,SAAS,EAAE,CAAC,CAAC;AAClF,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.execute = execute;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
async function execute(i, operation) {
|
|
6
|
+
if (operation === 'upload') {
|
|
7
|
+
const phoneNumber = this.getNodeParameter('mediaPhoneNumber', i);
|
|
8
|
+
const binaryProp = this.getNodeParameter('binaryProperty', i);
|
|
9
|
+
const binaryData = this.helpers.assertBinaryData(i, binaryProp);
|
|
10
|
+
const buffer = await this.helpers.getBinaryDataBuffer(i, binaryProp);
|
|
11
|
+
const credentials = await this.getCredentials('yCloudApi');
|
|
12
|
+
const formData = {
|
|
13
|
+
file: {
|
|
14
|
+
value: buffer,
|
|
15
|
+
options: {
|
|
16
|
+
filename: binaryData.fileName || 'file',
|
|
17
|
+
contentType: binaryData.mimeType,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
messaging_product: 'whatsapp',
|
|
21
|
+
type: binaryData.mimeType,
|
|
22
|
+
};
|
|
23
|
+
return this.helpers.request({
|
|
24
|
+
method: 'POST',
|
|
25
|
+
url: `https://api.ycloud.com/v2/whatsapp/media/${encodeURIComponent(phoneNumber)}/upload`,
|
|
26
|
+
headers: { 'X-API-Key': credentials.apiKey },
|
|
27
|
+
formData,
|
|
28
|
+
json: true,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=whatsappMedia.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whatsappMedia.action.js","sourceRoot":"","sources":["../../../../nodes/YCloud/actions/whatsappMedia.action.ts"],"names":[],"mappings":";;AAGA,0BA8BC;AAhCD,+CAAkD;AAE3C,KAAK,UAAU,OAAO,CAA0B,CAAS,EAAE,SAAiB;IACjF,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;QAC3B,MAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,CAAC,CAAW,CAAC;QAC3E,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,EAAE,CAAC,CAAW,CAAC;QACxE,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;QAChE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;QACrE,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;QAE3D,MAAM,QAAQ,GAAG;YACf,IAAI,EAAE;gBACJ,KAAK,EAAE,MAAM;gBACb,OAAO,EAAE;oBACP,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,MAAM;oBACvC,WAAW,EAAE,UAAU,CAAC,QAAQ;iBACjC;aACF;YACD,iBAAiB,EAAE,UAAU;YAC7B,IAAI,EAAE,UAAU,CAAC,QAAQ;SAC1B,CAAC;QAEF,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;YAC1B,MAAM,EAAE,MAAM;YACd,GAAG,EAAE,4CAA4C,kBAAkB,CAAC,WAAW,CAAC,SAAS;YACzF,OAAO,EAAE,EAAE,WAAW,EAAE,WAAW,CAAC,MAAgB,EAAE;YACtD,QAAQ;YACR,IAAI,EAAE,IAAI;SACJ,CAAC,CAAC;IACZ,CAAC;IAED,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,sBAAsB,SAAS,EAAE,CAAC,CAAC;AAClF,CAAC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.execute = execute;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const GenericFunctions_1 = require("../GenericFunctions");
|
|
6
|
+
async function execute(i, operation) {
|
|
7
|
+
if (operation === 'sendDirectly' || operation === 'send') {
|
|
8
|
+
const from = this.getNodeParameter('waFrom', i, '', { extractValue: true });
|
|
9
|
+
const to = this.getNodeParameter('waTo', i, '', { extractValue: true });
|
|
10
|
+
const messageType = this.getNodeParameter('messageType', i);
|
|
11
|
+
const af = this.getNodeParameter('additionalFields', i);
|
|
12
|
+
const body = { from, to, type: messageType };
|
|
13
|
+
if (messageType === 'text') {
|
|
14
|
+
body.text = {
|
|
15
|
+
body: this.getNodeParameter('textBody', i),
|
|
16
|
+
preview_url: this.getNodeParameter('textPreviewUrl', i),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
else if (messageType === 'template') {
|
|
20
|
+
const templateName = this.getNodeParameter('templateName', i, '', { extractValue: true });
|
|
21
|
+
const templateLanguage = this.getNodeParameter('templateLanguage', i);
|
|
22
|
+
const headerVar = this.getNodeParameter('templateHeaderVar', i, '');
|
|
23
|
+
const headerMedia = this.getNodeParameter('templateHeaderMedia', i, '');
|
|
24
|
+
const bodyVarsCollection = this.getNodeParameter('templateBodyVars', i, {});
|
|
25
|
+
const buttonVarsCollection = this.getNodeParameter('templateButtonVars', i, {});
|
|
26
|
+
const components = [];
|
|
27
|
+
if (headerVar) {
|
|
28
|
+
components.push({ type: 'header', parameters: [{ type: 'text', text: headerVar }] });
|
|
29
|
+
}
|
|
30
|
+
else if (headerMedia) {
|
|
31
|
+
const isUrl = headerMedia.startsWith('http');
|
|
32
|
+
components.push({
|
|
33
|
+
type: 'header',
|
|
34
|
+
parameters: [{ type: 'image', image: isUrl ? { link: headerMedia } : { id: headerMedia } }],
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
const bodyItems = bodyVarsCollection.variable || [];
|
|
38
|
+
if (bodyItems.length > 0) {
|
|
39
|
+
components.push({
|
|
40
|
+
type: 'body',
|
|
41
|
+
parameters: bodyItems.map((v) => ({ type: 'text', text: v.value })),
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
const buttonItems = buttonVarsCollection.variable || [];
|
|
45
|
+
for (const bv of buttonItems) {
|
|
46
|
+
components.push({
|
|
47
|
+
type: 'button',
|
|
48
|
+
sub_type: 'url',
|
|
49
|
+
index: bv.buttonIndex,
|
|
50
|
+
parameters: [{ type: 'text', text: bv.value }],
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
body.template = {
|
|
54
|
+
name: templateName,
|
|
55
|
+
language: { code: templateLanguage },
|
|
56
|
+
...(components.length > 0 ? { components } : {}),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
else if (['image', 'video', 'audio', 'document', 'sticker'].includes(messageType)) {
|
|
60
|
+
const mediaIdOrLink = this.getNodeParameter('mediaIdOrLink', i);
|
|
61
|
+
const mediaObj = mediaIdOrLink.startsWith('http') ? { link: mediaIdOrLink } : { id: mediaIdOrLink };
|
|
62
|
+
if (['image', 'video', 'document'].includes(messageType)) {
|
|
63
|
+
const caption = this.getNodeParameter('mediaCaption', i, '');
|
|
64
|
+
if (caption)
|
|
65
|
+
mediaObj.caption = caption;
|
|
66
|
+
}
|
|
67
|
+
if (messageType === 'document') {
|
|
68
|
+
const filename = this.getNodeParameter('documentFilename', i, '');
|
|
69
|
+
if (filename)
|
|
70
|
+
mediaObj.filename = filename;
|
|
71
|
+
}
|
|
72
|
+
body[messageType] = mediaObj;
|
|
73
|
+
}
|
|
74
|
+
else if (messageType === 'location') {
|
|
75
|
+
const locObj = {
|
|
76
|
+
latitude: this.getNodeParameter('locationLatitude', i),
|
|
77
|
+
longitude: this.getNodeParameter('locationLongitude', i),
|
|
78
|
+
};
|
|
79
|
+
const locName = this.getNodeParameter('locationName', i, '');
|
|
80
|
+
const locAddress = this.getNodeParameter('locationAddress', i, '');
|
|
81
|
+
if (locName)
|
|
82
|
+
locObj.name = locName;
|
|
83
|
+
if (locAddress)
|
|
84
|
+
locObj.address = locAddress;
|
|
85
|
+
body.location = locObj;
|
|
86
|
+
}
|
|
87
|
+
else if (messageType === 'interactive') {
|
|
88
|
+
body.interactive = JSON.parse(this.getNodeParameter('interactiveJSON', i));
|
|
89
|
+
}
|
|
90
|
+
else if (messageType === 'reaction') {
|
|
91
|
+
body.reaction = {
|
|
92
|
+
message_id: this.getNodeParameter('reactionMessageId', i),
|
|
93
|
+
emoji: this.getNodeParameter('reactionEmoji', i, ''),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
else if (messageType === 'contacts') {
|
|
97
|
+
body.contacts = JSON.parse(this.getNodeParameter('contactsJSON', i));
|
|
98
|
+
}
|
|
99
|
+
if (af.contextMessageId)
|
|
100
|
+
body.context = { message_id: af.contextMessageId };
|
|
101
|
+
if (af.externalId)
|
|
102
|
+
body.externalId = af.externalId;
|
|
103
|
+
if (af.filterUnsubscribed !== undefined)
|
|
104
|
+
body.filterUnsubscribed = af.filterUnsubscribed;
|
|
105
|
+
const endpoint = operation === 'sendDirectly' ? '/whatsapp/messages/sendDirectly' : '/whatsapp/messages';
|
|
106
|
+
return GenericFunctions_1.ycloudApiRequest.call(this, 'POST', endpoint, body);
|
|
107
|
+
}
|
|
108
|
+
if (operation === 'retrieve') {
|
|
109
|
+
const msgId = this.getNodeParameter('waMessageId', i);
|
|
110
|
+
return GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `/whatsapp/messages/${msgId}`);
|
|
111
|
+
}
|
|
112
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=whatsappMessage.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whatsappMessage.action.js","sourceRoot":"","sources":["../../../../nodes/YCloud/actions/whatsappMessage.action.ts"],"names":[],"mappings":";;AAIA,0BAwGC;AA3GD,+CAAkD;AAClD,0DAAuD;AAEhD,KAAK,UAAU,OAAO,CAA0B,CAAS,EAAE,SAAiB;IACjF,IAAI,SAAS,KAAK,c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CAAC;QACJ,CAAC;aAAM,IAAI,WAAW,KAAK,UAAU,EAAE,CAAC;YACtC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,cAAc,EAAE,CAAC,CAAW,CAAC,CAAC;QACjF,CAAC;QAED,IAAI,EAAE,CAAC,gBAAgB;YAAE,IAAI,CAAC,OAAO,GAAG,EAAE,UAAU,EAAE,EAAE,CAAC,gBAAgB,EAAE,CAAC;QAC5E,IAAI,EAAE,CAAC,UAAU;YAAE,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC,UAAU,CAAC;QACnD,IAAI,EAAE,CAAC,kBAAkB,KAAK,SAAS;YAAE,IAAI,CAAC,kBAAkB,GAAG,EAAE,CAAC,kBAAkB,CAAC;QAEzF,MAAM,QAAQ,GAAG,SAAS,KAAK,cAAc,CAAC,CAAC,CAAC,iCAAiC,CAAC,CAAC,CAAC,oBAAoB,CAAC;QACzG,OAAO,mCAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC7D,CAAC;IAED,IAAI,SAAS,KAAK,UAAU,EAAE,CAAC;QAC7B,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,aAAa,EAAE,CAAC,CAAW,CAAC;QAChE,OAAO,mCAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,sBAAsB,KAAK,EAAE,CAAC,CAAC;IAC3E,CAAC;IAED,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,sBAAsB,SAAS,EAAE,CAAC,CAAC;AAClF,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.execute = execute;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const GenericFunctions_1 = require("../GenericFunctions");
|
|
6
|
+
async function execute(i, operation) {
|
|
7
|
+
if (operation === 'list') {
|
|
8
|
+
const returnAll = this.getNodeParameter('returnAll', i);
|
|
9
|
+
if (returnAll) {
|
|
10
|
+
return GenericFunctions_1.ycloudApiRequestAllItems.call(this, 'GET', '/whatsapp/phoneNumbers');
|
|
11
|
+
}
|
|
12
|
+
const limit = this.getNodeParameter('limit', i);
|
|
13
|
+
const resp = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', '/whatsapp/phoneNumbers', {}, { limit });
|
|
14
|
+
return resp.items || [];
|
|
15
|
+
}
|
|
16
|
+
const wabaId = this.getNodeParameter('phoneWabaId', i);
|
|
17
|
+
const phone = this.getNodeParameter('phoneNumberParam', i);
|
|
18
|
+
const encodedPhone = encodeURIComponent(phone);
|
|
19
|
+
const base = `/whatsapp/phoneNumbers/${wabaId}/${encodedPhone}`;
|
|
20
|
+
if (operation === 'retrieve') {
|
|
21
|
+
return GenericFunctions_1.ycloudApiRequest.call(this, 'GET', base);
|
|
22
|
+
}
|
|
23
|
+
if (operation === 'retrieveProfile') {
|
|
24
|
+
return GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `${base}/profile`);
|
|
25
|
+
}
|
|
26
|
+
if (operation === 'updateProfile') {
|
|
27
|
+
const pf = this.getNodeParameter('profileFields', i);
|
|
28
|
+
const body = {};
|
|
29
|
+
if (pf.about)
|
|
30
|
+
body.about = pf.about;
|
|
31
|
+
if (pf.address)
|
|
32
|
+
body.address = pf.address;
|
|
33
|
+
if (pf.description)
|
|
34
|
+
body.description = pf.description;
|
|
35
|
+
if (pf.email)
|
|
36
|
+
body.email = pf.email;
|
|
37
|
+
if (pf.profilePictureUrl)
|
|
38
|
+
body.profilePictureUrl = pf.profilePictureUrl;
|
|
39
|
+
if (pf.vertical)
|
|
40
|
+
body.vertical = pf.vertical;
|
|
41
|
+
const websites = [];
|
|
42
|
+
if (pf.websites1)
|
|
43
|
+
websites.push(pf.websites1);
|
|
44
|
+
if (pf.websites2)
|
|
45
|
+
websites.push(pf.websites2);
|
|
46
|
+
if (websites.length)
|
|
47
|
+
body.websites = websites;
|
|
48
|
+
return GenericFunctions_1.ycloudApiRequest.call(this, 'PATCH', `${base}/profile`, body);
|
|
49
|
+
}
|
|
50
|
+
if (operation === 'updateDisplayName') {
|
|
51
|
+
const displayName = this.getNodeParameter('phoneDisplayName', i);
|
|
52
|
+
return GenericFunctions_1.ycloudApiRequest.call(this, 'PATCH', `${base}/displayName`, { displayName });
|
|
53
|
+
}
|
|
54
|
+
if (operation === 'retrieveCommerceSettings') {
|
|
55
|
+
return GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `${base}/whatsappCommerceSettings`);
|
|
56
|
+
}
|
|
57
|
+
if (operation === 'updateCommerceSettings') {
|
|
58
|
+
const csJson = this.getNodeParameter('commerceSettingsJson', i);
|
|
59
|
+
return GenericFunctions_1.ycloudApiRequest.call(this, 'PATCH', `${base}/whatsappCommerceSettings`, JSON.parse(csJson));
|
|
60
|
+
}
|
|
61
|
+
if (operation === 'register') {
|
|
62
|
+
return GenericFunctions_1.ycloudApiRequest.call(this, 'POST', `${base}/register`);
|
|
63
|
+
}
|
|
64
|
+
if (operation === 'retrieveSettings') {
|
|
65
|
+
return GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `${base}/settings`);
|
|
66
|
+
}
|
|
67
|
+
if (operation === 'saveSettings') {
|
|
68
|
+
const settingsJson = this.getNodeParameter('phoneSettingsJson', i);
|
|
69
|
+
return GenericFunctions_1.ycloudApiRequest.call(this, 'POST', `${base}/settings`, JSON.parse(settingsJson));
|
|
70
|
+
}
|
|
71
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=whatsappPhoneNumber.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whatsappPhoneNumber.action.js","sourceRoot":"","sources":["../../../../nodes/YCloud/actions/whatsappPhoneN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