@growsalesai/n8n-nodes-ycloud 0.1.9 → 0.2.1
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 -5
- package/dist/nodes/YCloud/YCloud.node.js +62 -2230
- 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 +305 -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 +15 -0
- package/dist/nodes/YCloud/methods/index.js +52 -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 +5 -0
- package/dist/nodes/YCloud/methods/loadOptions.js +107 -0
- package/dist/nodes/YCloud/methods/loadOptions.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,1414 +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',
|
|
1002
|
-
name: 'templateName',
|
|
1003
|
-
type: 'resourceLocator',
|
|
1004
|
-
default: { mode: 'list', value: '' },
|
|
1005
|
-
required: true,
|
|
1006
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'], messageType: ['template'] } },
|
|
1007
|
-
description: 'Select a template from your YCloud account or enter the name manually',
|
|
1008
|
-
modes: [
|
|
1009
|
-
{
|
|
1010
|
-
displayName: 'From List',
|
|
1011
|
-
name: 'list',
|
|
1012
|
-
type: 'list',
|
|
1013
|
-
typeOptions: { searchListMethod: 'getTemplates', searchable: true },
|
|
1014
|
-
},
|
|
1015
|
-
{
|
|
1016
|
-
displayName: 'Enter Name',
|
|
1017
|
-
name: 'id',
|
|
1018
|
-
type: 'string',
|
|
1019
|
-
placeholder: 'my_template_name',
|
|
1020
|
-
},
|
|
1021
|
-
],
|
|
1022
|
-
},
|
|
1023
|
-
{
|
|
1024
|
-
displayName: 'Template Language',
|
|
1025
|
-
name: 'templateLanguage',
|
|
1026
|
-
type: 'options',
|
|
1027
|
-
typeOptions: { loadOptionsMethod: 'getTemplateLanguages' },
|
|
1028
|
-
required: true,
|
|
1029
|
-
default: '',
|
|
1030
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'], messageType: ['template'] } },
|
|
1031
|
-
description: 'Language code of the template. Refresh options to load from your account.',
|
|
1032
|
-
},
|
|
1033
|
-
{
|
|
1034
|
-
displayName: 'Header Variable',
|
|
1035
|
-
name: 'templateHeaderVar',
|
|
1036
|
-
type: 'string',
|
|
1037
|
-
default: '',
|
|
1038
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'], messageType: ['template'] } },
|
|
1039
|
-
description: 'Value for {{1}} in the template header (text headers only). Leave empty if not used.',
|
|
1040
|
-
},
|
|
1041
|
-
{
|
|
1042
|
-
displayName: 'Header Media URL or ID',
|
|
1043
|
-
name: 'templateHeaderMedia',
|
|
1044
|
-
type: 'string',
|
|
1045
|
-
default: '',
|
|
1046
|
-
placeholder: 'https://... or media-id',
|
|
1047
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'], messageType: ['template'] } },
|
|
1048
|
-
description: 'URL or media ID for image/video/document header. Leave empty if not used.',
|
|
1049
|
-
},
|
|
1050
|
-
{
|
|
1051
|
-
displayName: 'Body Variables',
|
|
1052
|
-
name: 'templateBodyVars',
|
|
1053
|
-
type: 'fixedCollection',
|
|
1054
|
-
typeOptions: { multipleValues: true },
|
|
1055
|
-
default: {},
|
|
1056
|
-
placeholder: 'Add Variable',
|
|
1057
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'], messageType: ['template'] } },
|
|
1058
|
-
description: 'Values for {{1}}, {{2}}, etc. in the template body — add them in order',
|
|
1059
|
-
options: [
|
|
1060
|
-
{
|
|
1061
|
-
name: 'variable',
|
|
1062
|
-
displayName: 'Variable',
|
|
1063
|
-
values: [
|
|
1064
|
-
{
|
|
1065
|
-
displayName: 'Value',
|
|
1066
|
-
name: 'value',
|
|
1067
|
-
type: 'string',
|
|
1068
|
-
default: '',
|
|
1069
|
-
description: 'Text value for this variable position',
|
|
1070
|
-
},
|
|
1071
|
-
],
|
|
1072
|
-
},
|
|
1073
|
-
],
|
|
1074
|
-
},
|
|
1075
|
-
{
|
|
1076
|
-
displayName: 'Button URL Variables',
|
|
1077
|
-
name: 'templateButtonVars',
|
|
1078
|
-
type: 'fixedCollection',
|
|
1079
|
-
typeOptions: { multipleValues: true },
|
|
1080
|
-
default: {},
|
|
1081
|
-
placeholder: 'Add Button Variable',
|
|
1082
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'], messageType: ['template'] } },
|
|
1083
|
-
description: 'URL suffix variables for CTA buttons that contain {{1}}',
|
|
1084
|
-
options: [
|
|
1085
|
-
{
|
|
1086
|
-
name: 'variable',
|
|
1087
|
-
displayName: 'Variable',
|
|
1088
|
-
values: [
|
|
1089
|
-
{
|
|
1090
|
-
displayName: 'Button Index',
|
|
1091
|
-
name: 'buttonIndex',
|
|
1092
|
-
type: 'number',
|
|
1093
|
-
default: 0,
|
|
1094
|
-
description: 'Index of the button (0 = first button)',
|
|
1095
|
-
},
|
|
1096
|
-
{
|
|
1097
|
-
displayName: 'Value',
|
|
1098
|
-
name: 'value',
|
|
1099
|
-
type: 'string',
|
|
1100
|
-
default: '',
|
|
1101
|
-
description: 'URL parameter value',
|
|
1102
|
-
},
|
|
1103
|
-
],
|
|
1104
|
-
},
|
|
1105
|
-
],
|
|
1106
|
-
},
|
|
1107
|
-
// Media fields
|
|
1108
|
-
{
|
|
1109
|
-
displayName: 'Media ID or URL',
|
|
1110
|
-
name: 'mediaIdOrLink',
|
|
1111
|
-
type: 'string',
|
|
1112
|
-
required: true,
|
|
1113
|
-
default: '',
|
|
1114
|
-
placeholder: 'https://example.com/image.jpg or media-id-from-upload',
|
|
1115
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'], messageType: ['image', 'video', 'audio', 'document', 'sticker'] } },
|
|
1116
|
-
description: 'Either a URL (link) or a media ID obtained from Upload Media',
|
|
1117
|
-
},
|
|
1118
|
-
{
|
|
1119
|
-
displayName: 'Caption',
|
|
1120
|
-
name: 'mediaCaption',
|
|
1121
|
-
type: 'string',
|
|
1122
|
-
default: '',
|
|
1123
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'], messageType: ['image', 'video', 'document'] } },
|
|
1124
|
-
},
|
|
1125
|
-
{
|
|
1126
|
-
displayName: 'Filename',
|
|
1127
|
-
name: 'documentFilename',
|
|
1128
|
-
type: 'string',
|
|
1129
|
-
default: '',
|
|
1130
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'], messageType: ['document'] } },
|
|
1131
|
-
description: 'Document filename shown to recipient, e.g. report.pdf',
|
|
1132
|
-
},
|
|
1133
|
-
// Location fields
|
|
1134
|
-
{
|
|
1135
|
-
displayName: 'Latitude',
|
|
1136
|
-
name: 'locationLatitude',
|
|
1137
|
-
type: 'number',
|
|
1138
|
-
required: true,
|
|
1139
|
-
default: 0,
|
|
1140
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'], messageType: ['location'] } },
|
|
1141
|
-
},
|
|
1142
|
-
{
|
|
1143
|
-
displayName: 'Longitude',
|
|
1144
|
-
name: 'locationLongitude',
|
|
1145
|
-
type: 'number',
|
|
1146
|
-
required: true,
|
|
1147
|
-
default: 0,
|
|
1148
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'], messageType: ['location'] } },
|
|
1149
|
-
},
|
|
1150
|
-
{
|
|
1151
|
-
displayName: 'Location Name',
|
|
1152
|
-
name: 'locationName',
|
|
1153
|
-
type: 'string',
|
|
1154
|
-
default: '',
|
|
1155
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'], messageType: ['location'] } },
|
|
1156
|
-
},
|
|
1157
|
-
{
|
|
1158
|
-
displayName: 'Location Address',
|
|
1159
|
-
name: 'locationAddress',
|
|
1160
|
-
type: 'string',
|
|
1161
|
-
default: '',
|
|
1162
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'], messageType: ['location'] } },
|
|
1163
|
-
},
|
|
1164
|
-
// Interactive
|
|
1165
|
-
{
|
|
1166
|
-
displayName: 'Interactive (JSON)',
|
|
1167
|
-
name: 'interactiveJSON',
|
|
1168
|
-
type: 'string',
|
|
1169
|
-
required: true,
|
|
1170
|
-
typeOptions: { rows: 8 },
|
|
1171
|
-
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}',
|
|
1172
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'], messageType: ['interactive'] } },
|
|
1173
|
-
description: 'The "interactive" object for the WhatsApp message. See YCloud docs for structure.',
|
|
1174
|
-
},
|
|
1175
|
-
// Reaction
|
|
1176
|
-
{
|
|
1177
|
-
displayName: 'Message ID to React To',
|
|
1178
|
-
name: 'reactionMessageId',
|
|
1179
|
-
type: 'string',
|
|
1180
|
-
required: true,
|
|
1181
|
-
default: '',
|
|
1182
|
-
placeholder: 'wamid.xxx',
|
|
1183
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'], messageType: ['reaction'] } },
|
|
1184
|
-
},
|
|
1185
|
-
{
|
|
1186
|
-
displayName: 'Emoji',
|
|
1187
|
-
name: 'reactionEmoji',
|
|
1188
|
-
type: 'string',
|
|
1189
|
-
default: '',
|
|
1190
|
-
placeholder: '👍',
|
|
1191
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'], messageType: ['reaction'] } },
|
|
1192
|
-
description: 'Emoji to react with. Leave empty to remove an existing reaction.',
|
|
1193
|
-
},
|
|
1194
|
-
// Contacts
|
|
1195
|
-
{
|
|
1196
|
-
displayName: 'Contacts (JSON)',
|
|
1197
|
-
name: 'contactsJSON',
|
|
1198
|
-
type: 'string',
|
|
1199
|
-
required: true,
|
|
1200
|
-
typeOptions: { rows: 6 },
|
|
1201
|
-
default: '[{"name":{"first_name":"John","last_name":"Doe"},"phones":[{"phone":"+1234567890","type":"MOBILE"}]}]',
|
|
1202
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'], messageType: ['contacts'] } },
|
|
1203
|
-
description: 'Array of contact card objects',
|
|
1204
|
-
},
|
|
1205
|
-
// Retrieve
|
|
1206
|
-
{
|
|
1207
|
-
displayName: 'Message ID',
|
|
1208
|
-
name: 'waMessageId',
|
|
1209
|
-
type: 'string',
|
|
1210
|
-
required: true,
|
|
1211
|
-
default: '',
|
|
1212
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['retrieve'] } },
|
|
1213
|
-
},
|
|
1214
|
-
// Additional options (send/sendDirectly)
|
|
1215
|
-
{
|
|
1216
|
-
displayName: 'Additional Fields',
|
|
1217
|
-
name: 'additionalFields',
|
|
1218
|
-
type: 'collection',
|
|
1219
|
-
placeholder: 'Add Field',
|
|
1220
|
-
default: {},
|
|
1221
|
-
displayOptions: { show: { resource: ['whatsappMessage'], operation: ['sendDirectly', 'send'] } },
|
|
1222
|
-
options: [
|
|
1223
|
-
{ displayName: 'Context Message ID (Reply To)', name: 'contextMessageId', type: 'string', default: '' },
|
|
1224
|
-
{ displayName: 'External ID', name: 'externalId', type: 'string', default: '' },
|
|
1225
|
-
{ displayName: 'Filter Unsubscribed', name: 'filterUnsubscribed', type: 'boolean', default: false, description: 'Skip sending if the recipient has unsubscribed' },
|
|
1226
|
-
],
|
|
1227
|
-
},
|
|
1228
|
-
// ═══════════════════════════════════════════
|
|
1229
|
-
// WHATSAPP PHONE NUMBER
|
|
1230
|
-
// ═══════════════════════════════════════════
|
|
1231
|
-
{
|
|
1232
|
-
displayName: 'Operation',
|
|
1233
|
-
name: 'operation',
|
|
1234
|
-
type: 'options',
|
|
1235
|
-
noDataExpression: true,
|
|
1236
|
-
displayOptions: { show: { resource: ['whatsappPhoneNumber'] } },
|
|
1237
|
-
options: [
|
|
1238
|
-
{ name: 'Get', value: 'retrieve', action: 'Get a phone number' },
|
|
1239
|
-
{ name: 'Get Commerce Settings', value: 'retrieveCommerceSettings', action: 'Get commerce settings' },
|
|
1240
|
-
{ name: 'Get Many', value: 'list', action: 'Get many phone numbers' },
|
|
1241
|
-
{ name: 'Get Profile', value: 'retrieveProfile', action: 'Get phone number profile' },
|
|
1242
|
-
{ name: 'Get Settings', value: 'retrieveSettings', action: 'Get phone number settings' },
|
|
1243
|
-
{ name: 'Register', value: 'register', action: 'Register a phone number' },
|
|
1244
|
-
{ name: 'Save Settings', value: 'saveSettings', action: 'Save phone number settings' },
|
|
1245
|
-
{ name: 'Update Commerce Settings', value: 'updateCommerceSettings', action: 'Update commerce settings' },
|
|
1246
|
-
{ name: 'Update Display Name', value: 'updateDisplayName', action: 'Update display name' },
|
|
1247
|
-
{ name: 'Update Profile', value: 'updateProfile', action: 'Update phone number profile' },
|
|
1248
|
-
],
|
|
1249
|
-
default: 'list',
|
|
1250
|
-
},
|
|
1251
|
-
{
|
|
1252
|
-
displayName: 'WABA ID',
|
|
1253
|
-
name: 'phoneWabaId',
|
|
1254
|
-
type: 'string',
|
|
1255
|
-
required: true,
|
|
1256
|
-
default: '',
|
|
1257
|
-
displayOptions: { show: { resource: ['whatsappPhoneNumber'], operation: ['retrieve', 'retrieveProfile', 'updateProfile', 'updateDisplayName', 'retrieveCommerceSettings', 'updateCommerceSettings', 'register', 'retrieveSettings', 'saveSettings'] } },
|
|
1258
|
-
description: 'WhatsApp Business Account ID',
|
|
1259
|
-
},
|
|
1260
|
-
{
|
|
1261
|
-
displayName: 'Phone Number',
|
|
1262
|
-
name: 'phoneNumberParam',
|
|
1263
|
-
type: 'string',
|
|
1264
|
-
required: true,
|
|
1265
|
-
default: '',
|
|
1266
|
-
placeholder: '+16315551111',
|
|
1267
|
-
displayOptions: { show: { resource: ['whatsappPhoneNumber'], operation: ['retrieve', 'retrieveProfile', 'updateProfile', 'updateDisplayName', 'retrieveCommerceSettings', 'updateCommerceSettings', 'register', 'retrieveSettings', 'saveSettings'] } },
|
|
1268
|
-
},
|
|
1269
|
-
{
|
|
1270
|
-
displayName: 'Display Name',
|
|
1271
|
-
name: 'phoneDisplayName',
|
|
1272
|
-
type: 'string',
|
|
1273
|
-
required: true,
|
|
1274
|
-
default: '',
|
|
1275
|
-
displayOptions: { show: { resource: ['whatsappPhoneNumber'], operation: ['updateDisplayName'] } },
|
|
1276
|
-
},
|
|
1277
|
-
{
|
|
1278
|
-
displayName: 'Profile Fields',
|
|
1279
|
-
name: 'profileFields',
|
|
1280
|
-
type: 'collection',
|
|
1281
|
-
placeholder: 'Add Field',
|
|
1282
|
-
default: {},
|
|
1283
|
-
displayOptions: { show: { resource: ['whatsappPhoneNumber'], operation: ['updateProfile'] } },
|
|
1284
|
-
options: [
|
|
1285
|
-
{ displayName: 'About', name: 'about', type: 'string', default: '' },
|
|
1286
|
-
{ displayName: 'Address', name: 'address', type: 'string', default: '' },
|
|
1287
|
-
{ displayName: 'Description', name: 'description', type: 'string', default: '' },
|
|
1288
|
-
{ displayName: 'Email', name: 'email', type: 'string', default: '' },
|
|
1289
|
-
{ displayName: 'Profile Picture URL', name: 'profilePictureUrl', type: 'string', default: '' },
|
|
1290
|
-
{ displayName: 'Vertical', name: 'vertical', type: 'string', default: '', description: 'Business industry vertical' },
|
|
1291
|
-
{ displayName: 'Website 1', name: 'websites1', type: 'string', default: '' },
|
|
1292
|
-
{ displayName: 'Website 2', name: 'websites2', type: 'string', default: '' },
|
|
1293
|
-
],
|
|
1294
|
-
},
|
|
1295
|
-
{
|
|
1296
|
-
displayName: 'Commerce Settings (JSON)',
|
|
1297
|
-
name: 'commerceSettingsJson',
|
|
1298
|
-
type: 'string',
|
|
1299
|
-
typeOptions: { rows: 4 },
|
|
1300
|
-
default: '',
|
|
1301
|
-
displayOptions: { show: { resource: ['whatsappPhoneNumber'], operation: ['updateCommerceSettings'] } },
|
|
1302
|
-
description: 'Commerce settings JSON object',
|
|
1303
|
-
},
|
|
1304
|
-
{
|
|
1305
|
-
displayName: 'Settings (JSON)',
|
|
1306
|
-
name: 'phoneSettingsJson',
|
|
1307
|
-
type: 'string',
|
|
1308
|
-
typeOptions: { rows: 4 },
|
|
1309
|
-
default: '',
|
|
1310
|
-
displayOptions: { show: { resource: ['whatsappPhoneNumber'], operation: ['saveSettings'] } },
|
|
1311
|
-
description: 'Phone number settings JSON object',
|
|
1312
|
-
},
|
|
1313
|
-
{
|
|
1314
|
-
...returnAllField,
|
|
1315
|
-
displayOptions: { show: { resource: ['whatsappPhoneNumber'], operation: ['list'] } },
|
|
1316
|
-
},
|
|
1317
|
-
{
|
|
1318
|
-
...limitField,
|
|
1319
|
-
displayOptions: { show: { resource: ['whatsappPhoneNumber'], operation: ['list'], returnAll: [false] } },
|
|
1320
|
-
},
|
|
1321
|
-
// ═══════════════════════════════════════════
|
|
1322
|
-
// WHATSAPP TEMPLATE
|
|
1323
|
-
// ═══════════════════════════════════════════
|
|
1324
|
-
{
|
|
1325
|
-
displayName: 'Operation',
|
|
1326
|
-
name: 'operation',
|
|
1327
|
-
type: 'options',
|
|
1328
|
-
noDataExpression: true,
|
|
1329
|
-
displayOptions: { show: { resource: ['whatsappTemplate'] } },
|
|
1330
|
-
options: [
|
|
1331
|
-
{ name: 'Create', value: 'create', action: 'Create a WhatsApp template' },
|
|
1332
|
-
{ name: 'Delete by Name', value: 'deleteByName', action: 'Delete all templates with a name' },
|
|
1333
|
-
{ name: 'Delete by Name and Language', value: 'deleteByNameAndLanguage', action: 'Delete a specific template' },
|
|
1334
|
-
{ name: 'Edit', value: 'edit', action: 'Edit a WhatsApp template' },
|
|
1335
|
-
{ name: 'Get', value: 'retrieve', action: 'Get a WhatsApp template' },
|
|
1336
|
-
{ name: 'Get Many', value: 'list', action: 'Get many WhatsApp templates' },
|
|
1337
|
-
],
|
|
1338
|
-
default: 'list',
|
|
1339
|
-
},
|
|
1340
|
-
{
|
|
1341
|
-
displayName: 'WABA ID',
|
|
1342
|
-
name: 'templateWabaId',
|
|
1343
|
-
type: 'string',
|
|
1344
|
-
required: true,
|
|
1345
|
-
default: '',
|
|
1346
|
-
displayOptions: { show: { resource: ['whatsappTemplate'], operation: ['create', 'deleteByName', 'deleteByNameAndLanguage', 'edit', 'retrieve'] } },
|
|
1347
|
-
description: 'WhatsApp Business Account ID',
|
|
1348
|
-
},
|
|
1349
|
-
{
|
|
1350
|
-
displayName: 'Template Name',
|
|
1351
|
-
name: 'templateCreateName',
|
|
1352
|
-
type: 'string',
|
|
1353
|
-
required: true,
|
|
1354
|
-
default: '',
|
|
1355
|
-
placeholder: 'order_confirmation',
|
|
1356
|
-
displayOptions: { show: { resource: ['whatsappTemplate'], operation: ['create', 'deleteByName', 'deleteByNameAndLanguage', 'edit', 'retrieve'] } },
|
|
1357
|
-
description: 'Lowercase letters, numbers and underscores only',
|
|
1358
|
-
},
|
|
1359
|
-
{
|
|
1360
|
-
displayName: 'Language',
|
|
1361
|
-
name: 'templateCreateLanguage',
|
|
1362
|
-
type: 'string',
|
|
1363
|
-
required: true,
|
|
1364
|
-
default: 'en',
|
|
1365
|
-
placeholder: 'en, pt_BR, es',
|
|
1366
|
-
displayOptions: { show: { resource: ['whatsappTemplate'], operation: ['create', 'deleteByNameAndLanguage', 'edit', 'retrieve'] } },
|
|
1367
|
-
},
|
|
1368
|
-
{
|
|
1369
|
-
displayName: 'Category',
|
|
1370
|
-
name: 'templateCategory',
|
|
1371
|
-
type: 'options',
|
|
1372
|
-
required: true,
|
|
1373
|
-
default: 'UTILITY',
|
|
1374
|
-
displayOptions: { show: { resource: ['whatsappTemplate'], operation: ['create'] } },
|
|
1375
|
-
options: [
|
|
1376
|
-
{ name: 'Authentication', value: 'AUTHENTICATION' },
|
|
1377
|
-
{ name: 'Marketing', value: 'MARKETING' },
|
|
1378
|
-
{ name: 'Utility', value: 'UTILITY' },
|
|
1379
|
-
],
|
|
1380
|
-
},
|
|
1381
|
-
{
|
|
1382
|
-
displayName: 'Components (JSON)',
|
|
1383
|
-
name: 'templateComponentsJson',
|
|
1384
|
-
type: 'string',
|
|
1385
|
-
required: true,
|
|
1386
|
-
typeOptions: { rows: 10 },
|
|
1387
|
-
default: '[{"type":"BODY","text":"Hello {{1}}, your order {{2}} is confirmed."}]',
|
|
1388
|
-
displayOptions: { show: { resource: ['whatsappTemplate'], operation: ['create', 'edit'] } },
|
|
1389
|
-
description: 'Array of template component objects (HEADER, BODY, FOOTER, BUTTONS). See Meta / YCloud docs.',
|
|
1390
|
-
},
|
|
1391
|
-
{
|
|
1392
|
-
...returnAllField,
|
|
1393
|
-
displayOptions: { show: { resource: ['whatsappTemplate'], operation: ['list'] } },
|
|
1394
|
-
},
|
|
1395
|
-
{
|
|
1396
|
-
...limitField,
|
|
1397
|
-
displayOptions: { show: { resource: ['whatsappTemplate'], operation: ['list'], returnAll: [false] } },
|
|
1398
|
-
},
|
|
1399
|
-
{
|
|
1400
|
-
displayName: 'Filters',
|
|
1401
|
-
name: 'filters',
|
|
1402
|
-
type: 'collection',
|
|
1403
|
-
placeholder: 'Add Filter',
|
|
1404
|
-
default: {},
|
|
1405
|
-
displayOptions: { show: { resource: ['whatsappTemplate'], operation: ['list'] } },
|
|
1406
|
-
options: [
|
|
1407
|
-
{ displayName: 'WABA ID', name: 'wabaId', type: 'string', default: '' },
|
|
1408
|
-
],
|
|
1409
|
-
},
|
|
1410
|
-
];
|
|
1411
|
-
// ─── Main Node ────────────────────────────────────────────────────────────────
|
|
38
|
+
const descriptions_1 = require("./descriptions");
|
|
39
|
+
const methods_1 = require("./methods");
|
|
40
|
+
const actions = __importStar(require("./actions"));
|
|
1412
41
|
class YCloud {
|
|
1413
42
|
constructor() {
|
|
1414
43
|
this.description = {
|
|
@@ -1423,838 +52,41 @@ class YCloud {
|
|
|
1423
52
|
inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
1424
53
|
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
1425
54
|
credentials: [{ name: 'yCloudApi', required: true }],
|
|
1426
|
-
properties,
|
|
1427
|
-
};
|
|
1428
|
-
this.methods = {
|
|
1429
|
-
loadOptions: {
|
|
1430
|
-
async getTemplateLanguages() {
|
|
1431
|
-
const response = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', '/whatsapp/templates', undefined, {
|
|
1432
|
-
limit: 100,
|
|
1433
|
-
});
|
|
1434
|
-
const items = (response.items || []);
|
|
1435
|
-
const langs = [...new Set(items.map((t) => t.language))].filter(Boolean).sort();
|
|
1436
|
-
return langs.map((l) => ({ name: l, value: l }));
|
|
1437
|
-
},
|
|
1438
|
-
},
|
|
1439
|
-
listSearch: {
|
|
1440
|
-
async getTemplates(filter) {
|
|
1441
|
-
const response = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', '/whatsapp/templates', undefined, {
|
|
1442
|
-
limit: 100,
|
|
1443
|
-
});
|
|
1444
|
-
const items = (response.items || []);
|
|
1445
|
-
const results = items
|
|
1446
|
-
.filter((t) => { var _a; return !filter || ((_a = t.name) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(filter.toLowerCase())); })
|
|
1447
|
-
.map((t) => ({
|
|
1448
|
-
name: `${t.name} (${t.language})`,
|
|
1449
|
-
value: t.name,
|
|
1450
|
-
description: `${t.category || ''} — ${t.status || ''}`,
|
|
1451
|
-
}));
|
|
1452
|
-
return { results };
|
|
1453
|
-
},
|
|
1454
|
-
async getWhatsAppPhoneNumbers(filter) {
|
|
1455
|
-
const response = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', '/whatsapp/phoneNumbers');
|
|
1456
|
-
const items = (response.items || []);
|
|
1457
|
-
const results = items
|
|
1458
|
-
.filter((n) => {
|
|
1459
|
-
var _a, _b;
|
|
1460
|
-
return !filter ||
|
|
1461
|
-
((_a = n.displayPhoneNumber) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(filter.toLowerCase())) ||
|
|
1462
|
-
((_b = n.verifiedName) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(filter.toLowerCase()));
|
|
1463
|
-
})
|
|
1464
|
-
.map((n) => ({
|
|
1465
|
-
name: `${n.displayPhoneNumber || n.phoneNumber} — ${n.verifiedName || n.id}`,
|
|
1466
|
-
value: n.phoneNumber,
|
|
1467
|
-
}));
|
|
1468
|
-
return { results };
|
|
1469
|
-
},
|
|
1470
|
-
async getContacts(filter) {
|
|
1471
|
-
const response = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', '/contacts', undefined, {
|
|
1472
|
-
limit: 100,
|
|
1473
|
-
});
|
|
1474
|
-
const items = (response.items || []);
|
|
1475
|
-
const results = items
|
|
1476
|
-
.filter((c) => {
|
|
1477
|
-
var _a, _b;
|
|
1478
|
-
return !filter ||
|
|
1479
|
-
((_a = c.nickname) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(filter.toLowerCase())) ||
|
|
1480
|
-
((_b = c.phoneNumber) === null || _b === void 0 ? void 0 : _b.includes(filter));
|
|
1481
|
-
})
|
|
1482
|
-
.map((c) => ({
|
|
1483
|
-
name: `${c.nickname || c.phoneNumber} — ${c.phoneNumber}`,
|
|
1484
|
-
value: c.phoneNumber,
|
|
1485
|
-
}));
|
|
1486
|
-
return { results };
|
|
1487
|
-
},
|
|
1488
|
-
},
|
|
55
|
+
properties: descriptions_1.properties,
|
|
1489
56
|
};
|
|
57
|
+
this.methods = methods_1.methods;
|
|
1490
58
|
}
|
|
1491
59
|
async execute() {
|
|
1492
60
|
const items = this.getInputData();
|
|
1493
61
|
const returnData = [];
|
|
1494
62
|
const resource = this.getNodeParameter('resource', 0);
|
|
1495
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
|
+
}
|
|
1496
87
|
for (let i = 0; i < items.length; i++) {
|
|
1497
88
|
try {
|
|
1498
|
-
|
|
1499
|
-
// ─── BALANCE ───────────────────────────────
|
|
1500
|
-
if (resource === 'balance') {
|
|
1501
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', '/balance');
|
|
1502
|
-
}
|
|
1503
|
-
// ─── CONTACT ───────────────────────────────
|
|
1504
|
-
else if (resource === 'contact') {
|
|
1505
|
-
if (operation === 'create') {
|
|
1506
|
-
const phoneNumber = this.getNodeParameter('phoneNumber', i);
|
|
1507
|
-
const af = this.getNodeParameter('additionalFields', i);
|
|
1508
|
-
const body = { phoneNumber };
|
|
1509
|
-
if (af.nickname)
|
|
1510
|
-
body.nickname = af.nickname;
|
|
1511
|
-
if (af.countryCode)
|
|
1512
|
-
body.countryCode = af.countryCode;
|
|
1513
|
-
if (af.email)
|
|
1514
|
-
body.email = af.email;
|
|
1515
|
-
if (af.ownerEmail)
|
|
1516
|
-
body.ownerEmail = af.ownerEmail;
|
|
1517
|
-
if (af.tags)
|
|
1518
|
-
body.tags = af.tags.split(',').map((t) => t.trim()).filter(Boolean);
|
|
1519
|
-
if (af.customAttributes)
|
|
1520
|
-
body.customAttributes = JSON.parse(af.customAttributes);
|
|
1521
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/contact/contacts', body);
|
|
1522
|
-
}
|
|
1523
|
-
else if (operation === 'list') {
|
|
1524
|
-
const returnAll = this.getNodeParameter('returnAll', i);
|
|
1525
|
-
if (returnAll) {
|
|
1526
|
-
responseData = await GenericFunctions_1.ycloudApiRequestAllItems.call(this, 'GET', '/contact/contacts');
|
|
1527
|
-
}
|
|
1528
|
-
else {
|
|
1529
|
-
const limit = this.getNodeParameter('limit', i);
|
|
1530
|
-
const resp = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', '/contact/contacts', {}, { limit });
|
|
1531
|
-
responseData = resp.items || [];
|
|
1532
|
-
}
|
|
1533
|
-
}
|
|
1534
|
-
else if (operation === 'retrieve') {
|
|
1535
|
-
const id = this.getNodeParameter('contactId', i, '', { extractValue: true });
|
|
1536
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `/contact/contacts/${id}`);
|
|
1537
|
-
}
|
|
1538
|
-
else if (operation === 'update') {
|
|
1539
|
-
const id = this.getNodeParameter('contactId', i, '', { extractValue: true });
|
|
1540
|
-
const af = this.getNodeParameter('additionalFields', i);
|
|
1541
|
-
const body = {};
|
|
1542
|
-
if (af.phoneNumber)
|
|
1543
|
-
body.phoneNumber = af.phoneNumber;
|
|
1544
|
-
if (af.nickname)
|
|
1545
|
-
body.nickname = af.nickname;
|
|
1546
|
-
if (af.countryCode)
|
|
1547
|
-
body.countryCode = af.countryCode;
|
|
1548
|
-
if (af.email)
|
|
1549
|
-
body.email = af.email;
|
|
1550
|
-
if (af.ownerEmail)
|
|
1551
|
-
body.ownerEmail = af.ownerEmail;
|
|
1552
|
-
if (af.tags)
|
|
1553
|
-
body.tags = af.tags.split(',').map((t) => t.trim()).filter(Boolean);
|
|
1554
|
-
if (af.customAttributes)
|
|
1555
|
-
body.customAttributes = JSON.parse(af.customAttributes);
|
|
1556
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'PATCH', `/contact/contacts/${id}`, body);
|
|
1557
|
-
}
|
|
1558
|
-
else if (operation === 'delete') {
|
|
1559
|
-
const id = this.getNodeParameter('contactId', i, '', { extractValue: true });
|
|
1560
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'DELETE', `/contact/contacts/${id}`);
|
|
1561
|
-
}
|
|
1562
|
-
else if (operation === 'listAttributes') {
|
|
1563
|
-
const resp = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', '/contact/contacts/attributes');
|
|
1564
|
-
responseData = resp.items || resp;
|
|
1565
|
-
}
|
|
1566
|
-
else {
|
|
1567
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
1568
|
-
}
|
|
1569
|
-
}
|
|
1570
|
-
// ─── CUSTOM EVENT ──────────────────────────
|
|
1571
|
-
else if (resource === 'customEvent') {
|
|
1572
|
-
const defName = operation !== 'sendEvent' ? this.getNodeParameter('eventDefinitionName', i) : '';
|
|
1573
|
-
if (operation === 'createDefinition') {
|
|
1574
|
-
const af = this.getNodeParameter('additionalFields', i);
|
|
1575
|
-
const body = { name: defName };
|
|
1576
|
-
if (af.label)
|
|
1577
|
-
body.label = af.label;
|
|
1578
|
-
if (af.description)
|
|
1579
|
-
body.description = af.description;
|
|
1580
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/event/definitions', body);
|
|
1581
|
-
}
|
|
1582
|
-
else if (operation === 'retrieveDefinition') {
|
|
1583
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `/event/definitions/${defName}`);
|
|
1584
|
-
}
|
|
1585
|
-
else if (operation === 'updateDefinition') {
|
|
1586
|
-
const af = this.getNodeParameter('additionalFields', i);
|
|
1587
|
-
const body = {};
|
|
1588
|
-
if (af.label)
|
|
1589
|
-
body.label = af.label;
|
|
1590
|
-
if (af.description)
|
|
1591
|
-
body.description = af.description;
|
|
1592
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'PATCH', `/event/definitions/${defName}`, body);
|
|
1593
|
-
}
|
|
1594
|
-
else if (operation === 'createPropertyDef') {
|
|
1595
|
-
const propName = this.getNodeParameter('propertyName', i);
|
|
1596
|
-
const propType = this.getNodeParameter('propertyType', i);
|
|
1597
|
-
const af = this.getNodeParameter('additionalFields', i);
|
|
1598
|
-
const body = { name: propName, type: propType };
|
|
1599
|
-
if (af.label)
|
|
1600
|
-
body.label = af.label;
|
|
1601
|
-
if (af.description)
|
|
1602
|
-
body.description = af.description;
|
|
1603
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', `/event/definitions/${defName}/properties`, body);
|
|
1604
|
-
}
|
|
1605
|
-
else if (operation === 'updatePropertyDef') {
|
|
1606
|
-
const propName = this.getNodeParameter('propertyName', i);
|
|
1607
|
-
const af = this.getNodeParameter('additionalFields', i);
|
|
1608
|
-
const body = {};
|
|
1609
|
-
if (af.label)
|
|
1610
|
-
body.label = af.label;
|
|
1611
|
-
if (af.description)
|
|
1612
|
-
body.description = af.description;
|
|
1613
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'PATCH', `/event/definitions/${defName}/properties/${propName}`, body);
|
|
1614
|
-
}
|
|
1615
|
-
else if (operation === 'deletePropertyDef') {
|
|
1616
|
-
const propName = this.getNodeParameter('propertyName', i);
|
|
1617
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'DELETE', `/event/definitions/${defName}/properties/${propName}`);
|
|
1618
|
-
}
|
|
1619
|
-
else if (operation === 'sendEvent') {
|
|
1620
|
-
const eventName = this.getNodeParameter('eventName', i);
|
|
1621
|
-
const phone = this.getNodeParameter('eventPhoneNumber', i);
|
|
1622
|
-
const propsJson = this.getNodeParameter('eventProperties', i, '');
|
|
1623
|
-
const body = { name: eventName, phone };
|
|
1624
|
-
if (propsJson)
|
|
1625
|
-
body.properties = JSON.parse(propsJson);
|
|
1626
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/event/events', body);
|
|
1627
|
-
}
|
|
1628
|
-
else {
|
|
1629
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
1630
|
-
}
|
|
1631
|
-
}
|
|
1632
|
-
// ─── EMAIL ─────────────────────────────────
|
|
1633
|
-
else if (resource === 'email') {
|
|
1634
|
-
if (operation === 'send') {
|
|
1635
|
-
const from = this.getNodeParameter('emailFrom', i);
|
|
1636
|
-
const to = this.getNodeParameter('emailTo', i);
|
|
1637
|
-
const subject = this.getNodeParameter('emailSubject', i);
|
|
1638
|
-
const content = this.getNodeParameter('emailContent', i);
|
|
1639
|
-
const af = this.getNodeParameter('additionalFields', i);
|
|
1640
|
-
const body = { from, to, subject, content };
|
|
1641
|
-
if (af.contentType)
|
|
1642
|
-
body.contentType = af.contentType;
|
|
1643
|
-
if (af.replyTo)
|
|
1644
|
-
body.replyTo = af.replyTo;
|
|
1645
|
-
if (af.externalId)
|
|
1646
|
-
body.externalId = af.externalId;
|
|
1647
|
-
if (af.callbackUrl)
|
|
1648
|
-
body.callbackUrl = af.callbackUrl;
|
|
1649
|
-
if (af.variables)
|
|
1650
|
-
body.variables = JSON.parse(af.variables);
|
|
1651
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/emails', body);
|
|
1652
|
-
}
|
|
1653
|
-
else {
|
|
1654
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
1655
|
-
}
|
|
1656
|
-
}
|
|
1657
|
-
// ─── SMS ────────────────────────────────────
|
|
1658
|
-
else if (resource === 'sms') {
|
|
1659
|
-
if (operation === 'send') {
|
|
1660
|
-
const to = this.getNodeParameter('smsTo', i);
|
|
1661
|
-
const text = this.getNodeParameter('smsText', i);
|
|
1662
|
-
const af = this.getNodeParameter('additionalFields', i);
|
|
1663
|
-
const body = { to, text };
|
|
1664
|
-
if (af.senderId)
|
|
1665
|
-
body.senderId = af.senderId;
|
|
1666
|
-
if (af.signature)
|
|
1667
|
-
body.signature = af.signature;
|
|
1668
|
-
if (af.externalId)
|
|
1669
|
-
body.externalId = af.externalId;
|
|
1670
|
-
if (af.callbackUrl)
|
|
1671
|
-
body.callbackUrl = af.callbackUrl;
|
|
1672
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/sms', body);
|
|
1673
|
-
}
|
|
1674
|
-
else if (operation === 'list') {
|
|
1675
|
-
const returnAll = this.getNodeParameter('returnAll', i);
|
|
1676
|
-
const filters = this.getNodeParameter('filters', i, {});
|
|
1677
|
-
const qs = {};
|
|
1678
|
-
if (filters.id)
|
|
1679
|
-
qs['filter.id'] = filters.id;
|
|
1680
|
-
if (filters.createTimeGte)
|
|
1681
|
-
qs['filter.createTime.gte'] = filters.createTimeGte;
|
|
1682
|
-
if (filters.createTimeLte)
|
|
1683
|
-
qs['filter.createTime.lte'] = filters.createTimeLte;
|
|
1684
|
-
if (returnAll) {
|
|
1685
|
-
responseData = await GenericFunctions_1.ycloudApiRequestAllItems.call(this, 'GET', '/sms', {}, qs);
|
|
1686
|
-
}
|
|
1687
|
-
else {
|
|
1688
|
-
const limit = this.getNodeParameter('limit', i);
|
|
1689
|
-
qs.limit = limit;
|
|
1690
|
-
const resp = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', '/sms', {}, qs);
|
|
1691
|
-
responseData = resp.items || [];
|
|
1692
|
-
}
|
|
1693
|
-
}
|
|
1694
|
-
else {
|
|
1695
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
1696
|
-
}
|
|
1697
|
-
}
|
|
1698
|
-
// ─── UNSUBSCRIBER ───────────────────────────
|
|
1699
|
-
else if (resource === 'unsubscriber') {
|
|
1700
|
-
if (operation === 'create') {
|
|
1701
|
-
const customer = this.getNodeParameter('unsubCreateCustomer', i);
|
|
1702
|
-
const channel = this.getNodeParameter('unsubChannel', i);
|
|
1703
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/unsubscribers', { customer, channel });
|
|
1704
|
-
}
|
|
1705
|
-
else if (operation === 'list') {
|
|
1706
|
-
const returnAll = this.getNodeParameter('returnAll', i);
|
|
1707
|
-
if (returnAll) {
|
|
1708
|
-
responseData = await GenericFunctions_1.ycloudApiRequestAllItems.call(this, 'GET', '/unsubscribers');
|
|
1709
|
-
}
|
|
1710
|
-
else {
|
|
1711
|
-
const limit = this.getNodeParameter('limit', i);
|
|
1712
|
-
const resp = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', '/unsubscribers', {}, { limit });
|
|
1713
|
-
responseData = resp.items || [];
|
|
1714
|
-
}
|
|
1715
|
-
}
|
|
1716
|
-
else if (operation === 'listByCustomer') {
|
|
1717
|
-
const customer = this.getNodeParameter('unsubCustomer', i);
|
|
1718
|
-
const resp = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `/unsubscribers/${encodeURIComponent(customer)}`);
|
|
1719
|
-
responseData = resp.items || resp;
|
|
1720
|
-
}
|
|
1721
|
-
else if (operation === 'retrieve') {
|
|
1722
|
-
const customer = this.getNodeParameter('unsubCustomer', i);
|
|
1723
|
-
const channel = this.getNodeParameter('unsubChannel', i);
|
|
1724
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `/unsubscribers/${encodeURIComponent(customer)}/${channel}`);
|
|
1725
|
-
}
|
|
1726
|
-
else if (operation === 'delete') {
|
|
1727
|
-
const customer = this.getNodeParameter('unsubCustomer', i);
|
|
1728
|
-
const channel = this.getNodeParameter('unsubChannel', i);
|
|
1729
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'DELETE', `/unsubscribers/${encodeURIComponent(customer)}/${channel}`);
|
|
1730
|
-
}
|
|
1731
|
-
else {
|
|
1732
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
1733
|
-
}
|
|
1734
|
-
}
|
|
1735
|
-
// ─── VERIFICATION ───────────────────────────
|
|
1736
|
-
else if (resource === 'verification') {
|
|
1737
|
-
if (operation === 'send') {
|
|
1738
|
-
const channel = this.getNodeParameter('verificationChannel', i);
|
|
1739
|
-
const to = this.getNodeParameter('verificationTo', i);
|
|
1740
|
-
const af = this.getNodeParameter('additionalFields', i);
|
|
1741
|
-
const body = { channel, to };
|
|
1742
|
-
if (af.code)
|
|
1743
|
-
body.code = af.code;
|
|
1744
|
-
if (af.language)
|
|
1745
|
-
body.language = af.language;
|
|
1746
|
-
if (af.senderId)
|
|
1747
|
-
body.senderId = af.senderId;
|
|
1748
|
-
if (af.signature)
|
|
1749
|
-
body.signature = af.signature;
|
|
1750
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/verify/verifications', body);
|
|
1751
|
-
}
|
|
1752
|
-
else if (operation === 'check') {
|
|
1753
|
-
const code = this.getNodeParameter('verificationCode', i);
|
|
1754
|
-
const identification = this.getNodeParameter('verificationIdentification', i);
|
|
1755
|
-
const body = { code };
|
|
1756
|
-
if (identification.verificationId)
|
|
1757
|
-
body.verificationId = identification.verificationId;
|
|
1758
|
-
if (identification.to)
|
|
1759
|
-
body.to = identification.to;
|
|
1760
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/verify/verificationChecks', body);
|
|
1761
|
-
}
|
|
1762
|
-
else {
|
|
1763
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
1764
|
-
}
|
|
1765
|
-
}
|
|
1766
|
-
// ─── VOICE ──────────────────────────────────
|
|
1767
|
-
else if (resource === 'voice') {
|
|
1768
|
-
if (operation === 'send') {
|
|
1769
|
-
const to = this.getNodeParameter('voiceTo', i);
|
|
1770
|
-
const verificationCode = this.getNodeParameter('voiceCode', i);
|
|
1771
|
-
const af = this.getNodeParameter('additionalFields', i);
|
|
1772
|
-
const body = { to, verificationCode };
|
|
1773
|
-
if (af.language)
|
|
1774
|
-
body.language = af.language;
|
|
1775
|
-
if (af.externalId)
|
|
1776
|
-
body.externalId = af.externalId;
|
|
1777
|
-
if (af.callbackUrl)
|
|
1778
|
-
body.callbackUrl = af.callbackUrl;
|
|
1779
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/voices', body);
|
|
1780
|
-
}
|
|
1781
|
-
else if (operation === 'list') {
|
|
1782
|
-
const returnAll = this.getNodeParameter('returnAll', i);
|
|
1783
|
-
if (returnAll) {
|
|
1784
|
-
responseData = await GenericFunctions_1.ycloudApiRequestAllItems.call(this, 'GET', '/voices');
|
|
1785
|
-
}
|
|
1786
|
-
else {
|
|
1787
|
-
const limit = this.getNodeParameter('limit', i);
|
|
1788
|
-
const resp = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', '/voices', {}, { limit });
|
|
1789
|
-
responseData = resp.items || [];
|
|
1790
|
-
}
|
|
1791
|
-
}
|
|
1792
|
-
else {
|
|
1793
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
1794
|
-
}
|
|
1795
|
-
}
|
|
1796
|
-
// ─── WEBHOOK ENDPOINT ───────────────────────
|
|
1797
|
-
else if (resource === 'webhookEndpoint') {
|
|
1798
|
-
if (operation === 'create') {
|
|
1799
|
-
const url = this.getNodeParameter('webhookUrl', i);
|
|
1800
|
-
const enabledEvents = this.getNodeParameter('webhookEvents', i);
|
|
1801
|
-
const af = this.getNodeParameter('additionalFields', i);
|
|
1802
|
-
const body = { url, enabledEvents };
|
|
1803
|
-
if (af.description)
|
|
1804
|
-
body.description = af.description;
|
|
1805
|
-
if (af.status)
|
|
1806
|
-
body.status = af.status;
|
|
1807
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/webhookEndpoints', body);
|
|
1808
|
-
}
|
|
1809
|
-
else if (operation === 'list') {
|
|
1810
|
-
const returnAll = this.getNodeParameter('returnAll', i);
|
|
1811
|
-
if (returnAll) {
|
|
1812
|
-
responseData = await GenericFunctions_1.ycloudApiRequestAllItems.call(this, 'GET', '/webhookEndpoints');
|
|
1813
|
-
}
|
|
1814
|
-
else {
|
|
1815
|
-
const limit = this.getNodeParameter('limit', i);
|
|
1816
|
-
const resp = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', '/webhookEndpoints', {}, { limit });
|
|
1817
|
-
responseData = resp.items || [];
|
|
1818
|
-
}
|
|
1819
|
-
}
|
|
1820
|
-
else if (operation === 'retrieve') {
|
|
1821
|
-
const id = this.getNodeParameter('webhookEndpointId', i);
|
|
1822
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `/webhookEndpoints/${id}`);
|
|
1823
|
-
}
|
|
1824
|
-
else if (operation === 'update') {
|
|
1825
|
-
const id = this.getNodeParameter('webhookEndpointId', i);
|
|
1826
|
-
const af = this.getNodeParameter('additionalFields', i);
|
|
1827
|
-
const body = {};
|
|
1828
|
-
if (af.url)
|
|
1829
|
-
body.url = af.url;
|
|
1830
|
-
if (af.description)
|
|
1831
|
-
body.description = af.description;
|
|
1832
|
-
if (af.status)
|
|
1833
|
-
body.status = af.status;
|
|
1834
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'PATCH', `/webhookEndpoints/${id}`, body);
|
|
1835
|
-
}
|
|
1836
|
-
else if (operation === 'delete') {
|
|
1837
|
-
const id = this.getNodeParameter('webhookEndpointId', i);
|
|
1838
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'DELETE', `/webhookEndpoints/${id}`);
|
|
1839
|
-
}
|
|
1840
|
-
else if (operation === 'rotateSecret') {
|
|
1841
|
-
const id = this.getNodeParameter('webhookEndpointId', i);
|
|
1842
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', `/webhookEndpoints/${id}/rotateSecret`);
|
|
1843
|
-
}
|
|
1844
|
-
else {
|
|
1845
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
1846
|
-
}
|
|
1847
|
-
}
|
|
1848
|
-
// ─── WHATSAPP BUSINESS ACCOUNT ─────────────
|
|
1849
|
-
else if (resource === 'whatsappBusinessAccount') {
|
|
1850
|
-
if (operation === 'list') {
|
|
1851
|
-
const returnAll = this.getNodeParameter('returnAll', i);
|
|
1852
|
-
if (returnAll) {
|
|
1853
|
-
responseData = await GenericFunctions_1.ycloudApiRequestAllItems.call(this, 'GET', '/whatsapp/businessAccounts');
|
|
1854
|
-
}
|
|
1855
|
-
else {
|
|
1856
|
-
const limit = this.getNodeParameter('limit', i);
|
|
1857
|
-
const resp = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', '/whatsapp/businessAccounts', {}, { limit });
|
|
1858
|
-
responseData = resp.items || [];
|
|
1859
|
-
}
|
|
1860
|
-
}
|
|
1861
|
-
else if (operation === 'retrieve') {
|
|
1862
|
-
const id = this.getNodeParameter('wabaId', i);
|
|
1863
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `/whatsapp/businessAccounts/${id}`);
|
|
1864
|
-
}
|
|
1865
|
-
else {
|
|
1866
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
1867
|
-
}
|
|
1868
|
-
}
|
|
1869
|
-
// ─── WHATSAPP CALLING ───────────────────────
|
|
1870
|
-
else if (resource === 'whatsappCalling') {
|
|
1871
|
-
if (operation === 'connect') {
|
|
1872
|
-
const from = this.getNodeParameter('callingFrom', i);
|
|
1873
|
-
const to = this.getNodeParameter('callingTo', i);
|
|
1874
|
-
const sdp = this.getNodeParameter('callingSdp', i);
|
|
1875
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/whatsapp/calls/connect', { from, to, sdpType: 'offer', sdp });
|
|
1876
|
-
}
|
|
1877
|
-
else if (operation === 'preAccept') {
|
|
1878
|
-
const phoneId = this.getNodeParameter('callingPhoneId', i);
|
|
1879
|
-
const wacid = this.getNodeParameter('callingWacid', i);
|
|
1880
|
-
const sdp = this.getNodeParameter('callingSdp', i);
|
|
1881
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/whatsapp/calls/preAccept', { phoneId, wacid, sdpType: 'answer', sdp });
|
|
1882
|
-
}
|
|
1883
|
-
else if (operation === 'accept') {
|
|
1884
|
-
const phoneId = this.getNodeParameter('callingPhoneId', i);
|
|
1885
|
-
const wacid = this.getNodeParameter('callingWacid', i);
|
|
1886
|
-
const sdp = this.getNodeParameter('callingSdp', i);
|
|
1887
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/whatsapp/calls/accept', { phoneId, wacid, sdpType: 'answer', sdp });
|
|
1888
|
-
}
|
|
1889
|
-
else if (operation === 'terminate') {
|
|
1890
|
-
const phoneId = this.getNodeParameter('callingPhoneId', i);
|
|
1891
|
-
const wacid = this.getNodeParameter('callingWacid', i);
|
|
1892
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/whatsapp/calls/terminate', { phoneId, wacid });
|
|
1893
|
-
}
|
|
1894
|
-
else if (operation === 'reject') {
|
|
1895
|
-
const phoneId = this.getNodeParameter('callingPhoneId', i);
|
|
1896
|
-
const wacid = this.getNodeParameter('callingWacid', i);
|
|
1897
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/whatsapp/calls/reject', { phoneId, wacid });
|
|
1898
|
-
}
|
|
1899
|
-
else {
|
|
1900
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
1901
|
-
}
|
|
1902
|
-
}
|
|
1903
|
-
// ─── WHATSAPP FLOW ──────────────────────────
|
|
1904
|
-
else if (resource === 'whatsappFlow') {
|
|
1905
|
-
if (operation === 'create') {
|
|
1906
|
-
const wabaId = this.getNodeParameter('flowWabaId', i);
|
|
1907
|
-
const name = this.getNodeParameter('flowName', i);
|
|
1908
|
-
const categories = [this.getNodeParameter('flowCategory', i)];
|
|
1909
|
-
const af = this.getNodeParameter('additionalFields', i);
|
|
1910
|
-
const body = { wabaId, name, categories };
|
|
1911
|
-
if (af.flowJson)
|
|
1912
|
-
body.flowJson = af.flowJson;
|
|
1913
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/whatsapp/flows', body);
|
|
1914
|
-
}
|
|
1915
|
-
else if (operation === 'list') {
|
|
1916
|
-
const returnAll = this.getNodeParameter('returnAll', i);
|
|
1917
|
-
if (returnAll) {
|
|
1918
|
-
responseData = await GenericFunctions_1.ycloudApiRequestAllItems.call(this, 'GET', '/whatsapp/flows');
|
|
1919
|
-
}
|
|
1920
|
-
else {
|
|
1921
|
-
const limit = this.getNodeParameter('limit', i);
|
|
1922
|
-
const resp = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', '/whatsapp/flows', {}, { limit });
|
|
1923
|
-
responseData = resp.items || [];
|
|
1924
|
-
}
|
|
1925
|
-
}
|
|
1926
|
-
else if (operation === 'retrieve') {
|
|
1927
|
-
const flowId = this.getNodeParameter('flowId', i);
|
|
1928
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `/whatsapp/flows/${flowId}`);
|
|
1929
|
-
}
|
|
1930
|
-
else if (operation === 'updateMetadata') {
|
|
1931
|
-
const flowId = this.getNodeParameter('flowId', i);
|
|
1932
|
-
const af = this.getNodeParameter('additionalFields', i);
|
|
1933
|
-
const body = {};
|
|
1934
|
-
if (af.name)
|
|
1935
|
-
body.name = af.name;
|
|
1936
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'PATCH', `/whatsapp/flows/${flowId}/metadata`, body);
|
|
1937
|
-
}
|
|
1938
|
-
else if (operation === 'updateStructure') {
|
|
1939
|
-
const flowId = this.getNodeParameter('flowId', i);
|
|
1940
|
-
const flowJson = this.getNodeParameter('flowAssetJson', i);
|
|
1941
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'PATCH', `/whatsapp/flows/${flowId}/assets`, { flowJson });
|
|
1942
|
-
}
|
|
1943
|
-
else if (operation === 'delete') {
|
|
1944
|
-
const flowId = this.getNodeParameter('flowId', i);
|
|
1945
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'DELETE', `/whatsapp/flows/${flowId}`);
|
|
1946
|
-
}
|
|
1947
|
-
else if (operation === 'publish') {
|
|
1948
|
-
const flowId = this.getNodeParameter('flowId', i);
|
|
1949
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', `/whatsapp/flows/${flowId}/publish`);
|
|
1950
|
-
}
|
|
1951
|
-
else if (operation === 'deprecate') {
|
|
1952
|
-
const flowId = this.getNodeParameter('flowId', i);
|
|
1953
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', `/whatsapp/flows/${flowId}/deprecate`);
|
|
1954
|
-
}
|
|
1955
|
-
else if (operation === 'preview') {
|
|
1956
|
-
const flowId = this.getNodeParameter('flowId', i);
|
|
1957
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `/whatsapp/flows/${flowId}/preview`);
|
|
1958
|
-
}
|
|
1959
|
-
else {
|
|
1960
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
1961
|
-
}
|
|
1962
|
-
}
|
|
1963
|
-
// ─── WHATSAPP INBOUND MESSAGE ───────────────
|
|
1964
|
-
else if (resource === 'whatsappInboundMessage') {
|
|
1965
|
-
const msgId = this.getNodeParameter('inboundMessageId', i);
|
|
1966
|
-
if (operation === 'markAsRead') {
|
|
1967
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', `/whatsapp/inboundMessages/${msgId}/markAsRead`);
|
|
1968
|
-
}
|
|
1969
|
-
else if (operation === 'typingIndicator') {
|
|
1970
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', `/whatsapp/inboundMessages/${msgId}/typingIndicator`);
|
|
1971
|
-
}
|
|
1972
|
-
else {
|
|
1973
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
1974
|
-
}
|
|
1975
|
-
}
|
|
1976
|
-
// ─── WHATSAPP MEDIA ─────────────────────────
|
|
1977
|
-
else if (resource === 'whatsappMedia') {
|
|
1978
|
-
if (operation === 'upload') {
|
|
1979
|
-
const phoneNumber = this.getNodeParameter('mediaPhoneNumber', i);
|
|
1980
|
-
const binaryProp = this.getNodeParameter('binaryProperty', i);
|
|
1981
|
-
const binaryData = this.helpers.assertBinaryData(i, binaryProp);
|
|
1982
|
-
const buffer = await this.helpers.getBinaryDataBuffer(i, binaryProp);
|
|
1983
|
-
const credentials = await this.getCredentials('yCloudApi');
|
|
1984
|
-
const formData = {
|
|
1985
|
-
file: {
|
|
1986
|
-
value: buffer,
|
|
1987
|
-
options: {
|
|
1988
|
-
filename: binaryData.fileName || 'file',
|
|
1989
|
-
contentType: binaryData.mimeType,
|
|
1990
|
-
},
|
|
1991
|
-
},
|
|
1992
|
-
messaging_product: 'whatsapp',
|
|
1993
|
-
type: binaryData.mimeType,
|
|
1994
|
-
};
|
|
1995
|
-
responseData = await this.helpers.request({
|
|
1996
|
-
method: 'POST',
|
|
1997
|
-
url: `https://api.ycloud.com/v2/whatsapp/media/${encodeURIComponent(phoneNumber)}/upload`,
|
|
1998
|
-
headers: { 'X-API-Key': credentials.apiKey },
|
|
1999
|
-
formData,
|
|
2000
|
-
json: true,
|
|
2001
|
-
});
|
|
2002
|
-
}
|
|
2003
|
-
else {
|
|
2004
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
2005
|
-
}
|
|
2006
|
-
}
|
|
2007
|
-
// ─── WHATSAPP MESSAGE ───────────────────────
|
|
2008
|
-
else if (resource === 'whatsappMessage') {
|
|
2009
|
-
if (operation === 'sendDirectly' || operation === 'send') {
|
|
2010
|
-
const from = this.getNodeParameter('waFrom', i, '', { extractValue: true });
|
|
2011
|
-
const to = this.getNodeParameter('waTo', i, '', { extractValue: true });
|
|
2012
|
-
const messageType = this.getNodeParameter('messageType', i);
|
|
2013
|
-
const af = this.getNodeParameter('additionalFields', i);
|
|
2014
|
-
const body = { from, to, type: messageType };
|
|
2015
|
-
if (messageType === 'text') {
|
|
2016
|
-
body.text = {
|
|
2017
|
-
body: this.getNodeParameter('textBody', i),
|
|
2018
|
-
preview_url: this.getNodeParameter('textPreviewUrl', i),
|
|
2019
|
-
};
|
|
2020
|
-
}
|
|
2021
|
-
else if (messageType === 'template') {
|
|
2022
|
-
const templateName = this.getNodeParameter('templateName', i, '', { extractValue: true });
|
|
2023
|
-
const templateLanguage = this.getNodeParameter('templateLanguage', i);
|
|
2024
|
-
const headerVar = this.getNodeParameter('templateHeaderVar', i, '');
|
|
2025
|
-
const headerMedia = this.getNodeParameter('templateHeaderMedia', i, '');
|
|
2026
|
-
const bodyVarsCollection = this.getNodeParameter('templateBodyVars', i, {});
|
|
2027
|
-
const buttonVarsCollection = this.getNodeParameter('templateButtonVars', i, {});
|
|
2028
|
-
const components = [];
|
|
2029
|
-
if (headerVar) {
|
|
2030
|
-
components.push({ type: 'header', parameters: [{ type: 'text', text: headerVar }] });
|
|
2031
|
-
}
|
|
2032
|
-
else if (headerMedia) {
|
|
2033
|
-
const isUrl = headerMedia.startsWith('http');
|
|
2034
|
-
components.push({
|
|
2035
|
-
type: 'header',
|
|
2036
|
-
parameters: [{ type: 'image', image: isUrl ? { link: headerMedia } : { id: headerMedia } }],
|
|
2037
|
-
});
|
|
2038
|
-
}
|
|
2039
|
-
const bodyItems = bodyVarsCollection.variable || [];
|
|
2040
|
-
if (bodyItems.length > 0) {
|
|
2041
|
-
components.push({
|
|
2042
|
-
type: 'body',
|
|
2043
|
-
parameters: bodyItems.map((v) => ({ type: 'text', text: v.value })),
|
|
2044
|
-
});
|
|
2045
|
-
}
|
|
2046
|
-
const buttonItems = buttonVarsCollection.variable || [];
|
|
2047
|
-
for (const bv of buttonItems) {
|
|
2048
|
-
components.push({
|
|
2049
|
-
type: 'button',
|
|
2050
|
-
sub_type: 'url',
|
|
2051
|
-
index: bv.buttonIndex,
|
|
2052
|
-
parameters: [{ type: 'text', text: bv.value }],
|
|
2053
|
-
});
|
|
2054
|
-
}
|
|
2055
|
-
body.template = {
|
|
2056
|
-
name: templateName,
|
|
2057
|
-
language: { code: templateLanguage },
|
|
2058
|
-
...(components.length > 0 ? { components } : {}),
|
|
2059
|
-
};
|
|
2060
|
-
}
|
|
2061
|
-
else if (['image', 'video', 'audio', 'document', 'sticker'].includes(messageType)) {
|
|
2062
|
-
const mediaIdOrLink = this.getNodeParameter('mediaIdOrLink', i);
|
|
2063
|
-
const mediaObj = mediaIdOrLink.startsWith('http') ? { link: mediaIdOrLink } : { id: mediaIdOrLink };
|
|
2064
|
-
if (['image', 'video', 'document'].includes(messageType)) {
|
|
2065
|
-
const caption = this.getNodeParameter('mediaCaption', i, '');
|
|
2066
|
-
if (caption)
|
|
2067
|
-
mediaObj.caption = caption;
|
|
2068
|
-
}
|
|
2069
|
-
if (messageType === 'document') {
|
|
2070
|
-
const filename = this.getNodeParameter('documentFilename', i, '');
|
|
2071
|
-
if (filename)
|
|
2072
|
-
mediaObj.filename = filename;
|
|
2073
|
-
}
|
|
2074
|
-
body[messageType] = mediaObj;
|
|
2075
|
-
}
|
|
2076
|
-
else if (messageType === 'location') {
|
|
2077
|
-
const locObj = {
|
|
2078
|
-
latitude: this.getNodeParameter('locationLatitude', i),
|
|
2079
|
-
longitude: this.getNodeParameter('locationLongitude', i),
|
|
2080
|
-
};
|
|
2081
|
-
const name = this.getNodeParameter('locationName', i, '');
|
|
2082
|
-
const address = this.getNodeParameter('locationAddress', i, '');
|
|
2083
|
-
if (name)
|
|
2084
|
-
locObj.name = name;
|
|
2085
|
-
if (address)
|
|
2086
|
-
locObj.address = address;
|
|
2087
|
-
body.location = locObj;
|
|
2088
|
-
}
|
|
2089
|
-
else if (messageType === 'interactive') {
|
|
2090
|
-
body.interactive = JSON.parse(this.getNodeParameter('interactiveJSON', i));
|
|
2091
|
-
}
|
|
2092
|
-
else if (messageType === 'reaction') {
|
|
2093
|
-
body.reaction = {
|
|
2094
|
-
message_id: this.getNodeParameter('reactionMessageId', i),
|
|
2095
|
-
emoji: this.getNodeParameter('reactionEmoji', i, ''),
|
|
2096
|
-
};
|
|
2097
|
-
}
|
|
2098
|
-
else if (messageType === 'contacts') {
|
|
2099
|
-
body.contacts = JSON.parse(this.getNodeParameter('contactsJSON', i));
|
|
2100
|
-
}
|
|
2101
|
-
if (af.contextMessageId)
|
|
2102
|
-
body.context = { message_id: af.contextMessageId };
|
|
2103
|
-
if (af.externalId)
|
|
2104
|
-
body.externalId = af.externalId;
|
|
2105
|
-
if (af.filterUnsubscribed !== undefined)
|
|
2106
|
-
body.filterUnsubscribed = af.filterUnsubscribed;
|
|
2107
|
-
const endpoint = operation === 'sendDirectly' ? '/whatsapp/messages/sendDirectly' : '/whatsapp/messages';
|
|
2108
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', endpoint, body);
|
|
2109
|
-
}
|
|
2110
|
-
else if (operation === 'retrieve') {
|
|
2111
|
-
const msgId = this.getNodeParameter('waMessageId', i);
|
|
2112
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `/whatsapp/messages/${msgId}`);
|
|
2113
|
-
}
|
|
2114
|
-
else {
|
|
2115
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
2116
|
-
}
|
|
2117
|
-
}
|
|
2118
|
-
// ─── WHATSAPP PHONE NUMBER ──────────────────
|
|
2119
|
-
else if (resource === 'whatsappPhoneNumber') {
|
|
2120
|
-
if (operation === 'list') {
|
|
2121
|
-
const returnAll = this.getNodeParameter('returnAll', i);
|
|
2122
|
-
if (returnAll) {
|
|
2123
|
-
responseData = await GenericFunctions_1.ycloudApiRequestAllItems.call(this, 'GET', '/whatsapp/phoneNumbers');
|
|
2124
|
-
}
|
|
2125
|
-
else {
|
|
2126
|
-
const limit = this.getNodeParameter('limit', i);
|
|
2127
|
-
const resp = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', '/whatsapp/phoneNumbers', {}, { limit });
|
|
2128
|
-
responseData = resp.items || [];
|
|
2129
|
-
}
|
|
2130
|
-
}
|
|
2131
|
-
else {
|
|
2132
|
-
const wabaId = this.getNodeParameter('phoneWabaId', i);
|
|
2133
|
-
const phone = this.getNodeParameter('phoneNumberParam', i);
|
|
2134
|
-
const encodedPhone = encodeURIComponent(phone);
|
|
2135
|
-
const base = `/whatsapp/phoneNumbers/${wabaId}/${encodedPhone}`;
|
|
2136
|
-
if (operation === 'retrieve') {
|
|
2137
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', base);
|
|
2138
|
-
}
|
|
2139
|
-
else if (operation === 'retrieveProfile') {
|
|
2140
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `${base}/profile`);
|
|
2141
|
-
}
|
|
2142
|
-
else if (operation === 'updateProfile') {
|
|
2143
|
-
const pf = this.getNodeParameter('profileFields', i);
|
|
2144
|
-
const body = {};
|
|
2145
|
-
if (pf.about)
|
|
2146
|
-
body.about = pf.about;
|
|
2147
|
-
if (pf.address)
|
|
2148
|
-
body.address = pf.address;
|
|
2149
|
-
if (pf.description)
|
|
2150
|
-
body.description = pf.description;
|
|
2151
|
-
if (pf.email)
|
|
2152
|
-
body.email = pf.email;
|
|
2153
|
-
if (pf.profilePictureUrl)
|
|
2154
|
-
body.profilePictureUrl = pf.profilePictureUrl;
|
|
2155
|
-
if (pf.vertical)
|
|
2156
|
-
body.vertical = pf.vertical;
|
|
2157
|
-
const websites = [];
|
|
2158
|
-
if (pf.websites1)
|
|
2159
|
-
websites.push(pf.websites1);
|
|
2160
|
-
if (pf.websites2)
|
|
2161
|
-
websites.push(pf.websites2);
|
|
2162
|
-
if (websites.length)
|
|
2163
|
-
body.websites = websites;
|
|
2164
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'PATCH', `${base}/profile`, body);
|
|
2165
|
-
}
|
|
2166
|
-
else if (operation === 'updateDisplayName') {
|
|
2167
|
-
const displayName = this.getNodeParameter('phoneDisplayName', i);
|
|
2168
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'PATCH', `${base}/displayName`, { displayName });
|
|
2169
|
-
}
|
|
2170
|
-
else if (operation === 'retrieveCommerceSettings') {
|
|
2171
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `${base}/whatsappCommerceSettings`);
|
|
2172
|
-
}
|
|
2173
|
-
else if (operation === 'updateCommerceSettings') {
|
|
2174
|
-
const csJson = this.getNodeParameter('commerceSettingsJson', i);
|
|
2175
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'PATCH', `${base}/whatsappCommerceSettings`, JSON.parse(csJson));
|
|
2176
|
-
}
|
|
2177
|
-
else if (operation === 'register') {
|
|
2178
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', `${base}/register`);
|
|
2179
|
-
}
|
|
2180
|
-
else if (operation === 'retrieveSettings') {
|
|
2181
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `${base}/settings`);
|
|
2182
|
-
}
|
|
2183
|
-
else if (operation === 'saveSettings') {
|
|
2184
|
-
const settingsJson = this.getNodeParameter('phoneSettingsJson', i);
|
|
2185
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', `${base}/settings`, JSON.parse(settingsJson));
|
|
2186
|
-
}
|
|
2187
|
-
else {
|
|
2188
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
2189
|
-
}
|
|
2190
|
-
}
|
|
2191
|
-
}
|
|
2192
|
-
// ─── WHATSAPP TEMPLATE ──────────────────────
|
|
2193
|
-
else if (resource === 'whatsappTemplate') {
|
|
2194
|
-
if (operation === 'create') {
|
|
2195
|
-
const wabaId = this.getNodeParameter('templateWabaId', i);
|
|
2196
|
-
const name = this.getNodeParameter('templateCreateName', i);
|
|
2197
|
-
const language = this.getNodeParameter('templateCreateLanguage', i);
|
|
2198
|
-
const category = this.getNodeParameter('templateCategory', i);
|
|
2199
|
-
const componentsJson = this.getNodeParameter('templateComponentsJson', i);
|
|
2200
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/whatsapp/templates', {
|
|
2201
|
-
wabaId,
|
|
2202
|
-
name,
|
|
2203
|
-
language,
|
|
2204
|
-
category,
|
|
2205
|
-
components: JSON.parse(componentsJson),
|
|
2206
|
-
});
|
|
2207
|
-
}
|
|
2208
|
-
else if (operation === 'list') {
|
|
2209
|
-
const returnAll = this.getNodeParameter('returnAll', i);
|
|
2210
|
-
const filters = this.getNodeParameter('filters', i, {});
|
|
2211
|
-
const qs = {};
|
|
2212
|
-
if (filters.wabaId)
|
|
2213
|
-
qs['filter.wabaId'] = filters.wabaId;
|
|
2214
|
-
if (returnAll) {
|
|
2215
|
-
responseData = await GenericFunctions_1.ycloudApiRequestAllItems.call(this, 'GET', '/whatsapp/templates', {}, qs);
|
|
2216
|
-
}
|
|
2217
|
-
else {
|
|
2218
|
-
const limit = this.getNodeParameter('limit', i);
|
|
2219
|
-
qs.limit = limit;
|
|
2220
|
-
const resp = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', '/whatsapp/templates', {}, qs);
|
|
2221
|
-
responseData = resp.items || [];
|
|
2222
|
-
}
|
|
2223
|
-
}
|
|
2224
|
-
else if (operation === 'retrieve') {
|
|
2225
|
-
const wabaId = this.getNodeParameter('templateWabaId', i);
|
|
2226
|
-
const name = this.getNodeParameter('templateCreateName', i);
|
|
2227
|
-
const language = this.getNodeParameter('templateCreateLanguage', i);
|
|
2228
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `/whatsapp/templates/${wabaId}/${name}/${language}`);
|
|
2229
|
-
}
|
|
2230
|
-
else if (operation === 'deleteByName') {
|
|
2231
|
-
const wabaId = this.getNodeParameter('templateWabaId', i);
|
|
2232
|
-
const name = this.getNodeParameter('templateCreateName', i);
|
|
2233
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'DELETE', `/whatsapp/templates/${wabaId}/${name}`);
|
|
2234
|
-
}
|
|
2235
|
-
else if (operation === 'deleteByNameAndLanguage') {
|
|
2236
|
-
const wabaId = this.getNodeParameter('templateWabaId', i);
|
|
2237
|
-
const name = this.getNodeParameter('templateCreateName', i);
|
|
2238
|
-
const language = this.getNodeParameter('templateCreateLanguage', i);
|
|
2239
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'DELETE', `/whatsapp/templates/${wabaId}/${name}/${language}`);
|
|
2240
|
-
}
|
|
2241
|
-
else if (operation === 'edit') {
|
|
2242
|
-
const wabaId = this.getNodeParameter('templateWabaId', i);
|
|
2243
|
-
const name = this.getNodeParameter('templateCreateName', i);
|
|
2244
|
-
const language = this.getNodeParameter('templateCreateLanguage', i);
|
|
2245
|
-
const componentsJson = this.getNodeParameter('templateComponentsJson', i);
|
|
2246
|
-
responseData = await GenericFunctions_1.ycloudApiRequest.call(this, 'PATCH', `/whatsapp/templates/${wabaId}/${name}/${language}`, {
|
|
2247
|
-
components: JSON.parse(componentsJson),
|
|
2248
|
-
});
|
|
2249
|
-
}
|
|
2250
|
-
else {
|
|
2251
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
|
2252
|
-
}
|
|
2253
|
-
}
|
|
2254
|
-
else {
|
|
2255
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown resource: ${resource}`);
|
|
2256
|
-
}
|
|
2257
|
-
// Push results
|
|
89
|
+
const responseData = await handler.execute.call(this, i, operation);
|
|
2258
90
|
if (Array.isArray(responseData)) {
|
|
2259
91
|
for (const item of responseData) {
|
|
2260
92
|
returnData.push({ json: item, pairedItem: { item: i } });
|