@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
|
@@ -1,1333 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.YCloud = void 0;
|
|
4
37
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
displayName: 'Return All',
|
|
9
|
-
name: 'returnAll',
|
|
10
|
-
type: 'boolean',
|
|
11
|
-
default: false,
|
|
12
|
-
description: 'Whether to return all results or only up to a given limit',
|
|
13
|
-
};
|
|
14
|
-
const limitField = {
|
|
15
|
-
displayName: 'Limit',
|
|
16
|
-
name: 'limit',
|
|
17
|
-
type: 'number',
|
|
18
|
-
default: 50,
|
|
19
|
-
typeOptions: { minValue: 1, maxValue: 100 },
|
|
20
|
-
description: 'Max number of results to return',
|
|
21
|
-
};
|
|
22
|
-
// ─── Properties ──────────────────────────────────────────────────────────────
|
|
23
|
-
const properties = [
|
|
24
|
-
// ═══════════════════════════════════════════
|
|
25
|
-
// RESOURCE SELECTOR
|
|
26
|
-
// ═══════════════════════════════════════════
|
|
27
|
-
{
|
|
28
|
-
displayName: 'Resource',
|
|
29
|
-
name: 'resource',
|
|
30
|
-
type: 'options',
|
|
31
|
-
noDataExpression: true,
|
|
32
|
-
options: [
|
|
33
|
-
{ name: 'Balance', value: 'balance' },
|
|
34
|
-
{ name: 'Contact', value: 'contact' },
|
|
35
|
-
{ name: 'Custom Event', value: 'customEvent' },
|
|
36
|
-
{ name: 'Email', value: 'email' },
|
|
37
|
-
{ name: 'SMS', value: 'sms' },
|
|
38
|
-
{ name: 'Unsubscriber', value: 'unsubscriber' },
|
|
39
|
-
{ name: 'Verification', value: 'verification' },
|
|
40
|
-
{ name: 'Voice', value: 'voice' },
|
|
41
|
-
{ name: 'Webhook Endpoint', value: 'webhookEndpoint' },
|
|
42
|
-
{ name: 'WhatsApp Business Account', value: 'whatsappBusinessAccount' },
|
|
43
|
-
{ name: 'WhatsApp Calling', value: 'whatsappCalling' },
|
|
44
|
-
{ name: 'WhatsApp Flow', value: 'whatsappFlow' },
|
|
45
|
-
{ name: 'WhatsApp Inbound Message', value: 'whatsappInboundMessage' },
|
|
46
|
-
{ name: 'WhatsApp Media', value: 'whatsappMedia' },
|
|
47
|
-
{ name: 'WhatsApp Message', value: 'whatsappMessage' },
|
|
48
|
-
{ name: 'WhatsApp Phone Number', value: 'whatsappPhoneNumber' },
|
|
49
|
-
{ name: 'WhatsApp Template', value: 'whatsappTemplate' },
|
|
50
|
-
],
|
|
51
|
-
default: 'whatsappMessage',
|
|
52
|
-
},
|
|
53
|
-
// ═══════════════════════════════════════════
|
|
54
|
-
// BALANCE
|
|
55
|
-
// ═══════════════════════════════════════════
|
|
56
|
-
{
|
|
57
|
-
displayName: 'Operation',
|
|
58
|
-
name: 'operation',
|
|
59
|
-
type: 'options',
|
|
60
|
-
noDataExpression: true,
|
|
61
|
-
displayOptions: { show: { resource: ['balance'] } },
|
|
62
|
-
options: [{ name: 'Retrieve', value: 'retrieve', action: 'Retrieve account balance' }],
|
|
63
|
-
default: 'retrieve',
|
|
64
|
-
},
|
|
65
|
-
// ═══════════════════════════════════════════
|
|
66
|
-
// CONTACT
|
|
67
|
-
// ═══════════════════════════════════════════
|
|
68
|
-
{
|
|
69
|
-
displayName: 'Operation',
|
|
70
|
-
name: 'operation',
|
|
71
|
-
type: 'options',
|
|
72
|
-
noDataExpression: true,
|
|
73
|
-
displayOptions: { show: { resource: ['contact'] } },
|
|
74
|
-
options: [
|
|
75
|
-
{ name: 'Create', value: 'create', action: 'Create a contact' },
|
|
76
|
-
{ name: 'Delete', value: 'delete', action: 'Delete a contact' },
|
|
77
|
-
{ name: 'Get', value: 'retrieve', action: 'Get a contact' },
|
|
78
|
-
{ name: 'Get Many', value: 'list', action: 'Get many contacts' },
|
|
79
|
-
{ name: 'List Attributes', value: 'listAttributes', action: 'List contact attributes' },
|
|
80
|
-
{ name: 'Update', value: 'update', action: 'Update a contact' },
|
|
81
|
-
],
|
|
82
|
-
default: 'create',
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
displayName: 'Contact',
|
|
86
|
-
name: 'contactId',
|
|
87
|
-
type: 'resourceLocator',
|
|
88
|
-
default: { mode: 'list', value: '' },
|
|
89
|
-
required: true,
|
|
90
|
-
displayOptions: { show: { resource: ['contact'], operation: ['retrieve', 'update', 'delete'] } },
|
|
91
|
-
description: 'Select from your contacts list or enter the contact ID manually',
|
|
92
|
-
modes: [
|
|
93
|
-
{
|
|
94
|
-
displayName: 'From List',
|
|
95
|
-
name: 'list',
|
|
96
|
-
type: 'list',
|
|
97
|
-
typeOptions: { searchListMethod: 'getContacts', searchable: true },
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
displayName: 'By ID',
|
|
101
|
-
name: 'id',
|
|
102
|
-
type: 'string',
|
|
103
|
-
placeholder: 'e.g. 6665b3xxxxxx',
|
|
104
|
-
},
|
|
105
|
-
],
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
displayName: 'Phone Number',
|
|
109
|
-
name: 'phoneNumber',
|
|
110
|
-
type: 'string',
|
|
111
|
-
required: true,
|
|
112
|
-
default: '',
|
|
113
|
-
placeholder: '+16315551111',
|
|
114
|
-
displayOptions: { show: { resource: ['contact'], operation: ['create'] } },
|
|
115
|
-
description: 'Phone number in E.164 format',
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
displayName: 'Additional Fields',
|
|
119
|
-
name: 'additionalFields',
|
|
120
|
-
type: 'collection',
|
|
121
|
-
placeholder: 'Add Field',
|
|
122
|
-
default: {},
|
|
123
|
-
displayOptions: { show: { resource: ['contact'], operation: ['create', 'update'] } },
|
|
124
|
-
options: [
|
|
125
|
-
{ displayName: 'Country Code', name: 'countryCode', type: 'string', default: '', description: 'Two-letter ISO 3166-1 alpha-2 country code (e.g. US)' },
|
|
126
|
-
{ displayName: 'Custom Attributes (JSON)', name: 'customAttributes', type: 'string', typeOptions: { rows: 3 }, default: '', description: 'JSON array: [{"key":"attr1","value":"val1"}]' },
|
|
127
|
-
{ displayName: 'Email', name: 'email', type: 'string', placeholder: 'name@email.com', default: '' },
|
|
128
|
-
{ displayName: 'Nickname', name: 'nickname', type: 'string', default: '' },
|
|
129
|
-
{ displayName: 'Owner Email', name: 'ownerEmail', type: 'string', placeholder: 'name@email.com', default: '' },
|
|
130
|
-
{ displayName: 'Phone Number', name: 'phoneNumber', type: 'string', default: '', placeholder: '+16315551111', description: 'Used when updating phone number' },
|
|
131
|
-
{ displayName: 'Tags', name: 'tags', type: 'string', default: '', description: 'Comma-separated list of tags' },
|
|
132
|
-
],
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
...returnAllField,
|
|
136
|
-
displayOptions: { show: { resource: ['contact'], operation: ['list'] } },
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
...limitField,
|
|
140
|
-
displayOptions: { show: { resource: ['contact'], operation: ['list'], returnAll: [false] } },
|
|
141
|
-
},
|
|
142
|
-
// ═══════════════════════════════════════════
|
|
143
|
-
// CUSTOM EVENT
|
|
144
|
-
// ═══════════════════════════════════════════
|
|
145
|
-
{
|
|
146
|
-
displayName: 'Operation',
|
|
147
|
-
name: 'operation',
|
|
148
|
-
type: 'options',
|
|
149
|
-
noDataExpression: true,
|
|
150
|
-
displayOptions: { show: { resource: ['customEvent'] } },
|
|
151
|
-
options: [
|
|
152
|
-
{ name: 'Create Event Definition', value: 'createDefinition', action: 'Create an event definition' },
|
|
153
|
-
{ name: 'Create Property Definition', value: 'createPropertyDef', action: 'Create an event property definition' },
|
|
154
|
-
{ name: 'Delete Property Definition', value: 'deletePropertyDef', action: 'Delete an event property definition' },
|
|
155
|
-
{ name: 'Retrieve Event Definition', value: 'retrieveDefinition', action: 'Retrieve an event definition' },
|
|
156
|
-
{ name: 'Send Event', value: 'sendEvent', action: 'Send a custom event' },
|
|
157
|
-
{ name: 'Update Event Definition', value: 'updateDefinition', action: 'Update an event definition' },
|
|
158
|
-
{ name: 'Update Property Definition', value: 'updatePropertyDef', action: 'Update an event property definition' },
|
|
159
|
-
],
|
|
160
|
-
default: 'sendEvent',
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
displayName: 'Event Definition Name',
|
|
164
|
-
name: 'eventDefinitionName',
|
|
165
|
-
type: 'string',
|
|
166
|
-
required: true,
|
|
167
|
-
default: '',
|
|
168
|
-
displayOptions: { show: { resource: ['customEvent'], operation: ['createDefinition', 'retrieveDefinition', 'updateDefinition', 'createPropertyDef', 'updatePropertyDef', 'deletePropertyDef'] } },
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
displayName: 'Event Name',
|
|
172
|
-
name: 'eventName',
|
|
173
|
-
type: 'string',
|
|
174
|
-
required: true,
|
|
175
|
-
default: '',
|
|
176
|
-
displayOptions: { show: { resource: ['customEvent'], operation: ['sendEvent'] } },
|
|
177
|
-
description: 'Name of the custom event to send',
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
displayName: 'Phone Number',
|
|
181
|
-
name: 'eventPhoneNumber',
|
|
182
|
-
type: 'string',
|
|
183
|
-
required: true,
|
|
184
|
-
default: '',
|
|
185
|
-
placeholder: '+16315551111',
|
|
186
|
-
displayOptions: { show: { resource: ['customEvent'], operation: ['sendEvent'] } },
|
|
187
|
-
description: 'Contact phone number in E.164 format',
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
displayName: 'Event Properties (JSON)',
|
|
191
|
-
name: 'eventProperties',
|
|
192
|
-
type: 'string',
|
|
193
|
-
typeOptions: { rows: 4 },
|
|
194
|
-
default: '',
|
|
195
|
-
displayOptions: { show: { resource: ['customEvent'], operation: ['sendEvent'] } },
|
|
196
|
-
description: 'JSON object with event properties, e.g. {"amount": 100, "currency": "USD"}',
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
displayName: 'Property Name',
|
|
200
|
-
name: 'propertyName',
|
|
201
|
-
type: 'string',
|
|
202
|
-
required: true,
|
|
203
|
-
default: '',
|
|
204
|
-
displayOptions: { show: { resource: ['customEvent'], operation: ['createPropertyDef', 'updatePropertyDef', 'deletePropertyDef'] } },
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
displayName: 'Property Type',
|
|
208
|
-
name: 'propertyType',
|
|
209
|
-
type: 'options',
|
|
210
|
-
required: true,
|
|
211
|
-
default: 'string',
|
|
212
|
-
displayOptions: { show: { resource: ['customEvent'], operation: ['createPropertyDef'] } },
|
|
213
|
-
options: [
|
|
214
|
-
{ name: 'Boolean', value: 'boolean' },
|
|
215
|
-
{ name: 'Date', value: 'date' },
|
|
216
|
-
{ name: 'Number', value: 'number' },
|
|
217
|
-
{ name: 'String', value: 'string' },
|
|
218
|
-
],
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
displayName: 'Additional Fields',
|
|
222
|
-
name: 'additionalFields',
|
|
223
|
-
type: 'collection',
|
|
224
|
-
placeholder: 'Add Field',
|
|
225
|
-
default: {},
|
|
226
|
-
displayOptions: { show: { resource: ['customEvent'], operation: ['createDefinition', 'updateDefinition', 'createPropertyDef', 'updatePropertyDef'] } },
|
|
227
|
-
options: [
|
|
228
|
-
{ displayName: 'Description', name: 'description', type: 'string', default: '' },
|
|
229
|
-
{ displayName: 'Label', name: 'label', type: 'string', default: '' },
|
|
230
|
-
],
|
|
231
|
-
},
|
|
232
|
-
// ═══════════════════════════════════════════
|
|
233
|
-
// EMAIL
|
|
234
|
-
// ═══════════════════════════════════════════
|
|
235
|
-
{
|
|
236
|
-
displayName: 'Operation',
|
|
237
|
-
name: 'operation',
|
|
238
|
-
type: 'options',
|
|
239
|
-
noDataExpression: true,
|
|
240
|
-
displayOptions: { show: { resource: ['email'] } },
|
|
241
|
-
options: [{ name: 'Send', value: 'send', action: 'Send an email' }],
|
|
242
|
-
default: 'send',
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
displayName: 'From',
|
|
246
|
-
name: 'emailFrom',
|
|
247
|
-
type: 'string',
|
|
248
|
-
required: true,
|
|
249
|
-
default: '',
|
|
250
|
-
placeholder: 'Sender<sender@example.com>',
|
|
251
|
-
displayOptions: { show: { resource: ['email'], operation: ['send'] } },
|
|
252
|
-
description: 'Sender email address. Format: "Name<email>" or just "email"',
|
|
253
|
-
},
|
|
254
|
-
{
|
|
255
|
-
displayName: 'To',
|
|
256
|
-
name: 'emailTo',
|
|
257
|
-
type: 'string',
|
|
258
|
-
required: true,
|
|
259
|
-
default: '',
|
|
260
|
-
placeholder: 'to1@example.com,Name<to2@example.com>',
|
|
261
|
-
displayOptions: { show: { resource: ['email'], operation: ['send'] } },
|
|
262
|
-
description: 'Comma-separated list of recipient email addresses',
|
|
263
|
-
},
|
|
264
|
-
{
|
|
265
|
-
displayName: 'Subject',
|
|
266
|
-
name: 'emailSubject',
|
|
267
|
-
type: 'string',
|
|
268
|
-
required: true,
|
|
269
|
-
default: '',
|
|
270
|
-
displayOptions: { show: { resource: ['email'], operation: ['send'] } },
|
|
271
|
-
},
|
|
272
|
-
{
|
|
273
|
-
displayName: 'Content',
|
|
274
|
-
name: 'emailContent',
|
|
275
|
-
type: 'string',
|
|
276
|
-
required: true,
|
|
277
|
-
typeOptions: { rows: 6 },
|
|
278
|
-
default: '',
|
|
279
|
-
displayOptions: { show: { resource: ['email'], operation: ['send'] } },
|
|
280
|
-
description: 'Email body. Supports HTML. Variables: use #var_name# syntax.',
|
|
281
|
-
},
|
|
282
|
-
{
|
|
283
|
-
displayName: 'Additional Fields',
|
|
284
|
-
name: 'additionalFields',
|
|
285
|
-
type: 'collection',
|
|
286
|
-
placeholder: 'Add Field',
|
|
287
|
-
default: {},
|
|
288
|
-
displayOptions: { show: { resource: ['email'], operation: ['send'] } },
|
|
289
|
-
options: [
|
|
290
|
-
{ displayName: 'Callback URL', name: 'callbackUrl', type: 'string', default: '' },
|
|
291
|
-
{ displayName: 'Content Type', name: 'contentType', type: 'options', default: 'Html', options: [{ name: 'HTML', value: 'Html' }, { name: 'Plain Text', value: 'PlainText' }] },
|
|
292
|
-
{ displayName: 'External ID', name: 'externalId', type: 'string', default: '' },
|
|
293
|
-
{ displayName: 'Reply To', name: 'replyTo', type: 'string', placeholder: 'reply@example.com', default: '' },
|
|
294
|
-
{ displayName: 'Variables (JSON)', name: 'variables', type: 'string', typeOptions: { rows: 3 }, default: '', description: 'JSON object with template variables, e.g. {"nick":"John"}' },
|
|
295
|
-
],
|
|
296
|
-
},
|
|
297
|
-
// ═══════════════════════════════════════════
|
|
298
|
-
// SMS
|
|
299
|
-
// ═══════════════════════════════════════════
|
|
300
|
-
{
|
|
301
|
-
displayName: 'Operation',
|
|
302
|
-
name: 'operation',
|
|
303
|
-
type: 'options',
|
|
304
|
-
noDataExpression: true,
|
|
305
|
-
displayOptions: { show: { resource: ['sms'] } },
|
|
306
|
-
options: [
|
|
307
|
-
{ name: 'Get Many', value: 'list', action: 'Get many SMS records' },
|
|
308
|
-
{ name: 'Send', value: 'send', action: 'Send an SMS' },
|
|
309
|
-
],
|
|
310
|
-
default: 'send',
|
|
311
|
-
},
|
|
312
|
-
{
|
|
313
|
-
displayName: 'To',
|
|
314
|
-
name: 'smsTo',
|
|
315
|
-
type: 'string',
|
|
316
|
-
required: true,
|
|
317
|
-
default: '',
|
|
318
|
-
placeholder: '+16315551111',
|
|
319
|
-
displayOptions: { show: { resource: ['sms'], operation: ['send'] } },
|
|
320
|
-
description: 'Recipient phone number in E.164 format',
|
|
321
|
-
},
|
|
322
|
-
{
|
|
323
|
-
displayName: 'Text',
|
|
324
|
-
name: 'smsText',
|
|
325
|
-
type: 'string',
|
|
326
|
-
required: true,
|
|
327
|
-
typeOptions: { rows: 3 },
|
|
328
|
-
default: '',
|
|
329
|
-
displayOptions: { show: { resource: ['sms'], operation: ['send'] } },
|
|
330
|
-
},
|
|
331
|
-
{
|
|
332
|
-
displayName: 'Additional Fields',
|
|
333
|
-
name: 'additionalFields',
|
|
334
|
-
type: 'collection',
|
|
335
|
-
placeholder: 'Add Field',
|
|
336
|
-
default: {},
|
|
337
|
-
displayOptions: { show: { resource: ['sms'], operation: ['send'] } },
|
|
338
|
-
options: [
|
|
339
|
-
{ displayName: 'Callback URL', name: 'callbackUrl', type: 'string', default: '' },
|
|
340
|
-
{ displayName: 'External ID', name: 'externalId', type: 'string', default: '' },
|
|
341
|
-
{ displayName: 'Sender ID', name: 'senderId', type: 'string', default: '' },
|
|
342
|
-
{ displayName: 'Signature (CN only)', name: 'signature', type: 'string', default: '' },
|
|
343
|
-
],
|
|
344
|
-
},
|
|
345
|
-
{
|
|
346
|
-
...returnAllField,
|
|
347
|
-
displayOptions: { show: { resource: ['sms'], operation: ['list'] } },
|
|
348
|
-
},
|
|
349
|
-
{
|
|
350
|
-
...limitField,
|
|
351
|
-
displayOptions: { show: { resource: ['sms'], operation: ['list'], returnAll: [false] } },
|
|
352
|
-
},
|
|
353
|
-
{
|
|
354
|
-
displayName: 'Filters',
|
|
355
|
-
name: 'filters',
|
|
356
|
-
type: 'collection',
|
|
357
|
-
placeholder: 'Add Filter',
|
|
358
|
-
default: {},
|
|
359
|
-
displayOptions: { show: { resource: ['sms'], operation: ['list'] } },
|
|
360
|
-
options: [
|
|
361
|
-
{ displayName: 'Created After', name: 'createTimeGte', type: 'dateTime', default: '' },
|
|
362
|
-
{ displayName: 'Created Before', name: 'createTimeLte', type: 'dateTime', default: '' },
|
|
363
|
-
{ displayName: 'SMS ID', name: 'id', type: 'string', default: '' },
|
|
364
|
-
],
|
|
365
|
-
},
|
|
366
|
-
// ═══════════════════════════════════════════
|
|
367
|
-
// UNSUBSCRIBER
|
|
368
|
-
// ═══════════════════════════════════════════
|
|
369
|
-
{
|
|
370
|
-
displayName: 'Operation',
|
|
371
|
-
name: 'operation',
|
|
372
|
-
type: 'options',
|
|
373
|
-
noDataExpression: true,
|
|
374
|
-
displayOptions: { show: { resource: ['unsubscriber'] } },
|
|
375
|
-
options: [
|
|
376
|
-
{ name: 'Create', value: 'create', action: 'Create an unsubscriber' },
|
|
377
|
-
{ name: 'Delete', value: 'delete', action: 'Delete an unsubscriber' },
|
|
378
|
-
{ name: 'Get', value: 'retrieve', action: 'Get an unsubscriber' },
|
|
379
|
-
{ name: 'Get All by Customer', value: 'listByCustomer', action: 'List all unsubscribers by customer' },
|
|
380
|
-
{ name: 'Get Many', value: 'list', action: 'Get many unsubscribers' },
|
|
381
|
-
],
|
|
382
|
-
default: 'list',
|
|
383
|
-
},
|
|
384
|
-
{
|
|
385
|
-
displayName: 'Customer (Phone or Email)',
|
|
386
|
-
name: 'unsubCustomer',
|
|
387
|
-
type: 'string',
|
|
388
|
-
required: true,
|
|
389
|
-
default: '',
|
|
390
|
-
displayOptions: { show: { resource: ['unsubscriber'], operation: ['retrieve', 'delete', 'listByCustomer'] } },
|
|
391
|
-
description: 'Customer phone number (E.164) or email',
|
|
392
|
-
},
|
|
393
|
-
{
|
|
394
|
-
displayName: 'Channel',
|
|
395
|
-
name: 'unsubChannel',
|
|
396
|
-
type: 'options',
|
|
397
|
-
required: true,
|
|
398
|
-
default: 'whatsapp',
|
|
399
|
-
displayOptions: { show: { resource: ['unsubscriber'], operation: ['retrieve', 'delete', 'create'] } },
|
|
400
|
-
options: [
|
|
401
|
-
{ name: 'Email', value: 'email' },
|
|
402
|
-
{ name: 'SMS', value: 'sms' },
|
|
403
|
-
{ name: 'Voice', value: 'voice' },
|
|
404
|
-
{ name: 'WhatsApp', value: 'whatsapp' },
|
|
405
|
-
],
|
|
406
|
-
},
|
|
407
|
-
{
|
|
408
|
-
displayName: 'Customer (Phone or Email)',
|
|
409
|
-
name: 'unsubCreateCustomer',
|
|
410
|
-
type: 'string',
|
|
411
|
-
required: true,
|
|
412
|
-
default: '',
|
|
413
|
-
placeholder: '+16315551111',
|
|
414
|
-
displayOptions: { show: { resource: ['unsubscriber'], operation: ['create'] } },
|
|
415
|
-
},
|
|
416
|
-
{
|
|
417
|
-
...returnAllField,
|
|
418
|
-
displayOptions: { show: { resource: ['unsubscriber'], operation: ['list'] } },
|
|
419
|
-
},
|
|
420
|
-
{
|
|
421
|
-
...limitField,
|
|
422
|
-
displayOptions: { show: { resource: ['unsubscriber'], operation: ['list'], returnAll: [false] } },
|
|
423
|
-
},
|
|
424
|
-
// ═══════════════════════════════════════════
|
|
425
|
-
// VERIFICATION
|
|
426
|
-
// ═══════════════════════════════════════════
|
|
427
|
-
{
|
|
428
|
-
displayName: 'Operation',
|
|
429
|
-
name: 'operation',
|
|
430
|
-
type: 'options',
|
|
431
|
-
noDataExpression: true,
|
|
432
|
-
displayOptions: { show: { resource: ['verification'] } },
|
|
433
|
-
options: [
|
|
434
|
-
{ name: 'Check Verification', value: 'check', action: 'Check a verification code' },
|
|
435
|
-
{ name: 'Start Verification', value: 'send', action: 'Start a verification' },
|
|
436
|
-
],
|
|
437
|
-
default: 'send',
|
|
438
|
-
},
|
|
439
|
-
{
|
|
440
|
-
displayName: 'Channel',
|
|
441
|
-
name: 'verificationChannel',
|
|
442
|
-
type: 'options',
|
|
443
|
-
required: true,
|
|
444
|
-
default: 'sms',
|
|
445
|
-
displayOptions: { show: { resource: ['verification'], operation: ['send'] } },
|
|
446
|
-
options: [
|
|
447
|
-
{ name: 'Email Code', value: 'email_code' },
|
|
448
|
-
{ name: 'SMS', value: 'sms' },
|
|
449
|
-
{ name: 'Voice', value: 'voice' },
|
|
450
|
-
],
|
|
451
|
-
},
|
|
452
|
-
{
|
|
453
|
-
displayName: 'To (Phone or Email)',
|
|
454
|
-
name: 'verificationTo',
|
|
455
|
-
type: 'string',
|
|
456
|
-
required: true,
|
|
457
|
-
default: '',
|
|
458
|
-
placeholder: '+16315551111',
|
|
459
|
-
displayOptions: { show: { resource: ['verification'], operation: ['send'] } },
|
|
460
|
-
description: 'Phone number (E.164) or email address depending on channel',
|
|
461
|
-
},
|
|
462
|
-
{
|
|
463
|
-
displayName: 'Additional Fields',
|
|
464
|
-
name: 'additionalFields',
|
|
465
|
-
type: 'collection',
|
|
466
|
-
placeholder: 'Add Field',
|
|
467
|
-
default: {},
|
|
468
|
-
displayOptions: { show: { resource: ['verification'], operation: ['send'] } },
|
|
469
|
-
options: [
|
|
470
|
-
{ displayName: 'Code', name: 'code', type: 'string', default: '', description: 'Custom verification code (4–8 digits). Auto-generated if omitted.' },
|
|
471
|
-
{ displayName: 'Language', name: 'language', type: 'string', default: 'en', description: 'ISO 639 language code' },
|
|
472
|
-
{ displayName: 'Sender ID', name: 'senderId', type: 'string', default: '' },
|
|
473
|
-
{ displayName: 'Signature (CN only)', name: 'signature', type: 'string', default: '' },
|
|
474
|
-
],
|
|
475
|
-
},
|
|
476
|
-
{
|
|
477
|
-
displayName: 'Code',
|
|
478
|
-
name: 'verificationCode',
|
|
479
|
-
type: 'string',
|
|
480
|
-
required: true,
|
|
481
|
-
default: '',
|
|
482
|
-
displayOptions: { show: { resource: ['verification'], operation: ['check'] } },
|
|
483
|
-
description: 'The code to verify',
|
|
484
|
-
},
|
|
485
|
-
{
|
|
486
|
-
displayName: 'Identification',
|
|
487
|
-
name: 'verificationIdentification',
|
|
488
|
-
type: 'collection',
|
|
489
|
-
placeholder: 'Add Field',
|
|
490
|
-
default: {},
|
|
491
|
-
displayOptions: { show: { resource: ['verification'], operation: ['check'] } },
|
|
492
|
-
options: [
|
|
493
|
-
{ displayName: 'To (Phone or Email)', name: 'to', type: 'string', default: '' },
|
|
494
|
-
{ displayName: 'Verification ID', name: 'verificationId', type: 'string', default: '' },
|
|
495
|
-
],
|
|
496
|
-
description: 'At least one of Verification ID or To is required',
|
|
497
|
-
},
|
|
498
|
-
// ═══════════════════════════════════════════
|
|
499
|
-
// VOICE
|
|
500
|
-
// ═══════════════════════════════════════════
|
|
501
|
-
{
|
|
502
|
-
displayName: 'Operation',
|
|
503
|
-
name: 'operation',
|
|
504
|
-
type: 'options',
|
|
505
|
-
noDataExpression: true,
|
|
506
|
-
displayOptions: { show: { resource: ['voice'] } },
|
|
507
|
-
options: [
|
|
508
|
-
{ name: 'Get Many', value: 'list', action: 'Get many voice records' },
|
|
509
|
-
{ name: 'Send Voice Code', value: 'send', action: 'Send a voice verification code' },
|
|
510
|
-
],
|
|
511
|
-
default: 'send',
|
|
512
|
-
},
|
|
513
|
-
{
|
|
514
|
-
displayName: 'To',
|
|
515
|
-
name: 'voiceTo',
|
|
516
|
-
type: 'string',
|
|
517
|
-
required: true,
|
|
518
|
-
default: '',
|
|
519
|
-
placeholder: '+16315551111',
|
|
520
|
-
displayOptions: { show: { resource: ['voice'], operation: ['send'] } },
|
|
521
|
-
description: 'Recipient phone number in E.164 format',
|
|
522
|
-
},
|
|
523
|
-
{
|
|
524
|
-
displayName: 'Verification Code',
|
|
525
|
-
name: 'voiceCode',
|
|
526
|
-
type: 'string',
|
|
527
|
-
required: true,
|
|
528
|
-
default: '',
|
|
529
|
-
placeholder: '123456',
|
|
530
|
-
displayOptions: { show: { resource: ['voice'], operation: ['send'] } },
|
|
531
|
-
description: '4–6 digit verification code to be read aloud',
|
|
532
|
-
},
|
|
533
|
-
{
|
|
534
|
-
displayName: 'Additional Fields',
|
|
535
|
-
name: 'additionalFields',
|
|
536
|
-
type: 'collection',
|
|
537
|
-
placeholder: 'Add Field',
|
|
538
|
-
default: {},
|
|
539
|
-
displayOptions: { show: { resource: ['voice'], operation: ['send'] } },
|
|
540
|
-
options: [
|
|
541
|
-
{ displayName: 'Callback URL', name: 'callbackUrl', type: 'string', default: '' },
|
|
542
|
-
{ displayName: 'External ID', name: 'externalId', type: 'string', default: '' },
|
|
543
|
-
{ displayName: 'Language', name: 'language', type: 'string', default: 'en', description: 'ISO 639 language code' },
|
|
544
|
-
],
|
|
545
|
-
},
|
|
546
|
-
{
|
|
547
|
-
...returnAllField,
|
|
548
|
-
displayOptions: { show: { resource: ['voice'], operation: ['list'] } },
|
|
549
|
-
},
|
|
550
|
-
{
|
|
551
|
-
...limitField,
|
|
552
|
-
displayOptions: { show: { resource: ['voice'], operation: ['list'], returnAll: [false] } },
|
|
553
|
-
},
|
|
554
|
-
// ═══════════════════════════════════════════
|
|
555
|
-
// WEBHOOK ENDPOINT
|
|
556
|
-
// ═══════════════════════════════════════════
|
|
557
|
-
{
|
|
558
|
-
displayName: 'Operation',
|
|
559
|
-
name: 'operation',
|
|
560
|
-
type: 'options',
|
|
561
|
-
noDataExpression: true,
|
|
562
|
-
displayOptions: { show: { resource: ['webhookEndpoint'] } },
|
|
563
|
-
options: [
|
|
564
|
-
{ name: 'Create', value: 'create', action: 'Create a webhook endpoint' },
|
|
565
|
-
{ name: 'Delete', value: 'delete', action: 'Delete a webhook endpoint' },
|
|
566
|
-
{ name: 'Get', value: 'retrieve', action: 'Get a webhook endpoint' },
|
|
567
|
-
{ name: 'Get Many', value: 'list', action: 'Get many webhook endpoints' },
|
|
568
|
-
{ name: 'Rotate Secret', value: 'rotateSecret', action: 'Rotate webhook endpoint secret' },
|
|
569
|
-
{ name: 'Update', value: 'update', action: 'Update a webhook endpoint' },
|
|
570
|
-
],
|
|
571
|
-
default: 'list',
|
|
572
|
-
},
|
|
573
|
-
{
|
|
574
|
-
displayName: 'Webhook Endpoint ID',
|
|
575
|
-
name: 'webhookEndpointId',
|
|
576
|
-
type: 'string',
|
|
577
|
-
required: true,
|
|
578
|
-
default: '',
|
|
579
|
-
displayOptions: { show: { resource: ['webhookEndpoint'], operation: ['retrieve', 'update', 'delete', 'rotateSecret'] } },
|
|
580
|
-
},
|
|
581
|
-
{
|
|
582
|
-
displayName: 'URL',
|
|
583
|
-
name: 'webhookUrl',
|
|
584
|
-
type: 'string',
|
|
585
|
-
required: true,
|
|
586
|
-
default: '',
|
|
587
|
-
placeholder: 'https://example.com/webhook',
|
|
588
|
-
displayOptions: { show: { resource: ['webhookEndpoint'], operation: ['create'] } },
|
|
589
|
-
},
|
|
590
|
-
{
|
|
591
|
-
displayName: 'Enabled Events',
|
|
592
|
-
name: 'webhookEvents',
|
|
593
|
-
type: 'multiOptions',
|
|
594
|
-
required: true,
|
|
595
|
-
default: [],
|
|
596
|
-
displayOptions: { show: { resource: ['webhookEndpoint'], operation: ['create'] } },
|
|
597
|
-
options: [
|
|
598
|
-
{ name: 'Contact: Attributes Changed', value: 'contact.attributes_changed' },
|
|
599
|
-
{ name: 'Contact: Created', value: 'contact.created' },
|
|
600
|
-
{ name: 'Contact: Deleted', value: 'contact.deleted' },
|
|
601
|
-
{ name: 'Contact: Unsubscribe Created', value: 'contact.unsubscribe.created' },
|
|
602
|
-
{ name: 'Contact: Unsubscribe Deleted', value: 'contact.unsubscribe.deleted' },
|
|
603
|
-
{ name: 'Email: Delivery Updated', value: 'email.delivery.updated' },
|
|
604
|
-
{ name: 'SMS: Inbound Received', value: 'sms.inbound.received' },
|
|
605
|
-
{ name: 'SMS: Message Updated', value: 'sms.message.updated' },
|
|
606
|
-
{ name: 'Voice: Message Updated', value: 'voice.message.updated' },
|
|
607
|
-
{ name: 'WhatsApp: Business Account Deleted', value: 'whatsapp.business_account.deleted' },
|
|
608
|
-
{ name: 'WhatsApp: Business Account Reviewed', value: 'whatsapp.business_account.reviewed' },
|
|
609
|
-
{ name: 'WhatsApp: Business Account Updated', value: 'whatsapp.business_account.updated' },
|
|
610
|
-
{ name: 'WhatsApp: Call Connect', value: 'whatsapp.call.connect' },
|
|
611
|
-
{ name: 'WhatsApp: Call Status Updated', value: 'whatsapp.call.status.updated' },
|
|
612
|
-
{ name: 'WhatsApp: Call Terminate', value: 'whatsapp.call.terminate' },
|
|
613
|
-
{ name: 'WhatsApp: Flow Status Change', value: 'whatsapp.flow.status_change' },
|
|
614
|
-
{ name: 'WhatsApp: Inbound Message Received', value: 'whatsapp.inbound_message.received' },
|
|
615
|
-
{ name: 'WhatsApp: Message Updated', value: 'whatsapp.message.updated' },
|
|
616
|
-
{ name: 'WhatsApp: Payment Updated', value: 'whatsapp.payment.updated' },
|
|
617
|
-
{ name: 'WhatsApp: Phone Number Deleted', value: 'whatsapp.phone_number.deleted' },
|
|
618
|
-
{ name: 'WhatsApp: Phone Number Name Updated', value: 'whatsapp.phone_number.name_updated' },
|
|
619
|
-
{ name: 'WhatsApp: Phone Number Quality Updated', value: 'whatsapp.phone_number.quality_updated' },
|
|
620
|
-
{ name: 'WhatsApp: Template Category Updated', value: 'whatsapp.template.category_updated' },
|
|
621
|
-
{ name: 'WhatsApp: Template Quality Updated', value: 'whatsapp.template.quality_updated' },
|
|
622
|
-
{ name: 'WhatsApp: Template Reviewed', value: 'whatsapp.template.reviewed' },
|
|
623
|
-
{ name: 'WhatsApp: User Preferences', value: 'whatsapp.user.preferences' },
|
|
624
|
-
],
|
|
625
|
-
},
|
|
626
|
-
{
|
|
627
|
-
displayName: 'Additional Fields',
|
|
628
|
-
name: 'additionalFields',
|
|
629
|
-
type: 'collection',
|
|
630
|
-
placeholder: 'Add Field',
|
|
631
|
-
default: {},
|
|
632
|
-
displayOptions: { show: { resource: ['webhookEndpoint'], operation: ['create', 'update'] } },
|
|
633
|
-
options: [
|
|
634
|
-
{ displayName: 'Description', name: 'description', type: 'string', default: '' },
|
|
635
|
-
{ displayName: 'Status', name: 'status', type: 'options', default: 'active', options: [{ name: 'Active', value: 'active' }, { name: 'Disabled', value: 'disabled' }] },
|
|
636
|
-
{ displayName: 'URL', name: 'url', type: 'string', default: '', description: 'For update operation' },
|
|
637
|
-
],
|
|
638
|
-
},
|
|
639
|
-
{
|
|
640
|
-
...returnAllField,
|
|
641
|
-
displayOptions: { show: { resource: ['webhookEndpoint'], operation: ['list'] } },
|
|
642
|
-
},
|
|
643
|
-
{
|
|
644
|
-
...limitField,
|
|
645
|
-
displayOptions: { show: { resource: ['webhookEndpoint'], operation: ['list'], returnAll: [false] } },
|
|
646
|
-
},
|
|
647
|
-
// ═══════════════════════════════════════════
|
|
648
|
-
// WHATSAPP BUSINESS ACCOUNT
|
|
649
|
-
// ═══════════════════════════════════════════
|
|
650
|
-
{
|
|
651
|
-
displayName: 'Operation',
|
|
652
|
-
name: 'operation',
|
|
653
|
-
type: 'options',
|
|
654
|
-
noDataExpression: true,
|
|
655
|
-
displayOptions: { show: { resource: ['whatsappBusinessAccount'] } },
|
|
656
|
-
options: [
|
|
657
|
-
{ name: 'Get', value: 'retrieve', action: 'Get a WhatsApp Business Account' },
|
|
658
|
-
{ name: 'Get Many', value: 'list', action: 'Get many WhatsApp Business Accounts' },
|
|
659
|
-
],
|
|
660
|
-
default: 'list',
|
|
661
|
-
},
|
|
662
|
-
{
|
|
663
|
-
displayName: 'WABA ID',
|
|
664
|
-
name: 'wabaId',
|
|
665
|
-
type: 'string',
|
|
666
|
-
required: true,
|
|
667
|
-
default: '',
|
|
668
|
-
displayOptions: { show: { resource: ['whatsappBusinessAccount'], operation: ['retrieve'] } },
|
|
669
|
-
description: 'WhatsApp Business Account ID',
|
|
670
|
-
},
|
|
671
|
-
{
|
|
672
|
-
...returnAllField,
|
|
673
|
-
displayOptions: { show: { resource: ['whatsappBusinessAccount'], operation: ['list'] } },
|
|
674
|
-
},
|
|
675
|
-
{
|
|
676
|
-
...limitField,
|
|
677
|
-
displayOptions: { show: { resource: ['whatsappBusinessAccount'], operation: ['list'], returnAll: [false] } },
|
|
678
|
-
},
|
|
679
|
-
// ═══════════════════════════════════════════
|
|
680
|
-
// WHATSAPP CALLING
|
|
681
|
-
// ═══════════════════════════════════════════
|
|
682
|
-
{
|
|
683
|
-
displayName: 'Operation',
|
|
684
|
-
name: 'operation',
|
|
685
|
-
type: 'options',
|
|
686
|
-
noDataExpression: true,
|
|
687
|
-
displayOptions: { show: { resource: ['whatsappCalling'] } },
|
|
688
|
-
options: [
|
|
689
|
-
{ name: 'Accept Call', value: 'accept', action: 'Accept a WhatsApp call' },
|
|
690
|
-
{ name: 'Connect Call', value: 'connect', action: 'Connect a WhatsApp call' },
|
|
691
|
-
{ name: 'Pre-Accept Call', value: 'preAccept', action: 'Pre-accept a WhatsApp call' },
|
|
692
|
-
{ name: 'Reject Call', value: 'reject', action: 'Reject a WhatsApp call' },
|
|
693
|
-
{ name: 'Terminate Call', value: 'terminate', action: 'Terminate a WhatsApp call' },
|
|
694
|
-
],
|
|
695
|
-
default: 'connect',
|
|
696
|
-
},
|
|
697
|
-
{
|
|
698
|
-
displayName: 'From Phone Number',
|
|
699
|
-
name: 'callingFrom',
|
|
700
|
-
type: 'string',
|
|
701
|
-
required: true,
|
|
702
|
-
default: '',
|
|
703
|
-
placeholder: '+16315551111',
|
|
704
|
-
displayOptions: { show: { resource: ['whatsappCalling'], operation: ['connect'] } },
|
|
705
|
-
description: 'Caller phone number in E.164 format',
|
|
706
|
-
},
|
|
707
|
-
{
|
|
708
|
-
displayName: 'To Phone Number',
|
|
709
|
-
name: 'callingTo',
|
|
710
|
-
type: 'string',
|
|
711
|
-
required: true,
|
|
712
|
-
default: '',
|
|
713
|
-
placeholder: '+16315551112',
|
|
714
|
-
displayOptions: { show: { resource: ['whatsappCalling'], operation: ['connect'] } },
|
|
715
|
-
description: 'Callee phone number in E.164 format',
|
|
716
|
-
},
|
|
717
|
-
{
|
|
718
|
-
displayName: 'SDP Offer',
|
|
719
|
-
name: 'callingSdp',
|
|
720
|
-
type: 'string',
|
|
721
|
-
required: true,
|
|
722
|
-
typeOptions: { rows: 4 },
|
|
723
|
-
default: '',
|
|
724
|
-
displayOptions: { show: { resource: ['whatsappCalling'], operation: ['connect', 'preAccept', 'accept'] } },
|
|
725
|
-
description: 'Session Description Protocol (SDP) for WebRTC connection',
|
|
726
|
-
},
|
|
727
|
-
{
|
|
728
|
-
displayName: 'Phone Number ID',
|
|
729
|
-
name: 'callingPhoneId',
|
|
730
|
-
type: 'string',
|
|
731
|
-
required: true,
|
|
732
|
-
default: '',
|
|
733
|
-
displayOptions: { show: { resource: ['whatsappCalling'], operation: ['preAccept', 'accept', 'terminate', 'reject'] } },
|
|
734
|
-
description: 'WhatsApp Business phone number ID',
|
|
735
|
-
},
|
|
736
|
-
{
|
|
737
|
-
displayName: 'Call ID (WACID)',
|
|
738
|
-
name: 'callingWacid',
|
|
739
|
-
type: 'string',
|
|
740
|
-
required: true,
|
|
741
|
-
default: '',
|
|
742
|
-
displayOptions: { show: { resource: ['whatsappCalling'], operation: ['preAccept', 'accept', 'terminate', 'reject'] } },
|
|
743
|
-
description: 'WhatsApp Call ID received from the webhook',
|
|
744
|
-
},
|
|
745
|
-
// ═══════════════════════════════════════════
|
|
746
|
-
// WHATSAPP FLOW
|
|
747
|
-
// ═══════════════════════════════════════════
|
|
748
|
-
{
|
|
749
|
-
displayName: 'Operation',
|
|
750
|
-
name: 'operation',
|
|
751
|
-
type: 'options',
|
|
752
|
-
noDataExpression: true,
|
|
753
|
-
displayOptions: { show: { resource: ['whatsappFlow'] } },
|
|
754
|
-
options: [
|
|
755
|
-
{ name: 'Create', value: 'create', action: 'Create a WhatsApp flow' },
|
|
756
|
-
{ name: 'Delete', value: 'delete', action: 'Delete a WhatsApp flow' },
|
|
757
|
-
{ name: 'Deprecate', value: 'deprecate', action: 'Deprecate a WhatsApp flow' },
|
|
758
|
-
{ name: 'Get', value: 'retrieve', action: 'Get a WhatsApp flow' },
|
|
759
|
-
{ name: 'Get Many', value: 'list', action: 'Get many WhatsApp flows' },
|
|
760
|
-
{ name: 'Get Preview URL', value: 'preview', action: 'Get flow preview URL' },
|
|
761
|
-
{ name: 'Publish', value: 'publish', action: 'Publish a WhatsApp flow' },
|
|
762
|
-
{ name: 'Update Metadata', value: 'updateMetadata', action: 'Update flow metadata' },
|
|
763
|
-
{ name: 'Update Structure', value: 'updateStructure', action: 'Update flow structure (assets)' },
|
|
764
|
-
],
|
|
765
|
-
default: 'list',
|
|
766
|
-
},
|
|
767
|
-
{
|
|
768
|
-
displayName: 'Flow ID',
|
|
769
|
-
name: 'flowId',
|
|
770
|
-
type: 'string',
|
|
771
|
-
required: true,
|
|
772
|
-
default: '',
|
|
773
|
-
displayOptions: { show: { resource: ['whatsappFlow'], operation: ['retrieve', 'delete', 'publish', 'deprecate', 'preview', 'updateMetadata', 'updateStructure'] } },
|
|
774
|
-
},
|
|
775
|
-
{
|
|
776
|
-
displayName: 'WABA ID',
|
|
777
|
-
name: 'flowWabaId',
|
|
778
|
-
type: 'string',
|
|
779
|
-
required: true,
|
|
780
|
-
default: '',
|
|
781
|
-
displayOptions: { show: { resource: ['whatsappFlow'], operation: ['create'] } },
|
|
782
|
-
description: 'WhatsApp Business Account ID',
|
|
783
|
-
},
|
|
784
|
-
{
|
|
785
|
-
displayName: 'Flow Name',
|
|
786
|
-
name: 'flowName',
|
|
787
|
-
type: 'string',
|
|
788
|
-
required: true,
|
|
789
|
-
default: '',
|
|
790
|
-
displayOptions: { show: { resource: ['whatsappFlow'], operation: ['create'] } },
|
|
791
|
-
},
|
|
792
|
-
{
|
|
793
|
-
displayName: 'Flow Category',
|
|
794
|
-
name: 'flowCategory',
|
|
795
|
-
type: 'options',
|
|
796
|
-
required: true,
|
|
797
|
-
default: 'OTHER',
|
|
798
|
-
displayOptions: { show: { resource: ['whatsappFlow'], operation: ['create'] } },
|
|
799
|
-
options: [
|
|
800
|
-
{ name: 'Appointment Booking', value: 'APPOINTMENT_BOOKING' },
|
|
801
|
-
{ name: 'Contact Us', value: 'CONTACT_US' },
|
|
802
|
-
{ name: 'Customer Support', value: 'CUSTOMER_SUPPORT' },
|
|
803
|
-
{ name: 'Lead Generation', value: 'LEAD_GENERATION' },
|
|
804
|
-
{ name: 'Other', value: 'OTHER' },
|
|
805
|
-
{ name: 'Shopping', value: 'SHOPPING' },
|
|
806
|
-
{ name: 'Sign In', value: 'SIGN_IN' },
|
|
807
|
-
{ name: 'Sign Up', value: 'SIGN_UP' },
|
|
808
|
-
{ name: 'Survey', value: 'SURVEY' },
|
|
809
|
-
],
|
|
810
|
-
},
|
|
811
|
-
{
|
|
812
|
-
displayName: 'Additional Fields',
|
|
813
|
-
name: 'additionalFields',
|
|
814
|
-
type: 'collection',
|
|
815
|
-
placeholder: 'Add Field',
|
|
816
|
-
default: {},
|
|
817
|
-
displayOptions: { show: { resource: ['whatsappFlow'], operation: ['create', 'updateMetadata'] } },
|
|
818
|
-
options: [
|
|
819
|
-
{ displayName: 'Flow Name', name: 'name', type: 'string', default: '', description: 'For update metadata' },
|
|
820
|
-
{ displayName: 'Flow JSON (Assets)', name: 'flowJson', type: 'string', typeOptions: { rows: 6 }, default: '', description: 'WhatsApp Flow JSON structure for create' },
|
|
821
|
-
],
|
|
822
|
-
},
|
|
823
|
-
{
|
|
824
|
-
displayName: 'Flow JSON',
|
|
825
|
-
name: 'flowAssetJson',
|
|
826
|
-
type: 'string',
|
|
827
|
-
required: true,
|
|
828
|
-
typeOptions: { rows: 6 },
|
|
829
|
-
default: '',
|
|
830
|
-
displayOptions: { show: { resource: ['whatsappFlow'], operation: ['updateStructure'] } },
|
|
831
|
-
description: 'The updated WhatsApp Flow JSON structure',
|
|
832
|
-
},
|
|
833
|
-
{
|
|
834
|
-
...returnAllField,
|
|
835
|
-
displayOptions: { show: { resource: ['whatsappFlow'], operation: ['list'] } },
|
|
836
|
-
},
|
|
837
|
-
{
|
|
838
|
-
...limitField,
|
|
839
|
-
displayOptions: { show: { resource: ['whatsappFlow'], operation: ['list'], returnAll: [false] } },
|
|
840
|
-
},
|
|
841
|
-
// ═══════════════════════════════════════════
|
|
842
|
-
// WHATSAPP INBOUND MESSAGE
|
|
843
|
-
// ═══════════════════════════════════════════
|
|
844
|
-
{
|
|
845
|
-
displayName: 'Operation',
|
|
846
|
-
name: 'operation',
|
|
847
|
-
type: 'options',
|
|
848
|
-
noDataExpression: true,
|
|
849
|
-
displayOptions: { show: { resource: ['whatsappInboundMessage'] } },
|
|
850
|
-
options: [
|
|
851
|
-
{ name: 'Mark as Read', value: 'markAsRead', action: 'Mark a message as read' },
|
|
852
|
-
{ name: 'Show Typing Indicator', value: 'typingIndicator', action: 'Mark as read and show typing indicator' },
|
|
853
|
-
],
|
|
854
|
-
default: 'markAsRead',
|
|
855
|
-
},
|
|
856
|
-
{
|
|
857
|
-
displayName: 'Message ID',
|
|
858
|
-
name: 'inboundMessageId',
|
|
859
|
-
type: 'string',
|
|
860
|
-
required: true,
|
|
861
|
-
default: '',
|
|
862
|
-
placeholder: 'wamid.xxx',
|
|
863
|
-
displayOptions: { show: { resource: ['whatsappInboundMessage'] } },
|
|
864
|
-
description: 'The ID of the inbound message',
|
|
865
|
-
},
|
|
866
|
-
// ═══════════════════════════════════════════
|
|
867
|
-
// WHATSAPP MEDIA
|
|
868
|
-
// ═══════════════════════════════════════════
|
|
869
|
-
{
|
|
870
|
-
displayName: 'Operation',
|
|
871
|
-
name: 'operation',
|
|
872
|
-
type: 'options',
|
|
873
|
-
noDataExpression: true,
|
|
874
|
-
displayOptions: { show: { resource: ['whatsappMedia'] } },
|
|
875
|
-
options: [{ name: 'Upload', value: 'upload', action: 'Upload media file' }],
|
|
876
|
-
default: 'upload',
|
|
877
|
-
},
|
|
878
|
-
{
|
|
879
|
-
displayName: 'Phone Number',
|
|
880
|
-
name: 'mediaPhoneNumber',
|
|
881
|
-
type: 'string',
|
|
882
|
-
required: true,
|
|
883
|
-
default: '',
|
|
884
|
-
placeholder: '+16315551111',
|
|
885
|
-
displayOptions: { show: { resource: ['whatsappMedia'], operation: ['upload'] } },
|
|
886
|
-
description: 'Sender phone number in E.164 format',
|
|
887
|
-
},
|
|
888
|
-
{
|
|
889
|
-
displayName: 'Input Binary Field',
|
|
890
|
-
name: 'binaryProperty',
|
|
891
|
-
type: 'string',
|
|
892
|
-
required: true,
|
|
893
|
-
default: 'data',
|
|
894
|
-
displayOptions: { show: { resource: ['whatsappMedia'], operation: ['upload'] } },
|
|
895
|
-
description: 'Name of the binary input field containing the file',
|
|
896
|
-
},
|
|
897
|
-
// ═══════════════════════════════════════════
|
|
898
|
-
// WHATSAPP MESSAGE
|
|
899
|
-
// ═══════════════════════════════════════════
|
|
900
|
-
{
|
|
901
|
-
displayName: 'Operation',
|
|
902
|
-
name: 'operation',
|
|
903
|
-
type: 'options',
|
|
904
|
-
noDataExpression: true,
|
|
905
|
-
displayOptions: { show: { resource: ['whatsappMessage'] } },
|
|
906
|
-
options: [
|
|
907
|
-
{ name: 'Enqueue (Async)', value: 'send', action: 'Enqueue a WhatsApp message for async sending' },
|
|
908
|
-
{ name: 'Retrieve', value: 'retrieve', action: 'Retrieve a sent WhatsApp message' },
|
|
909
|
-
{ name: 'Send Directly (Sync)', value: 'sendDirectly', action: 'Send a WhatsApp message directly (synchronous)' },
|
|
910
|
-
],
|
|
911
|
-
default: 'sendDirectly',
|
|
912
|
-
},
|
|
913
|
-
{
|
|
914
|
-
displayName: 'From Phone Number',
|
|
915
|
-
name: 'waFrom',
|
|
916
|
-
type: 'resourceLocator',
|
|
917
|
-
default: { mode: 'list', value: '' },
|
|
918
|
-
required: true,
|
|
919
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'] } },
|
|
920
|
-
description: 'Your WhatsApp Business number registered in YCloud',
|
|
921
|
-
modes: [
|
|
922
|
-
{
|
|
923
|
-
displayName: 'From List',
|
|
924
|
-
name: 'list',
|
|
925
|
-
type: 'list',
|
|
926
|
-
typeOptions: { searchListMethod: 'getWhatsAppPhoneNumbers', searchable: true },
|
|
927
|
-
},
|
|
928
|
-
{
|
|
929
|
-
displayName: 'Enter Number',
|
|
930
|
-
name: 'id',
|
|
931
|
-
type: 'string',
|
|
932
|
-
placeholder: '+16315551111',
|
|
933
|
-
},
|
|
934
|
-
],
|
|
935
|
-
},
|
|
936
|
-
{
|
|
937
|
-
displayName: 'To Phone Number',
|
|
938
|
-
name: 'waTo',
|
|
939
|
-
type: 'resourceLocator',
|
|
940
|
-
default: { mode: 'id', value: '' },
|
|
941
|
-
required: true,
|
|
942
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'] } },
|
|
943
|
-
description: 'Recipient phone number',
|
|
944
|
-
modes: [
|
|
945
|
-
{
|
|
946
|
-
displayName: 'From Contacts',
|
|
947
|
-
name: 'list',
|
|
948
|
-
type: 'list',
|
|
949
|
-
typeOptions: { searchListMethod: 'getContacts', searchable: true },
|
|
950
|
-
},
|
|
951
|
-
{
|
|
952
|
-
displayName: 'Enter Number',
|
|
953
|
-
name: 'id',
|
|
954
|
-
type: 'string',
|
|
955
|
-
placeholder: '+16315551112',
|
|
956
|
-
},
|
|
957
|
-
],
|
|
958
|
-
},
|
|
959
|
-
{
|
|
960
|
-
displayName: 'Message Type',
|
|
961
|
-
name: 'messageType',
|
|
962
|
-
type: 'options',
|
|
963
|
-
required: true,
|
|
964
|
-
default: 'text',
|
|
965
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'] } },
|
|
966
|
-
options: [
|
|
967
|
-
{ name: 'Audio', value: 'audio' },
|
|
968
|
-
{ name: 'Contacts', value: 'contacts' },
|
|
969
|
-
{ name: 'Document', value: 'document' },
|
|
970
|
-
{ name: 'Image', value: 'image' },
|
|
971
|
-
{ name: 'Interactive', value: 'interactive' },
|
|
972
|
-
{ name: 'Location', value: 'location' },
|
|
973
|
-
{ name: 'Reaction', value: 'reaction' },
|
|
974
|
-
{ name: 'Sticker', value: 'sticker' },
|
|
975
|
-
{ name: 'Template', value: 'template' },
|
|
976
|
-
{ name: 'Text', value: 'text' },
|
|
977
|
-
{ name: 'Video', value: 'video' },
|
|
978
|
-
],
|
|
979
|
-
},
|
|
980
|
-
// Text fields
|
|
981
|
-
{
|
|
982
|
-
displayName: 'Text',
|
|
983
|
-
name: 'textBody',
|
|
984
|
-
type: 'string',
|
|
985
|
-
required: true,
|
|
986
|
-
typeOptions: { rows: 4 },
|
|
987
|
-
default: '',
|
|
988
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'], messageType: ['text'] } },
|
|
989
|
-
description: 'Message text. Max 4096 characters. Supports WhatsApp formatting.',
|
|
990
|
-
},
|
|
991
|
-
{
|
|
992
|
-
displayName: 'Preview URL',
|
|
993
|
-
name: 'textPreviewUrl',
|
|
994
|
-
type: 'boolean',
|
|
995
|
-
default: false,
|
|
996
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'], messageType: ['text'] } },
|
|
997
|
-
description: 'Whether to generate a link preview',
|
|
998
|
-
},
|
|
999
|
-
// Template fields
|
|
1000
|
-
{
|
|
1001
|
-
displayName: 'Template Name',
|
|
1002
|
-
name: 'templateName',
|
|
1003
|
-
type: 'string',
|
|
1004
|
-
required: true,
|
|
1005
|
-
default: '',
|
|
1006
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'], messageType: ['template'] } },
|
|
1007
|
-
},
|
|
1008
|
-
{
|
|
1009
|
-
displayName: 'Template Language Code',
|
|
1010
|
-
name: 'templateLanguage',
|
|
1011
|
-
type: 'string',
|
|
1012
|
-
required: true,
|
|
1013
|
-
default: 'en',
|
|
1014
|
-
placeholder: 'en, pt_BR, es, etc.',
|
|
1015
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'], messageType: ['template'] } },
|
|
1016
|
-
},
|
|
1017
|
-
{
|
|
1018
|
-
displayName: 'Template Components (JSON)',
|
|
1019
|
-
name: 'templateComponents',
|
|
1020
|
-
type: 'string',
|
|
1021
|
-
typeOptions: { rows: 6 },
|
|
1022
|
-
default: '',
|
|
1023
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'], messageType: ['template'] } },
|
|
1024
|
-
description: 'Array of component objects for variables/media. Leave empty if template has no variables. E.g.: [{"type":"body","parameters":[{"type":"text","text":"John"}]}]',
|
|
1025
|
-
},
|
|
1026
|
-
// Media fields
|
|
1027
|
-
{
|
|
1028
|
-
displayName: 'Media ID or URL',
|
|
1029
|
-
name: 'mediaIdOrLink',
|
|
1030
|
-
type: 'string',
|
|
1031
|
-
required: true,
|
|
1032
|
-
default: '',
|
|
1033
|
-
placeholder: 'https://example.com/image.jpg or media-id-from-upload',
|
|
1034
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'], messageType: ['image', 'video', 'audio', 'document', 'sticker'] } },
|
|
1035
|
-
description: 'Either a URL (link) or a media ID obtained from Upload Media',
|
|
1036
|
-
},
|
|
1037
|
-
{
|
|
1038
|
-
displayName: 'Caption',
|
|
1039
|
-
name: 'mediaCaption',
|
|
1040
|
-
type: 'string',
|
|
1041
|
-
default: '',
|
|
1042
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'], messageType: ['image', 'video', 'document'] } },
|
|
1043
|
-
},
|
|
1044
|
-
{
|
|
1045
|
-
displayName: 'Filename',
|
|
1046
|
-
name: 'documentFilename',
|
|
1047
|
-
type: 'string',
|
|
1048
|
-
default: '',
|
|
1049
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'], messageType: ['document'] } },
|
|
1050
|
-
description: 'Document filename shown to recipient, e.g. report.pdf',
|
|
1051
|
-
},
|
|
1052
|
-
// Location fields
|
|
1053
|
-
{
|
|
1054
|
-
displayName: 'Latitude',
|
|
1055
|
-
name: 'locationLatitude',
|
|
1056
|
-
type: 'number',
|
|
1057
|
-
required: true,
|
|
1058
|
-
default: 0,
|
|
1059
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'], messageType: ['location'] } },
|
|
1060
|
-
},
|
|
1061
|
-
{
|
|
1062
|
-
displayName: 'Longitude',
|
|
1063
|
-
name: 'locationLongitude',
|
|
1064
|
-
type: 'number',
|
|
1065
|
-
required: true,
|
|
1066
|
-
default: 0,
|
|
1067
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'], messageType: ['location'] } },
|
|
1068
|
-
},
|
|
1069
|
-
{
|
|
1070
|
-
displayName: 'Location Name',
|
|
1071
|
-
name: 'locationName',
|
|
1072
|
-
type: 'string',
|
|
1073
|
-
default: '',
|
|
1074
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'], messageType: ['location'] } },
|
|
1075
|
-
},
|
|
1076
|
-
{
|
|
1077
|
-
displayName: 'Location Address',
|
|
1078
|
-
name: 'locationAddress',
|
|
1079
|
-
type: 'string',
|
|
1080
|
-
default: '',
|
|
1081
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'], messageType: ['location'] } },
|
|
1082
|
-
},
|
|
1083
|
-
// Interactive
|
|
1084
|
-
{
|
|
1085
|
-
displayName: 'Interactive (JSON)',
|
|
1086
|
-
name: 'interactiveJSON',
|
|
1087
|
-
type: 'string',
|
|
1088
|
-
required: true,
|
|
1089
|
-
typeOptions: { rows: 8 },
|
|
1090
|
-
default: '{\n "type": "button",\n "body": { "text": "Hello! Choose an option:" },\n "action": {\n "buttons": [\n { "type": "reply", "reply": { "id": "yes", "title": "Yes" } },\n { "type": "reply", "reply": { "id": "no", "title": "No" } }\n ]\n }\n}',
|
|
1091
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'], messageType: ['interactive'] } },
|
|
1092
|
-
description: 'The "interactive" object for the WhatsApp message. See YCloud docs for structure.',
|
|
1093
|
-
},
|
|
1094
|
-
// Reaction
|
|
1095
|
-
{
|
|
1096
|
-
displayName: 'Message ID to React To',
|
|
1097
|
-
name: 'reactionMessageId',
|
|
1098
|
-
type: 'string',
|
|
1099
|
-
required: true,
|
|
1100
|
-
default: '',
|
|
1101
|
-
placeholder: 'wamid.xxx',
|
|
1102
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'], messageType: ['reaction'] } },
|
|
1103
|
-
},
|
|
1104
|
-
{
|
|
1105
|
-
displayName: 'Emoji',
|
|
1106
|
-
name: 'reactionEmoji',
|
|
1107
|
-
type: 'string',
|
|
1108
|
-
default: '',
|
|
1109
|
-
placeholder: '👍',
|
|
1110
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'], messageType: ['reaction'] } },
|
|
1111
|
-
description: 'Emoji to react with. Leave empty to remove an existing reaction.',
|
|
1112
|
-
},
|
|
1113
|
-
// Contacts
|
|
1114
|
-
{
|
|
1115
|
-
displayName: 'Contacts (JSON)',
|
|
1116
|
-
name: 'contactsJSON',
|
|
1117
|
-
type: 'string',
|
|
1118
|
-
required: true,
|
|
1119
|
-
typeOptions: { rows: 6 },
|
|
1120
|
-
default: '[{"name":{"first_name":"John","last_name":"Doe"},"phones":[{"phone":"+1234567890","type":"MOBILE"}]}]',
|
|
1121
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'], messageType: ['contacts'] } },
|
|
1122
|
-
description: 'Array of contact card objects',
|
|
1123
|
-
},
|
|
1124
|
-
// Retrieve
|
|
1125
|
-
{
|
|
1126
|
-
displayName: 'Message ID',
|
|
1127
|
-
name: 'waMessageId',
|
|
1128
|
-
type: 'string',
|
|
1129
|
-
required: true,
|
|
1130
|
-
default: '',
|
|
1131
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['retrieve'] } },
|
|
1132
|
-
},
|
|
1133
|
-
// Additional options (send/sendDirectly)
|
|
1134
|
-
{
|
|
1135
|
-
displayName: 'Additional Fields',
|
|
1136
|
-
name: 'additionalFields',
|
|
1137
|
-
type: 'collection',
|
|
1138
|
-
placeholder: 'Add Field',
|
|
1139
|
-
default: {},
|
|
1140
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'] } },
|
|
1141
|
-
options: [
|
|
1142
|
-
{ displayName: 'Context Message ID (Reply To)', name: 'contextMessageId', type: 'string', default: '' },
|
|
1143
|
-
{ displayName: 'External ID', name: 'externalId', type: 'string', default: '' },
|
|
1144
|
-
{ displayName: 'Filter Unsubscribed', name: 'filterUnsubscribed', type: 'boolean', default: false, description: 'Skip sending if the recipient has unsubscribed' },
|
|
1145
|
-
],
|
|
1146
|
-
},
|
|
1147
|
-
// ═══════════════════════════════════════════
|
|
1148
|
-
// WHATSAPP PHONE NUMBER
|
|
1149
|
-
// ═══════════════════════════════════════════
|
|
1150
|
-
{
|
|
1151
|
-
displayName: 'Operation',
|
|
1152
|
-
name: 'operation',
|
|
1153
|
-
type: 'options',
|
|
1154
|
-
noDataExpression: true,
|
|
1155
|
-
displayOptions: { show: { resource: ['whatsappPhoneNumber'] } },
|
|
1156
|
-
options: [
|
|
1157
|
-
{ name: 'Get', value: 'retrieve', action: 'Get a phone number' },
|
|
1158
|
-
{ name: 'Get Commerce Settings', value: 'retrieveCommerceSettings', action: 'Get commerce settings' },
|
|
1159
|
-
{ name: 'Get Many', value: 'list', action: 'Get many phone numbers' },
|
|
1160
|
-
{ name: 'Get Profile', value: 'retrieveProfile', action: 'Get phone number profile' },
|
|
1161
|
-
{ name: 'Get Settings', value: 'retrieveSettings', action: 'Get phone number settings' },
|
|
1162
|
-
{ name: 'Register', value: 'register', action: 'Register a phone number' },
|
|
1163
|
-
{ name: 'Save Settings', value: 'saveSettings', action: 'Save phone number settings' },
|
|
1164
|
-
{ name: 'Update Commerce Settings', value: 'updateCommerceSettings', action: 'Update commerce settings' },
|
|
1165
|
-
{ name: 'Update Display Name', value: 'updateDisplayName', action: 'Update display name' },
|
|
1166
|
-
{ name: 'Update Profile', value: 'updateProfile', action: 'Update phone number profile' },
|
|
1167
|
-
],
|
|
1168
|
-
default: 'list',
|
|
1169
|
-
},
|
|
1170
|
-
{
|
|
1171
|
-
displayName: 'WABA ID',
|
|
1172
|
-
name: 'phoneWabaId',
|
|
1173
|
-
type: 'string',
|
|
1174
|
-
required: true,
|
|
1175
|
-
default: '',
|
|
1176
|
-
displayOptions: { show: { resource: ['whatsappPhoneNumber'], operation: ['retrieve', 'retrieveProfile', 'updateProfile', 'updateDisplayName', 'retrieveCommerceSettings', 'updateCommerceSettings', 'register', 'retrieveSettings', 'saveSettings'] } },
|
|
1177
|
-
description: 'WhatsApp Business Account ID',
|
|
1178
|
-
},
|
|
1179
|
-
{
|
|
1180
|
-
displayName: 'Phone Number',
|
|
1181
|
-
name: 'phoneNumberParam',
|
|
1182
|
-
type: 'string',
|
|
1183
|
-
required: true,
|
|
1184
|
-
default: '',
|
|
1185
|
-
placeholder: '+16315551111',
|
|
1186
|
-
displayOptions: { show: { resource: ['whatsappPhoneNumber'], operation: ['retrieve', 'retrieveProfile', 'updateProfile', 'updateDisplayName', 'retrieveCommerceSettings', 'updateCommerceSettings', 'register', 'retrieveSettings', 'saveSettings'] } },
|
|
1187
|
-
},
|
|
1188
|
-
{
|
|
1189
|
-
displayName: 'Display Name',
|
|
1190
|
-
name: 'phoneDisplayName',
|
|
1191
|
-
type: 'string',
|
|
1192
|
-
required: true,
|
|
1193
|
-
default: '',
|
|
1194
|
-
displayOptions: { show: { resource: ['whatsappPhoneNumber'], operation: ['updateDisplayName'] } },
|
|
1195
|
-
},
|
|
1196
|
-
{
|
|
1197
|
-
displayName: 'Profile Fields',
|
|
1198
|
-
name: 'profileFields',
|
|
1199
|
-
type: 'collection',
|
|
1200
|
-
placeholder: 'Add Field',
|
|
1201
|
-
default: {},
|
|
1202
|
-
displayOptions: { show: { resource: ['whatsappPhoneNumber'], operation: ['updateProfile'] } },
|
|
1203
|
-
options: [
|
|
1204
|
-
{ displayName: 'About', name: 'about', type: 'string', default: '' },
|
|
1205
|
-
{ displayName: 'Address', name: 'address', type: 'string', default: '' },
|
|
1206
|
-
{ displayName: 'Description', name: 'description', type: 'string', default: '' },
|
|
1207
|
-
{ displayName: 'Email', name: 'email', type: 'string', default: '' },
|
|
1208
|
-
{ displayName: 'Profile Picture URL', name: 'profilePictureUrl', type: 'string', default: '' },
|
|
1209
|
-
{ displayName: 'Vertical', name: 'vertical', type: 'string', default: '', description: 'Business industry vertical' },
|
|
1210
|
-
{ displayName: 'Website 1', name: 'websites1', type: 'string', default: '' },
|
|
1211
|
-
{ displayName: 'Website 2', name: 'websites2', type: 'string', default: '' },
|
|
1212
|
-
],
|
|
1213
|
-
},
|
|
1214
|
-
{
|
|
1215
|
-
displayName: 'Commerce Settings (JSON)',
|
|
1216
|
-
name: 'commerceSettingsJson',
|
|
1217
|
-
type: 'string',
|
|
1218
|
-
typeOptions: { rows: 4 },
|
|
1219
|
-
default: '',
|
|
1220
|
-
displayOptions: { show: { resource: ['whatsappPhoneNumber'], operation: ['updateCommerceSettings'] } },
|
|
1221
|
-
description: 'Commerce settings JSON object',
|
|
1222
|
-
},
|
|
1223
|
-
{
|
|
1224
|
-
displayName: 'Settings (JSON)',
|
|
1225
|
-
name: 'phoneSettingsJson',
|
|
1226
|
-
type: 'string',
|
|
1227
|
-
typeOptions: { rows: 4 },
|
|
1228
|
-
default: '',
|
|
1229
|
-
displayOptions: { show: { resource: ['whatsappPhoneNumber'], operation: ['saveSettings'] } },
|
|
1230
|
-
description: 'Phone number settings JSON object',
|
|
1231
|
-
},
|
|
1232
|
-
{
|
|
1233
|
-
...returnAllField,
|
|
1234
|
-
displayOptions: { show: { resource: ['whatsappPhoneNumber'], operation: ['list'] } },
|
|
1235
|
-
},
|
|
1236
|
-
{
|
|
1237
|
-
...limitField,
|
|
1238
|
-
displayOptions: { show: { resource: ['whatsappPhoneNumber'], operation: ['list'], returnAll: [false] } },
|
|
1239
|
-
},
|
|
1240
|
-
// ═══════════════════════════════════════════
|
|
1241
|
-
// WHATSAPP TEMPLATE
|
|
1242
|
-
// ═══════════════════════════════════════════
|
|
1243
|
-
{
|
|
1244
|
-
displayName: 'Operation',
|
|
1245
|
-
name: 'operation',
|
|
1246
|
-
type: 'options',
|
|
1247
|
-
noDataExpression: true,
|
|
1248
|
-
displayOptions: { show: { resource: ['whatsappTemplate'] } },
|
|
1249
|
-
options: [
|
|
1250
|
-
{ name: 'Create', value: 'create', action: 'Create a WhatsApp template' },
|
|
1251
|
-
{ name: 'Delete by Name', value: 'deleteByName', action: 'Delete all templates with a name' },
|
|
1252
|
-
{ name: 'Delete by Name and Language', value: 'deleteByNameAndLanguage', action: 'Delete a specific template' },
|
|
1253
|
-
{ name: 'Edit', value: 'edit', action: 'Edit a WhatsApp template' },
|
|
1254
|
-
{ name: 'Get', value: 'retrieve', action: 'Get a WhatsApp template' },
|
|
1255
|
-
{ name: 'Get Many', value: 'list', action: 'Get many WhatsApp templates' },
|
|
1256
|
-
],
|
|
1257
|
-
default: 'list',
|
|
1258
|
-
},
|
|
1259
|
-
{
|
|
1260
|
-
displayName: 'WABA ID',
|
|
1261
|
-
name: 'templateWabaId',
|
|
1262
|
-
type: 'string',
|
|
1263
|
-
required: true,
|
|
1264
|
-
default: '',
|
|
1265
|
-
displayOptions: { show: { resource: ['whatsappTemplate'], operation: ['create', 'deleteByName', 'deleteByNameAndLanguage', 'edit', 'retrieve'] } },
|
|
1266
|
-
description: 'WhatsApp Business Account ID',
|
|
1267
|
-
},
|
|
1268
|
-
{
|
|
1269
|
-
displayName: 'Template Name',
|
|
1270
|
-
name: 'templateCreateName',
|
|
1271
|
-
type: 'string',
|
|
1272
|
-
required: true,
|
|
1273
|
-
default: '',
|
|
1274
|
-
placeholder: 'order_confirmation',
|
|
1275
|
-
displayOptions: { show: { resource: ['whatsappTemplate'], operation: ['create', 'deleteByName', 'deleteByNameAndLanguage', 'edit', 'retrieve'] } },
|
|
1276
|
-
description: 'Lowercase letters, numbers and underscores only',
|
|
1277
|
-
},
|
|
1278
|
-
{
|
|
1279
|
-
displayName: 'Language',
|
|
1280
|
-
name: 'templateCreateLanguage',
|
|
1281
|
-
type: 'string',
|
|
1282
|
-
required: true,
|
|
1283
|
-
default: 'en',
|
|
1284
|
-
placeholder: 'en, pt_BR, es',
|
|
1285
|
-
displayOptions: { show: { resource: ['whatsappTemplate'], operation: ['create', 'deleteByNameAndLanguage', 'edit', 'retrieve'] } },
|
|
1286
|
-
},
|
|
1287
|
-
{
|
|
1288
|
-
displayName: 'Category',
|
|
1289
|
-
name: 'templateCategory',
|
|
1290
|
-
type: 'options',
|
|
1291
|
-
required: true,
|
|
1292
|
-
default: 'UTILITY',
|
|
1293
|
-
displayOptions: { show: { resource: ['whatsappTemplate'], operation: ['create'] } },
|
|
1294
|
-
options: [
|
|
1295
|
-
{ name: 'Authentication', value: 'AUTHENTICATION' },
|
|
1296
|
-
{ name: 'Marketing', value: 'MARKETING' },
|
|
1297
|
-
{ name: 'Utility', value: 'UTILITY' },
|
|
1298
|
-
],
|
|
1299
|
-
},
|
|
1300
|
-
{
|
|
1301
|
-
displayName: 'Components (JSON)',
|
|
1302
|
-
name: 'templateComponentsJson',
|
|
1303
|
-
type: 'string',
|
|
1304
|
-
required: true,
|
|
1305
|
-
typeOptions: { rows: 10 },
|
|
1306
|
-
default: '[{"type":"BODY","text":"Hello {{1}}, your order {{2}} is confirmed."}]',
|
|
1307
|
-
displayOptions: { show: { resource: ['whatsappTemplate'], operation: ['create', 'edit'] } },
|
|
1308
|
-
description: 'Array of template component objects (HEADER, BODY, FOOTER, BUTTONS). See Meta / YCloud docs.',
|
|
1309
|
-
},
|
|
1310
|
-
{
|
|
1311
|
-
...returnAllField,
|
|
1312
|
-
displayOptions: { show: { resource: ['whatsappTemplate'], operation: ['list'] } },
|
|
1313
|
-
},
|
|
1314
|
-
{
|
|
1315
|
-
...limitField,
|
|
1316
|
-
displayOptions: { show: { resource: ['whatsappTemplate'], operation: ['list'], returnAll: [false] } },
|
|
1317
|
-
},
|
|
1318
|
-
{
|
|
1319
|
-
displayName: 'Filters',
|
|
1320
|
-
name: 'filters',
|
|
1321
|
-
type: 'collection',
|
|
1322
|
-
placeholder: 'Add Filter',
|
|
1323
|
-
default: {},
|
|
1324
|
-
displayOptions: { show: { resource: ['whatsappTemplate'], operation: ['list'] } },
|
|
1325
|
-
options: [
|
|
1326
|
-
{ displayName: 'WABA ID', name: 'wabaId', type: 'string', default: '' },
|
|
1327
|
-
],
|
|
1328
|
-
},
|
|
1329
|
-
];
|
|
1330
|
-
// ─── Main Node ────────────────────────────────────────────────────────────────
|
|
38
|
+
const descriptions_1 = require("./descriptions");
|
|
39
|
+
const methods_1 = require("./methods");
|
|
40
|
+
const actions = __importStar(require("./actions"));
|
|
1331
41
|
class YCloud {
|
|
1332
42
|
constructor() {
|
|
1333
43
|
this.description = {
|
|
@@ -1342,782 +52,41 @@ class YCloud {
|
|
|
1342
52
|
inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
1343
53
|
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
1344
54
|
credentials: [{ name: 'yCloudApi', required: true }],
|
|
1345
|
-
properties,
|
|
1346
|
-
};
|
|
1347
|
-
this.methods = {
|
|
1348
|
-
listSearch: {
|
|
1349
|
-
async getWhatsAppPhoneNumbers(filter) {
|
|
1350
|
-
const response = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', '/whatsapp/phoneNumbers');
|
|
1351
|
-
const items = (response.items || []);
|
|
1352
|
-
const results = items
|
|
1353
|
-
.filter((n) => {
|
|
1354
|
-
var _a, _b;
|
|
1355
|
-
return !filter ||
|
|
1356
|
-
((_a = n.displayPhoneNumber) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(filter.toLowerCase())) ||
|
|
1357
|
-
((_b = n.verifiedName) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(filter.toLowerCase()));
|
|
1358
|
-
})
|
|
1359
|
-
.map((n) => ({
|
|
1360
|
-
name: `${n.displayPhoneNumber || n.phoneNumber} — ${n.verifiedName || n.id}`,
|
|
1361
|
-
value: n.phoneNumber,
|
|
1362
|
-
}));
|
|
1363
|
-
return { results };
|
|
1364
|
-
},
|
|
1365
|
-
async getContacts(filter) {
|
|
1366
|
-
const response = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', '/contacts', undefined, {
|
|
1367
|
-
limit: 100,
|
|
1368
|
-
});
|
|
1369
|
-
const items = (response.items || []);
|
|
1370
|
-
const results = items
|
|
1371
|
-
.filter((c) => {
|
|
1372
|
-
var _a, _b;
|
|
1373
|
-
return !filter ||
|
|
1374
|
-
((_a = c.nickname) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(filter.toLowerCase())) ||
|
|
1375
|
-
((_b = c.phoneNumber) === null || _b === void 0 ? void 0 : _b.includes(filter));
|
|
1376
|
-
})
|
|
1377
|
-
.map((c) => ({
|
|
1378
|
-
name: `${c.nickname || c.phoneNumber} — ${c.phoneNumber}`,
|
|
1379
|
-
value: c.phoneNumber,
|
|
1380
|
-
}));
|
|
1381
|
-
return { results };
|
|
1382
|
-
},
|
|
1383
|
-
},
|
|
55
|
+
properties: descriptions_1.properties,
|
|
1384
56
|
};
|
|
57
|
+
this.methods = methods_1.methods;
|
|
1385
58
|
}
|
|
1386
59
|
async execute() {
|
|
1387
60
|
const items = this.getInputData();
|
|
1388
61
|
const returnData = [];
|
|
1389
62
|
const resource = this.getNodeParameter('resource', 0);
|
|
1390
63
|
const operation = this.getNodeParameter('operation', 0);
|
|
64
|
+
const resourceMap = {
|
|
65
|
+
balance: actions.balance,
|
|
66
|
+
contact: actions.contact,
|
|
67
|
+
customEvent: actions.customEvent,
|
|
68
|
+
email: actions.email,
|
|
69
|
+
sms: actions.sms,
|
|
70
|
+
unsubscriber: actions.unsubscriber,
|
|
71
|
+
verification: actions.verification,
|
|
72
|
+
voice: actions.voice,
|
|
73
|
+
webhookEndpoint: actions.webhookEndpoint,
|
|
74
|
+
whatsappBusinessAccount: actions.whatsappBusinessAccount,
|
|
75
|
+
whatsappCalling: actions.whatsappCalling,
|
|
76
|
+
whatsappFlow: actions.whatsappFlow,
|
|
77
|
+
whatsappInboundMessage: actions.whatsappInboundMessage,
|
|
78
|
+
whatsappMedia: actions.whatsappMedia,
|
|
79
|
+
whatsappMessage: actions.whatsappMessage,
|
|
80
|
+
whatsappPhoneNumber: actions.whatsappPhoneNumber,
|
|
81
|
+
whatsappTemplate: actions.whatsappTemplate,
|
|
82
|
+
};
|
|
83
|
+
const handler = resourceMap[resource];
|
|
84
|
+
if (!handler) {
|
|
85
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown resource: ${resource}`);
|
|
86
|
+
}
|
|
1391
87
|
for (let i = 0; i < items.length; i++) {
|
|
1392
88
|
try {
|
|
1393
|
-
|
|
1394
|
-
// ─── BALANCE ───────────────────────────────
|
|
1395
|
-
if (resource === 'balance') {
|
|
1396
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', '/balance');
|
|
1397
|
-
}
|
|
1398
|
-
// ─── CONTACT ───────────────────────────────
|
|
1399
|
-
else if (resource === 'contact') {
|
|
1400
|
-
if (operation === 'create') {
|
|
1401
|
-
const phoneNumber = this.getNodeParameter('phoneNumber', i);
|
|
1402
|
-
const af = this.getNodeParameter('additionalFields', i);
|
|
1403
|
-
const body = { phoneNumber };
|
|
1404
|
-
if (af.nickname)
|
|
1405
|
-
body.nickname = af.nickname;
|
|
1406
|
-
if (af.countryCode)
|
|
1407
|
-
body.countryCode = af.countryCode;
|
|
1408
|
-
if (af.email)
|
|
1409
|
-
body.email = af.email;
|
|
1410
|
-
if (af.ownerEmail)
|
|
1411
|
-
body.ownerEmail = af.ownerEmail;
|
|
1412
|
-
if (af.tags)
|
|
1413
|
-
body.tags = af.tags.split(',').map((t) => t.trim()).filter(Boolean);
|
|
1414
|
-
if (af.customAttributes)
|
|
1415
|
-
body.customAttributes = JSON.parse(af.customAttributes);
|
|
1416
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/contact/contacts', body);
|
|
1417
|
-
}
|
|
1418
|
-
else if (operation === 'list') {
|
|
1419
|
-
const returnAll = this.getNodeParameter('returnAll', i);
|
|
1420
|
-
if (returnAll) {
|
|
1421
|
-
responseData = await GenericFunctions_1.ycloudApiRequestAllItems.call(this, 'GET', '/contact/contacts');
|
|
1422
|
-
}
|
|
1423
|
-
else {
|
|
1424
|
-
const limit = this.getNodeParameter('limit', i);
|
|
1425
|
-
const resp = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', '/contact/contacts', {}, { limit });
|
|
1426
|
-
responseData = resp.items || [];
|
|
1427
|
-
}
|
|
1428
|
-
}
|
|
1429
|
-
else if (operation === 'retrieve') {
|
|
1430
|
-
const id = this.getNodeParameter('contactId', i, '', { extractValue: true });
|
|
1431
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `/contact/contacts/${id}`);
|
|
1432
|
-
}
|
|
1433
|
-
else if (operation === 'update') {
|
|
1434
|
-
const id = this.getNodeParameter('contactId', i, '', { extractValue: true });
|
|
1435
|
-
const af = this.getNodeParameter('additionalFields', i);
|
|
1436
|
-
const body = {};
|
|
1437
|
-
if (af.phoneNumber)
|
|
1438
|
-
body.phoneNumber = af.phoneNumber;
|
|
1439
|
-
if (af.nickname)
|
|
1440
|
-
body.nickname = af.nickname;
|
|
1441
|
-
if (af.countryCode)
|
|
1442
|
-
body.countryCode = af.countryCode;
|
|
1443
|
-
if (af.email)
|
|
1444
|
-
body.email = af.email;
|
|
1445
|
-
if (af.ownerEmail)
|
|
1446
|
-
body.ownerEmail = af.ownerEmail;
|
|
1447
|
-
if (af.tags)
|
|
1448
|
-
body.tags = af.tags.split(',').map((t) => t.trim()).filter(Boolean);
|
|
1449
|
-
if (af.customAttributes)
|
|
1450
|
-
body.customAttributes = JSON.parse(af.customAttributes);
|
|
1451
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'PATCH', `/contact/contacts/${id}`, body);
|
|
1452
|
-
}
|
|
1453
|
-
else if (operation === 'delete') {
|
|
1454
|
-
const id = this.getNodeParameter('contactId', i, '', { extractValue: true });
|
|
1455
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'DELETE', `/contact/contacts/${id}`);
|
|
1456
|
-
}
|
|
1457
|
-
else if (operation === 'listAttributes') {
|
|
1458
|
-
const resp = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', '/contact/contacts/attributes');
|
|
1459
|
-
responseData = resp.items || resp;
|
|
1460
|
-
}
|
|
1461
|
-
else {
|
|
1462
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
1463
|
-
}
|
|
1464
|
-
}
|
|
1465
|
-
// ─── CUSTOM EVENT ──────────────────────────
|
|
1466
|
-
else if (resource === 'customEvent') {
|
|
1467
|
-
const defName = operation !== 'sendEvent' ? this.getNodeParameter('eventDefinitionName', i) : '';
|
|
1468
|
-
if (operation === 'createDefinition') {
|
|
1469
|
-
const af = this.getNodeParameter('additionalFields', i);
|
|
1470
|
-
const body = { name: defName };
|
|
1471
|
-
if (af.label)
|
|
1472
|
-
body.label = af.label;
|
|
1473
|
-
if (af.description)
|
|
1474
|
-
body.description = af.description;
|
|
1475
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/event/definitions', body);
|
|
1476
|
-
}
|
|
1477
|
-
else if (operation === 'retrieveDefinition') {
|
|
1478
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `/event/definitions/${defName}`);
|
|
1479
|
-
}
|
|
1480
|
-
else if (operation === 'updateDefinition') {
|
|
1481
|
-
const af = this.getNodeParameter('additionalFields', i);
|
|
1482
|
-
const body = {};
|
|
1483
|
-
if (af.label)
|
|
1484
|
-
body.label = af.label;
|
|
1485
|
-
if (af.description)
|
|
1486
|
-
body.description = af.description;
|
|
1487
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'PATCH', `/event/definitions/${defName}`, body);
|
|
1488
|
-
}
|
|
1489
|
-
else if (operation === 'createPropertyDef') {
|
|
1490
|
-
const propName = this.getNodeParameter('propertyName', i);
|
|
1491
|
-
const propType = this.getNodeParameter('propertyType', i);
|
|
1492
|
-
const af = this.getNodeParameter('additionalFields', i);
|
|
1493
|
-
const body = { name: propName, type: propType };
|
|
1494
|
-
if (af.label)
|
|
1495
|
-
body.label = af.label;
|
|
1496
|
-
if (af.description)
|
|
1497
|
-
body.description = af.description;
|
|
1498
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', `/event/definitions/${defName}/properties`, body);
|
|
1499
|
-
}
|
|
1500
|
-
else if (operation === 'updatePropertyDef') {
|
|
1501
|
-
const propName = this.getNodeParameter('propertyName', i);
|
|
1502
|
-
const af = this.getNodeParameter('additionalFields', i);
|
|
1503
|
-
const body = {};
|
|
1504
|
-
if (af.label)
|
|
1505
|
-
body.label = af.label;
|
|
1506
|
-
if (af.description)
|
|
1507
|
-
body.description = af.description;
|
|
1508
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'PATCH', `/event/definitions/${defName}/properties/${propName}`, body);
|
|
1509
|
-
}
|
|
1510
|
-
else if (operation === 'deletePropertyDef') {
|
|
1511
|
-
const propName = this.getNodeParameter('propertyName', i);
|
|
1512
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'DELETE', `/event/definitions/${defName}/properties/${propName}`);
|
|
1513
|
-
}
|
|
1514
|
-
else if (operation === 'sendEvent') {
|
|
1515
|
-
const eventName = this.getNodeParameter('eventName', i);
|
|
1516
|
-
const phone = this.getNodeParameter('eventPhoneNumber', i);
|
|
1517
|
-
const propsJson = this.getNodeParameter('eventProperties', i, '');
|
|
1518
|
-
const body = { name: eventName, phone };
|
|
1519
|
-
if (propsJson)
|
|
1520
|
-
body.properties = JSON.parse(propsJson);
|
|
1521
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/event/events', body);
|
|
1522
|
-
}
|
|
1523
|
-
else {
|
|
1524
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
1525
|
-
}
|
|
1526
|
-
}
|
|
1527
|
-
// ─── EMAIL ─────────────────────────────────
|
|
1528
|
-
else if (resource === 'email') {
|
|
1529
|
-
if (operation === 'send') {
|
|
1530
|
-
const from = this.getNodeParameter('emailFrom', i);
|
|
1531
|
-
const to = this.getNodeParameter('emailTo', i);
|
|
1532
|
-
const subject = this.getNodeParameter('emailSubject', i);
|
|
1533
|
-
const content = this.getNodeParameter('emailContent', i);
|
|
1534
|
-
const af = this.getNodeParameter('additionalFields', i);
|
|
1535
|
-
const body = { from, to, subject, content };
|
|
1536
|
-
if (af.contentType)
|
|
1537
|
-
body.contentType = af.contentType;
|
|
1538
|
-
if (af.replyTo)
|
|
1539
|
-
body.replyTo = af.replyTo;
|
|
1540
|
-
if (af.externalId)
|
|
1541
|
-
body.externalId = af.externalId;
|
|
1542
|
-
if (af.callbackUrl)
|
|
1543
|
-
body.callbackUrl = af.callbackUrl;
|
|
1544
|
-
if (af.variables)
|
|
1545
|
-
body.variables = JSON.parse(af.variables);
|
|
1546
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/emails', body);
|
|
1547
|
-
}
|
|
1548
|
-
else {
|
|
1549
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
1550
|
-
}
|
|
1551
|
-
}
|
|
1552
|
-
// ─── SMS ────────────────────────────────────
|
|
1553
|
-
else if (resource === 'sms') {
|
|
1554
|
-
if (operation === 'send') {
|
|
1555
|
-
const to = this.getNodeParameter('smsTo', i);
|
|
1556
|
-
const text = this.getNodeParameter('smsText', i);
|
|
1557
|
-
const af = this.getNodeParameter('additionalFields', i);
|
|
1558
|
-
const body = { to, text };
|
|
1559
|
-
if (af.senderId)
|
|
1560
|
-
body.senderId = af.senderId;
|
|
1561
|
-
if (af.signature)
|
|
1562
|
-
body.signature = af.signature;
|
|
1563
|
-
if (af.externalId)
|
|
1564
|
-
body.externalId = af.externalId;
|
|
1565
|
-
if (af.callbackUrl)
|
|
1566
|
-
body.callbackUrl = af.callbackUrl;
|
|
1567
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/sms', body);
|
|
1568
|
-
}
|
|
1569
|
-
else if (operation === 'list') {
|
|
1570
|
-
const returnAll = this.getNodeParameter('returnAll', i);
|
|
1571
|
-
const filters = this.getNodeParameter('filters', i, {});
|
|
1572
|
-
const qs = {};
|
|
1573
|
-
if (filters.id)
|
|
1574
|
-
qs['filter.id'] = filters.id;
|
|
1575
|
-
if (filters.createTimeGte)
|
|
1576
|
-
qs['filter.createTime.gte'] = filters.createTimeGte;
|
|
1577
|
-
if (filters.createTimeLte)
|
|
1578
|
-
qs['filter.createTime.lte'] = filters.createTimeLte;
|
|
1579
|
-
if (returnAll) {
|
|
1580
|
-
responseData = await GenericFunctions_1.ycloudApiRequestAllItems.call(this, 'GET', '/sms', {}, qs);
|
|
1581
|
-
}
|
|
1582
|
-
else {
|
|
1583
|
-
const limit = this.getNodeParameter('limit', i);
|
|
1584
|
-
qs.limit = limit;
|
|
1585
|
-
const resp = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', '/sms', {}, qs);
|
|
1586
|
-
responseData = resp.items || [];
|
|
1587
|
-
}
|
|
1588
|
-
}
|
|
1589
|
-
else {
|
|
1590
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
1591
|
-
}
|
|
1592
|
-
}
|
|
1593
|
-
// ─── UNSUBSCRIBER ───────────────────────────
|
|
1594
|
-
else if (resource === 'unsubscriber') {
|
|
1595
|
-
if (operation === 'create') {
|
|
1596
|
-
const customer = this.getNodeParameter('unsubCreateCustomer', i);
|
|
1597
|
-
const channel = this.getNodeParameter('unsubChannel', i);
|
|
1598
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/unsubscribers', { customer, channel });
|
|
1599
|
-
}
|
|
1600
|
-
else if (operation === 'list') {
|
|
1601
|
-
const returnAll = this.getNodeParameter('returnAll', i);
|
|
1602
|
-
if (returnAll) {
|
|
1603
|
-
responseData = await GenericFunctions_1.ycloudApiRequestAllItems.call(this, 'GET', '/unsubscribers');
|
|
1604
|
-
}
|
|
1605
|
-
else {
|
|
1606
|
-
const limit = this.getNodeParameter('limit', i);
|
|
1607
|
-
const resp = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', '/unsubscribers', {}, { limit });
|
|
1608
|
-
responseData = resp.items || [];
|
|
1609
|
-
}
|
|
1610
|
-
}
|
|
1611
|
-
else if (operation === 'listByCustomer') {
|
|
1612
|
-
const customer = this.getNodeParameter('unsubCustomer', i);
|
|
1613
|
-
const resp = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `/unsubscribers/${encodeURIComponent(customer)}`);
|
|
1614
|
-
responseData = resp.items || resp;
|
|
1615
|
-
}
|
|
1616
|
-
else if (operation === 'retrieve') {
|
|
1617
|
-
const customer = this.getNodeParameter('unsubCustomer', i);
|
|
1618
|
-
const channel = this.getNodeParameter('unsubChannel', i);
|
|
1619
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `/unsubscribers/${encodeURIComponent(customer)}/${channel}`);
|
|
1620
|
-
}
|
|
1621
|
-
else if (operation === 'delete') {
|
|
1622
|
-
const customer = this.getNodeParameter('unsubCustomer', i);
|
|
1623
|
-
const channel = this.getNodeParameter('unsubChannel', i);
|
|
1624
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'DELETE', `/unsubscribers/${encodeURIComponent(customer)}/${channel}`);
|
|
1625
|
-
}
|
|
1626
|
-
else {
|
|
1627
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
1628
|
-
}
|
|
1629
|
-
}
|
|
1630
|
-
// ─── VERIFICATION ───────────────────────────
|
|
1631
|
-
else if (resource === 'verification') {
|
|
1632
|
-
if (operation === 'send') {
|
|
1633
|
-
const channel = this.getNodeParameter('verificationChannel', i);
|
|
1634
|
-
const to = this.getNodeParameter('verificationTo', i);
|
|
1635
|
-
const af = this.getNodeParameter('additionalFields', i);
|
|
1636
|
-
const body = { channel, to };
|
|
1637
|
-
if (af.code)
|
|
1638
|
-
body.code = af.code;
|
|
1639
|
-
if (af.language)
|
|
1640
|
-
body.language = af.language;
|
|
1641
|
-
if (af.senderId)
|
|
1642
|
-
body.senderId = af.senderId;
|
|
1643
|
-
if (af.signature)
|
|
1644
|
-
body.signature = af.signature;
|
|
1645
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/verify/verifications', body);
|
|
1646
|
-
}
|
|
1647
|
-
else if (operation === 'check') {
|
|
1648
|
-
const code = this.getNodeParameter('verificationCode', i);
|
|
1649
|
-
const identification = this.getNodeParameter('verificationIdentification', i);
|
|
1650
|
-
const body = { code };
|
|
1651
|
-
if (identification.verificationId)
|
|
1652
|
-
body.verificationId = identification.verificationId;
|
|
1653
|
-
if (identification.to)
|
|
1654
|
-
body.to = identification.to;
|
|
1655
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/verify/verificationChecks', body);
|
|
1656
|
-
}
|
|
1657
|
-
else {
|
|
1658
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
1659
|
-
}
|
|
1660
|
-
}
|
|
1661
|
-
// ─── VOICE ──────────────────────────────────
|
|
1662
|
-
else if (resource === 'voice') {
|
|
1663
|
-
if (operation === 'send') {
|
|
1664
|
-
const to = this.getNodeParameter('voiceTo', i);
|
|
1665
|
-
const verificationCode = this.getNodeParameter('voiceCode', i);
|
|
1666
|
-
const af = this.getNodeParameter('additionalFields', i);
|
|
1667
|
-
const body = { to, verificationCode };
|
|
1668
|
-
if (af.language)
|
|
1669
|
-
body.language = af.language;
|
|
1670
|
-
if (af.externalId)
|
|
1671
|
-
body.externalId = af.externalId;
|
|
1672
|
-
if (af.callbackUrl)
|
|
1673
|
-
body.callbackUrl = af.callbackUrl;
|
|
1674
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/voices', body);
|
|
1675
|
-
}
|
|
1676
|
-
else if (operation === 'list') {
|
|
1677
|
-
const returnAll = this.getNodeParameter('returnAll', i);
|
|
1678
|
-
if (returnAll) {
|
|
1679
|
-
responseData = await GenericFunctions_1.ycloudApiRequestAllItems.call(this, 'GET', '/voices');
|
|
1680
|
-
}
|
|
1681
|
-
else {
|
|
1682
|
-
const limit = this.getNodeParameter('limit', i);
|
|
1683
|
-
const resp = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', '/voices', {}, { limit });
|
|
1684
|
-
responseData = resp.items || [];
|
|
1685
|
-
}
|
|
1686
|
-
}
|
|
1687
|
-
else {
|
|
1688
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
1689
|
-
}
|
|
1690
|
-
}
|
|
1691
|
-
// ─── WEBHOOK ENDPOINT ───────────────────────
|
|
1692
|
-
else if (resource === 'webhookEndpoint') {
|
|
1693
|
-
if (operation === 'create') {
|
|
1694
|
-
const url = this.getNodeParameter('webhookUrl', i);
|
|
1695
|
-
const enabledEvents = this.getNodeParameter('webhookEvents', i);
|
|
1696
|
-
const af = this.getNodeParameter('additionalFields', i);
|
|
1697
|
-
const body = { url, enabledEvents };
|
|
1698
|
-
if (af.description)
|
|
1699
|
-
body.description = af.description;
|
|
1700
|
-
if (af.status)
|
|
1701
|
-
body.status = af.status;
|
|
1702
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/webhookEndpoints', body);
|
|
1703
|
-
}
|
|
1704
|
-
else if (operation === 'list') {
|
|
1705
|
-
const returnAll = this.getNodeParameter('returnAll', i);
|
|
1706
|
-
if (returnAll) {
|
|
1707
|
-
responseData = await GenericFunctions_1.ycloudApiRequestAllItems.call(this, 'GET', '/webhookEndpoints');
|
|
1708
|
-
}
|
|
1709
|
-
else {
|
|
1710
|
-
const limit = this.getNodeParameter('limit', i);
|
|
1711
|
-
const resp = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', '/webhookEndpoints', {}, { limit });
|
|
1712
|
-
responseData = resp.items || [];
|
|
1713
|
-
}
|
|
1714
|
-
}
|
|
1715
|
-
else if (operation === 'retrieve') {
|
|
1716
|
-
const id = this.getNodeParameter('webhookEndpointId', i);
|
|
1717
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `/webhookEndpoints/${id}`);
|
|
1718
|
-
}
|
|
1719
|
-
else if (operation === 'update') {
|
|
1720
|
-
const id = this.getNodeParameter('webhookEndpointId', i);
|
|
1721
|
-
const af = this.getNodeParameter('additionalFields', i);
|
|
1722
|
-
const body = {};
|
|
1723
|
-
if (af.url)
|
|
1724
|
-
body.url = af.url;
|
|
1725
|
-
if (af.description)
|
|
1726
|
-
body.description = af.description;
|
|
1727
|
-
if (af.status)
|
|
1728
|
-
body.status = af.status;
|
|
1729
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'PATCH', `/webhookEndpoints/${id}`, body);
|
|
1730
|
-
}
|
|
1731
|
-
else if (operation === 'delete') {
|
|
1732
|
-
const id = this.getNodeParameter('webhookEndpointId', i);
|
|
1733
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'DELETE', `/webhookEndpoints/${id}`);
|
|
1734
|
-
}
|
|
1735
|
-
else if (operation === 'rotateSecret') {
|
|
1736
|
-
const id = this.getNodeParameter('webhookEndpointId', i);
|
|
1737
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', `/webhookEndpoints/${id}/rotateSecret`);
|
|
1738
|
-
}
|
|
1739
|
-
else {
|
|
1740
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
1741
|
-
}
|
|
1742
|
-
}
|
|
1743
|
-
// ─── WHATSAPP BUSINESS ACCOUNT ─────────────
|
|
1744
|
-
else if (resource === 'whatsappBusinessAccount') {
|
|
1745
|
-
if (operation === 'list') {
|
|
1746
|
-
const returnAll = this.getNodeParameter('returnAll', i);
|
|
1747
|
-
if (returnAll) {
|
|
1748
|
-
responseData = await GenericFunctions_1.ycloudApiRequestAllItems.call(this, 'GET', '/whatsapp/businessAccounts');
|
|
1749
|
-
}
|
|
1750
|
-
else {
|
|
1751
|
-
const limit = this.getNodeParameter('limit', i);
|
|
1752
|
-
const resp = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', '/whatsapp/businessAccounts', {}, { limit });
|
|
1753
|
-
responseData = resp.items || [];
|
|
1754
|
-
}
|
|
1755
|
-
}
|
|
1756
|
-
else if (operation === 'retrieve') {
|
|
1757
|
-
const id = this.getNodeParameter('wabaId', i);
|
|
1758
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `/whatsapp/businessAccounts/${id}`);
|
|
1759
|
-
}
|
|
1760
|
-
else {
|
|
1761
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
1762
|
-
}
|
|
1763
|
-
}
|
|
1764
|
-
// ─── WHATSAPP CALLING ───────────────────────
|
|
1765
|
-
else if (resource === 'whatsappCalling') {
|
|
1766
|
-
if (operation === 'connect') {
|
|
1767
|
-
const from = this.getNodeParameter('callingFrom', i);
|
|
1768
|
-
const to = this.getNodeParameter('callingTo', i);
|
|
1769
|
-
const sdp = this.getNodeParameter('callingSdp', i);
|
|
1770
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/whatsapp/calls/connect', { from, to, sdpType: 'offer', sdp });
|
|
1771
|
-
}
|
|
1772
|
-
else if (operation === 'preAccept') {
|
|
1773
|
-
const phoneId = this.getNodeParameter('callingPhoneId', i);
|
|
1774
|
-
const wacid = this.getNodeParameter('callingWacid', i);
|
|
1775
|
-
const sdp = this.getNodeParameter('callingSdp', i);
|
|
1776
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/whatsapp/calls/preAccept', { phoneId, wacid, sdpType: 'answer', sdp });
|
|
1777
|
-
}
|
|
1778
|
-
else if (operation === 'accept') {
|
|
1779
|
-
const phoneId = this.getNodeParameter('callingPhoneId', i);
|
|
1780
|
-
const wacid = this.getNodeParameter('callingWacid', i);
|
|
1781
|
-
const sdp = this.getNodeParameter('callingSdp', i);
|
|
1782
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/whatsapp/calls/accept', { phoneId, wacid, sdpType: 'answer', sdp });
|
|
1783
|
-
}
|
|
1784
|
-
else if (operation === 'terminate') {
|
|
1785
|
-
const phoneId = this.getNodeParameter('callingPhoneId', i);
|
|
1786
|
-
const wacid = this.getNodeParameter('callingWacid', i);
|
|
1787
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/whatsapp/calls/terminate', { phoneId, wacid });
|
|
1788
|
-
}
|
|
1789
|
-
else if (operation === 'reject') {
|
|
1790
|
-
const phoneId = this.getNodeParameter('callingPhoneId', i);
|
|
1791
|
-
const wacid = this.getNodeParameter('callingWacid', i);
|
|
1792
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/whatsapp/calls/reject', { phoneId, wacid });
|
|
1793
|
-
}
|
|
1794
|
-
else {
|
|
1795
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
1796
|
-
}
|
|
1797
|
-
}
|
|
1798
|
-
// ─── WHATSAPP FLOW ──────────────────────────
|
|
1799
|
-
else if (resource === 'whatsappFlow') {
|
|
1800
|
-
if (operation === 'create') {
|
|
1801
|
-
const wabaId = this.getNodeParameter('flowWabaId', i);
|
|
1802
|
-
const name = this.getNodeParameter('flowName', i);
|
|
1803
|
-
const categories = [this.getNodeParameter('flowCategory', i)];
|
|
1804
|
-
const af = this.getNodeParameter('additionalFields', i);
|
|
1805
|
-
const body = { wabaId, name, categories };
|
|
1806
|
-
if (af.flowJson)
|
|
1807
|
-
body.flowJson = af.flowJson;
|
|
1808
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/whatsapp/flows', body);
|
|
1809
|
-
}
|
|
1810
|
-
else if (operation === 'list') {
|
|
1811
|
-
const returnAll = this.getNodeParameter('returnAll', i);
|
|
1812
|
-
if (returnAll) {
|
|
1813
|
-
responseData = await GenericFunctions_1.ycloudApiRequestAllItems.call(this, 'GET', '/whatsapp/flows');
|
|
1814
|
-
}
|
|
1815
|
-
else {
|
|
1816
|
-
const limit = this.getNodeParameter('limit', i);
|
|
1817
|
-
const resp = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', '/whatsapp/flows', {}, { limit });
|
|
1818
|
-
responseData = resp.items || [];
|
|
1819
|
-
}
|
|
1820
|
-
}
|
|
1821
|
-
else if (operation === 'retrieve') {
|
|
1822
|
-
const flowId = this.getNodeParameter('flowId', i);
|
|
1823
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `/whatsapp/flows/${flowId}`);
|
|
1824
|
-
}
|
|
1825
|
-
else if (operation === 'updateMetadata') {
|
|
1826
|
-
const flowId = this.getNodeParameter('flowId', i);
|
|
1827
|
-
const af = this.getNodeParameter('additionalFields', i);
|
|
1828
|
-
const body = {};
|
|
1829
|
-
if (af.name)
|
|
1830
|
-
body.name = af.name;
|
|
1831
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'PATCH', `/whatsapp/flows/${flowId}/metadata`, body);
|
|
1832
|
-
}
|
|
1833
|
-
else if (operation === 'updateStructure') {
|
|
1834
|
-
const flowId = this.getNodeParameter('flowId', i);
|
|
1835
|
-
const flowJson = this.getNodeParameter('flowAssetJson', i);
|
|
1836
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'PATCH', `/whatsapp/flows/${flowId}/assets`, { flowJson });
|
|
1837
|
-
}
|
|
1838
|
-
else if (operation === 'delete') {
|
|
1839
|
-
const flowId = this.getNodeParameter('flowId', i);
|
|
1840
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'DELETE', `/whatsapp/flows/${flowId}`);
|
|
1841
|
-
}
|
|
1842
|
-
else if (operation === 'publish') {
|
|
1843
|
-
const flowId = this.getNodeParameter('flowId', i);
|
|
1844
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', `/whatsapp/flows/${flowId}/publish`);
|
|
1845
|
-
}
|
|
1846
|
-
else if (operation === 'deprecate') {
|
|
1847
|
-
const flowId = this.getNodeParameter('flowId', i);
|
|
1848
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', `/whatsapp/flows/${flowId}/deprecate`);
|
|
1849
|
-
}
|
|
1850
|
-
else if (operation === 'preview') {
|
|
1851
|
-
const flowId = this.getNodeParameter('flowId', i);
|
|
1852
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `/whatsapp/flows/${flowId}/preview`);
|
|
1853
|
-
}
|
|
1854
|
-
else {
|
|
1855
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
1856
|
-
}
|
|
1857
|
-
}
|
|
1858
|
-
// ─── WHATSAPP INBOUND MESSAGE ───────────────
|
|
1859
|
-
else if (resource === 'whatsappInboundMessage') {
|
|
1860
|
-
const msgId = this.getNodeParameter('inboundMessageId', i);
|
|
1861
|
-
if (operation === 'markAsRead') {
|
|
1862
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', `/whatsapp/inboundMessages/${msgId}/markAsRead`);
|
|
1863
|
-
}
|
|
1864
|
-
else if (operation === 'typingIndicator') {
|
|
1865
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', `/whatsapp/inboundMessages/${msgId}/typingIndicator`);
|
|
1866
|
-
}
|
|
1867
|
-
else {
|
|
1868
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
1869
|
-
}
|
|
1870
|
-
}
|
|
1871
|
-
// ─── WHATSAPP MEDIA ─────────────────────────
|
|
1872
|
-
else if (resource === 'whatsappMedia') {
|
|
1873
|
-
if (operation === 'upload') {
|
|
1874
|
-
const phoneNumber = this.getNodeParameter('mediaPhoneNumber', i);
|
|
1875
|
-
const binaryProp = this.getNodeParameter('binaryProperty', i);
|
|
1876
|
-
const binaryData = this.helpers.assertBinaryData(i, binaryProp);
|
|
1877
|
-
const buffer = await this.helpers.getBinaryDataBuffer(i, binaryProp);
|
|
1878
|
-
const credentials = await this.getCredentials('yCloudApi');
|
|
1879
|
-
const formData = {
|
|
1880
|
-
file: {
|
|
1881
|
-
value: buffer,
|
|
1882
|
-
options: {
|
|
1883
|
-
filename: binaryData.fileName || 'file',
|
|
1884
|
-
contentType: binaryData.mimeType,
|
|
1885
|
-
},
|
|
1886
|
-
},
|
|
1887
|
-
messaging_product: 'whatsapp',
|
|
1888
|
-
type: binaryData.mimeType,
|
|
1889
|
-
};
|
|
1890
|
-
responseData = await this.helpers.request({
|
|
1891
|
-
method: 'POST',
|
|
1892
|
-
url: `https://api.ycloud.com/v2/whatsapp/media/${encodeURIComponent(phoneNumber)}/upload`,
|
|
1893
|
-
headers: { 'X-API-Key': credentials.apiKey },
|
|
1894
|
-
formData,
|
|
1895
|
-
json: true,
|
|
1896
|
-
});
|
|
1897
|
-
}
|
|
1898
|
-
else {
|
|
1899
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
1900
|
-
}
|
|
1901
|
-
}
|
|
1902
|
-
// ─── WHATSAPP MESSAGE ───────────────────────
|
|
1903
|
-
else if (resource === 'whatsappMessage') {
|
|
1904
|
-
if (operation === 'sendDirectly' || operation === 'send') {
|
|
1905
|
-
const from = this.getNodeParameter('waFrom', i, '', { extractValue: true });
|
|
1906
|
-
const to = this.getNodeParameter('waTo', i, '', { extractValue: true });
|
|
1907
|
-
const messageType = this.getNodeParameter('messageType', i);
|
|
1908
|
-
const af = this.getNodeParameter('additionalFields', i);
|
|
1909
|
-
const body = { from, to, type: messageType };
|
|
1910
|
-
if (messageType === 'text') {
|
|
1911
|
-
body.text = {
|
|
1912
|
-
body: this.getNodeParameter('textBody', i),
|
|
1913
|
-
preview_url: this.getNodeParameter('textPreviewUrl', i),
|
|
1914
|
-
};
|
|
1915
|
-
}
|
|
1916
|
-
else if (messageType === 'template') {
|
|
1917
|
-
const componentsJson = this.getNodeParameter('templateComponents', i, '');
|
|
1918
|
-
body.template = {
|
|
1919
|
-
name: this.getNodeParameter('templateName', i),
|
|
1920
|
-
language: { code: this.getNodeParameter('templateLanguage', i) },
|
|
1921
|
-
...(componentsJson ? { components: JSON.parse(componentsJson) } : {}),
|
|
1922
|
-
};
|
|
1923
|
-
}
|
|
1924
|
-
else if (['image', 'video', 'audio', 'document', 'sticker'].includes(messageType)) {
|
|
1925
|
-
const mediaIdOrLink = this.getNodeParameter('mediaIdOrLink', i);
|
|
1926
|
-
const mediaObj = mediaIdOrLink.startsWith('http') ? { link: mediaIdOrLink } : { id: mediaIdOrLink };
|
|
1927
|
-
if (['image', 'video', 'document'].includes(messageType)) {
|
|
1928
|
-
const caption = this.getNodeParameter('mediaCaption', i, '');
|
|
1929
|
-
if (caption)
|
|
1930
|
-
mediaObj.caption = caption;
|
|
1931
|
-
}
|
|
1932
|
-
if (messageType === 'document') {
|
|
1933
|
-
const filename = this.getNodeParameter('documentFilename', i, '');
|
|
1934
|
-
if (filename)
|
|
1935
|
-
mediaObj.filename = filename;
|
|
1936
|
-
}
|
|
1937
|
-
body[messageType] = mediaObj;
|
|
1938
|
-
}
|
|
1939
|
-
else if (messageType === 'location') {
|
|
1940
|
-
const locObj = {
|
|
1941
|
-
latitude: this.getNodeParameter('locationLatitude', i),
|
|
1942
|
-
longitude: this.getNodeParameter('locationLongitude', i),
|
|
1943
|
-
};
|
|
1944
|
-
const name = this.getNodeParameter('locationName', i, '');
|
|
1945
|
-
const address = this.getNodeParameter('locationAddress', i, '');
|
|
1946
|
-
if (name)
|
|
1947
|
-
locObj.name = name;
|
|
1948
|
-
if (address)
|
|
1949
|
-
locObj.address = address;
|
|
1950
|
-
body.location = locObj;
|
|
1951
|
-
}
|
|
1952
|
-
else if (messageType === 'interactive') {
|
|
1953
|
-
body.interactive = JSON.parse(this.getNodeParameter('interactiveJSON', i));
|
|
1954
|
-
}
|
|
1955
|
-
else if (messageType === 'reaction') {
|
|
1956
|
-
body.reaction = {
|
|
1957
|
-
message_id: this.getNodeParameter('reactionMessageId', i),
|
|
1958
|
-
emoji: this.getNodeParameter('reactionEmoji', i, ''),
|
|
1959
|
-
};
|
|
1960
|
-
}
|
|
1961
|
-
else if (messageType === 'contacts') {
|
|
1962
|
-
body.contacts = JSON.parse(this.getNodeParameter('contactsJSON', i));
|
|
1963
|
-
}
|
|
1964
|
-
if (af.contextMessageId)
|
|
1965
|
-
body.context = { message_id: af.contextMessageId };
|
|
1966
|
-
if (af.externalId)
|
|
1967
|
-
body.externalId = af.externalId;
|
|
1968
|
-
if (af.filterUnsubscribed !== undefined)
|
|
1969
|
-
body.filterUnsubscribed = af.filterUnsubscribed;
|
|
1970
|
-
const endpoint = operation === 'sendDirectly' ? '/whatsapp/messages/sendDirectly' : '/whatsapp/messages';
|
|
1971
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', endpoint, body);
|
|
1972
|
-
}
|
|
1973
|
-
else if (operation === 'retrieve') {
|
|
1974
|
-
const msgId = this.getNodeParameter('waMessageId', i);
|
|
1975
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `/whatsapp/messages/${msgId}`);
|
|
1976
|
-
}
|
|
1977
|
-
else {
|
|
1978
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
1979
|
-
}
|
|
1980
|
-
}
|
|
1981
|
-
// ─── WHATSAPP PHONE NUMBER ──────────────────
|
|
1982
|
-
else if (resource === 'whatsappPhoneNumber') {
|
|
1983
|
-
if (operation === 'list') {
|
|
1984
|
-
const returnAll = this.getNodeParameter('returnAll', i);
|
|
1985
|
-
if (returnAll) {
|
|
1986
|
-
responseData = await GenericFunctions_1.ycloudApiRequestAllItems.call(this, 'GET', '/whatsapp/phoneNumbers');
|
|
1987
|
-
}
|
|
1988
|
-
else {
|
|
1989
|
-
const limit = this.getNodeParameter('limit', i);
|
|
1990
|
-
const resp = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', '/whatsapp/phoneNumbers', {}, { limit });
|
|
1991
|
-
responseData = resp.items || [];
|
|
1992
|
-
}
|
|
1993
|
-
}
|
|
1994
|
-
else {
|
|
1995
|
-
const wabaId = this.getNodeParameter('phoneWabaId', i);
|
|
1996
|
-
const phone = this.getNodeParameter('phoneNumberParam', i);
|
|
1997
|
-
const encodedPhone = encodeURIComponent(phone);
|
|
1998
|
-
const base = `/whatsapp/phoneNumbers/${wabaId}/${encodedPhone}`;
|
|
1999
|
-
if (operation === 'retrieve') {
|
|
2000
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', base);
|
|
2001
|
-
}
|
|
2002
|
-
else if (operation === 'retrieveProfile') {
|
|
2003
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `${base}/profile`);
|
|
2004
|
-
}
|
|
2005
|
-
else if (operation === 'updateProfile') {
|
|
2006
|
-
const pf = this.getNodeParameter('profileFields', i);
|
|
2007
|
-
const body = {};
|
|
2008
|
-
if (pf.about)
|
|
2009
|
-
body.about = pf.about;
|
|
2010
|
-
if (pf.address)
|
|
2011
|
-
body.address = pf.address;
|
|
2012
|
-
if (pf.description)
|
|
2013
|
-
body.description = pf.description;
|
|
2014
|
-
if (pf.email)
|
|
2015
|
-
body.email = pf.email;
|
|
2016
|
-
if (pf.profilePictureUrl)
|
|
2017
|
-
body.profilePictureUrl = pf.profilePictureUrl;
|
|
2018
|
-
if (pf.vertical)
|
|
2019
|
-
body.vertical = pf.vertical;
|
|
2020
|
-
const websites = [];
|
|
2021
|
-
if (pf.websites1)
|
|
2022
|
-
websites.push(pf.websites1);
|
|
2023
|
-
if (pf.websites2)
|
|
2024
|
-
websites.push(pf.websites2);
|
|
2025
|
-
if (websites.length)
|
|
2026
|
-
body.websites = websites;
|
|
2027
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'PATCH', `${base}/profile`, body);
|
|
2028
|
-
}
|
|
2029
|
-
else if (operation === 'updateDisplayName') {
|
|
2030
|
-
const displayName = this.getNodeParameter('phoneDisplayName', i);
|
|
2031
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'PATCH', `${base}/displayName`, { displayName });
|
|
2032
|
-
}
|
|
2033
|
-
else if (operation === 'retrieveCommerceSettings') {
|
|
2034
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `${base}/whatsappCommerceSettings`);
|
|
2035
|
-
}
|
|
2036
|
-
else if (operation === 'updateCommerceSettings') {
|
|
2037
|
-
const csJson = this.getNodeParameter('commerceSettingsJson', i);
|
|
2038
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'PATCH', `${base}/whatsappCommerceSettings`, JSON.parse(csJson));
|
|
2039
|
-
}
|
|
2040
|
-
else if (operation === 'register') {
|
|
2041
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', `${base}/register`);
|
|
2042
|
-
}
|
|
2043
|
-
else if (operation === 'retrieveSettings') {
|
|
2044
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `${base}/settings`);
|
|
2045
|
-
}
|
|
2046
|
-
else if (operation === 'saveSettings') {
|
|
2047
|
-
const settingsJson = this.getNodeParameter('phoneSettingsJson', i);
|
|
2048
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', `${base}/settings`, JSON.parse(settingsJson));
|
|
2049
|
-
}
|
|
2050
|
-
else {
|
|
2051
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
2052
|
-
}
|
|
2053
|
-
}
|
|
2054
|
-
}
|
|
2055
|
-
// ─── WHATSAPP TEMPLATE ──────────────────────
|
|
2056
|
-
else if (resource === 'whatsappTemplate') {
|
|
2057
|
-
if (operation === 'create') {
|
|
2058
|
-
const wabaId = this.getNodeParameter('templateWabaId', i);
|
|
2059
|
-
const name = this.getNodeParameter('templateCreateName', i);
|
|
2060
|
-
const language = this.getNodeParameter('templateCreateLanguage', i);
|
|
2061
|
-
const category = this.getNodeParameter('templateCategory', i);
|
|
2062
|
-
const componentsJson = this.getNodeParameter('templateComponentsJson', i);
|
|
2063
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/whatsapp/templates', {
|
|
2064
|
-
wabaId,
|
|
2065
|
-
name,
|
|
2066
|
-
language,
|
|
2067
|
-
category,
|
|
2068
|
-
components: JSON.parse(componentsJson),
|
|
2069
|
-
});
|
|
2070
|
-
}
|
|
2071
|
-
else if (operation === 'list') {
|
|
2072
|
-
const returnAll = this.getNodeParameter('returnAll', i);
|
|
2073
|
-
const filters = this.getNodeParameter('filters', i, {});
|
|
2074
|
-
const qs = {};
|
|
2075
|
-
if (filters.wabaId)
|
|
2076
|
-
qs['filter.wabaId'] = filters.wabaId;
|
|
2077
|
-
if (returnAll) {
|
|
2078
|
-
responseData = await GenericFunctions_1.ycloudApiRequestAllItems.call(this, 'GET', '/whatsapp/templates', {}, qs);
|
|
2079
|
-
}
|
|
2080
|
-
else {
|
|
2081
|
-
const limit = this.getNodeParameter('limit', i);
|
|
2082
|
-
qs.limit = limit;
|
|
2083
|
-
const resp = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', '/whatsapp/templates', {}, qs);
|
|
2084
|
-
responseData = resp.items || [];
|
|
2085
|
-
}
|
|
2086
|
-
}
|
|
2087
|
-
else if (operation === 'retrieve') {
|
|
2088
|
-
const wabaId = this.getNodeParameter('templateWabaId', i);
|
|
2089
|
-
const name = this.getNodeParameter('templateCreateName', i);
|
|
2090
|
-
const language = this.getNodeParameter('templateCreateLanguage', i);
|
|
2091
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `/whatsapp/templates/${wabaId}/${name}/${language}`);
|
|
2092
|
-
}
|
|
2093
|
-
else if (operation === 'deleteByName') {
|
|
2094
|
-
const wabaId = this.getNodeParameter('templateWabaId', i);
|
|
2095
|
-
const name = this.getNodeParameter('templateCreateName', i);
|
|
2096
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'DELETE', `/whatsapp/templates/${wabaId}/${name}`);
|
|
2097
|
-
}
|
|
2098
|
-
else if (operation === 'deleteByNameAndLanguage') {
|
|
2099
|
-
const wabaId = this.getNodeParameter('templateWabaId', i);
|
|
2100
|
-
const name = this.getNodeParameter('templateCreateName', i);
|
|
2101
|
-
const language = this.getNodeParameter('templateCreateLanguage', i);
|
|
2102
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'DELETE', `/whatsapp/templates/${wabaId}/${name}/${language}`);
|
|
2103
|
-
}
|
|
2104
|
-
else if (operation === 'edit') {
|
|
2105
|
-
const wabaId = this.getNodeParameter('templateWabaId', i);
|
|
2106
|
-
const name = this.getNodeParameter('templateCreateName', i);
|
|
2107
|
-
const language = this.getNodeParameter('templateCreateLanguage', i);
|
|
2108
|
-
const componentsJson = this.getNodeParameter('templateComponentsJson', i);
|
|
2109
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'PATCH', `/whatsapp/templates/${wabaId}/${name}/${language}`, {
|
|
2110
|
-
components: JSON.parse(componentsJson),
|
|
2111
|
-
});
|
|
2112
|
-
}
|
|
2113
|
-
else {
|
|
2114
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
2115
|
-
}
|
|
2116
|
-
}
|
|
2117
|
-
else {
|
|
2118
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown resource: ${resource}`);
|
|
2119
|
-
}
|
|
2120
|
-
// Push results
|
|
89
|
+
const responseData = await handler.execute.call(this, i, operation);
|
|
2121
90
|
if (Array.isArray(responseData)) {
|
|
2122
91
|
for (const item of responseData) {
|
|
2123
92
|
returnData.push({ json: item, pairedItem: { item: i } });
|