@growsalesai/n8n-nodes-ycloud 2.6.1 → 2.7.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.
@@ -0,0 +1,12 @@
1
+ import type { IHookFunctions, IWebhookFunctions, INodeType, INodeTypeDescription, IWebhookResponseData } from 'n8n-workflow';
2
+ export declare class YCloudInboundTrigger implements INodeType {
3
+ description: INodeTypeDescription;
4
+ webhookMethods: {
5
+ default: {
6
+ checkExists(this: IHookFunctions): Promise<boolean>;
7
+ create(this: IHookFunctions): Promise<boolean>;
8
+ delete(this: IHookFunctions): Promise<boolean>;
9
+ };
10
+ };
11
+ webhook(this: IWebhookFunctions): Promise<IWebhookResponseData>;
12
+ }
@@ -0,0 +1,164 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.YCloudInboundTrigger = void 0;
7
+ const crypto_1 = __importDefault(require("crypto"));
8
+ const n8n_workflow_1 = require("n8n-workflow");
9
+ const GenericFunctions_1 = require("./GenericFunctions");
10
+ const MSG_TYPES = ['text', 'image', 'video', 'audio', 'document', 'location', 'interactive', 'sticker', 'reaction'];
11
+ const OUTPUT_NAMES = ['Text', 'Image', 'Video', 'Audio', 'Document', 'Location', 'Interactive', 'Sticker', 'Reaction', 'Other'];
12
+ class YCloudInboundTrigger {
13
+ constructor() {
14
+ this.description = {
15
+ displayName: 'YCloud Inbound Trigger',
16
+ name: 'yCloudInboundTrigger',
17
+ icon: 'file:logo-ycloud.png',
18
+ group: ['trigger'],
19
+ version: 1,
20
+ description: 'Starts the workflow when a WhatsApp inbound message is received and routes it directly by message type — no extra Switch/Router node needed.',
21
+ defaults: { name: 'YCloud Inbound Trigger' },
22
+ inputs: [],
23
+ outputs: Array(OUTPUT_NAMES.length).fill(n8n_workflow_1.NodeConnectionTypes.Main),
24
+ outputNames: OUTPUT_NAMES,
25
+ credentials: [{ name: 'yCloudApi', required: true }],
26
+ webhooks: [
27
+ {
28
+ name: 'default',
29
+ httpMethod: 'POST',
30
+ responseMode: 'onReceived',
31
+ path: 'webhook',
32
+ },
33
+ ],
34
+ properties: [
35
+ {
36
+ displayName: 'Options',
37
+ name: 'options',
38
+ type: 'collection',
39
+ placeholder: 'Add Option',
40
+ default: {},
41
+ options: [
42
+ {
43
+ displayName: 'Validate Signature',
44
+ name: 'validateSignature',
45
+ type: 'boolean',
46
+ default: false,
47
+ description: 'Whether to validate the HMAC-SHA256 signature sent by YCloud',
48
+ },
49
+ {
50
+ displayName: 'Keyword Rules (Text Messages)',
51
+ name: 'keywordRules',
52
+ type: 'fixedCollection',
53
+ typeOptions: { multipleValues: true },
54
+ default: { rules: [] },
55
+ placeholder: 'Add Keyword Rule',
56
+ description: 'Detect keywords in text messages and add a "_keyword" label field to the output item',
57
+ options: [
58
+ {
59
+ name: 'rules',
60
+ displayName: 'Rule',
61
+ values: [
62
+ { displayName: 'Keyword', name: 'keyword', type: 'string', default: '', description: 'Case-insensitive partial match' },
63
+ { displayName: 'Label', name: 'label', type: 'string', default: '', description: 'Written to _keyword field when matched' },
64
+ ],
65
+ },
66
+ ],
67
+ },
68
+ ],
69
+ },
70
+ ],
71
+ };
72
+ this.webhookMethods = {
73
+ default: {
74
+ async checkExists() {
75
+ const webhookData = this.getWorkflowStaticData('node');
76
+ if (!webhookData.webhookId)
77
+ return false;
78
+ try {
79
+ await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `/webhookEndpoints/${webhookData.webhookId}`);
80
+ return true;
81
+ }
82
+ catch {
83
+ return false;
84
+ }
85
+ },
86
+ async create() {
87
+ const webhookUrl = this.getNodeWebhookUrl('default');
88
+ const nodeName = this.getNode().name;
89
+ const response = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/webhookEndpoints', {
90
+ url: webhookUrl,
91
+ enabledEvents: ['whatsapp.inbound_message.received'],
92
+ description: nodeName,
93
+ status: 'active',
94
+ });
95
+ const webhookData = this.getWorkflowStaticData('node');
96
+ webhookData.webhookId = response.id;
97
+ webhookData.webhookSecret = response.secret;
98
+ return true;
99
+ },
100
+ async delete() {
101
+ const webhookData = this.getWorkflowStaticData('node');
102
+ if (!webhookData.webhookId)
103
+ return true;
104
+ try {
105
+ await GenericFunctions_1.ycloudApiRequest.call(this, 'DELETE', `/webhookEndpoints/${webhookData.webhookId}`);
106
+ }
107
+ catch {
108
+ return false;
109
+ }
110
+ delete webhookData.webhookId;
111
+ delete webhookData.webhookSecret;
112
+ return true;
113
+ },
114
+ },
115
+ };
116
+ }
117
+ async webhook() {
118
+ var _a;
119
+ const bodyData = this.getBodyData();
120
+ const options = this.getNodeParameter('options');
121
+ // Signature validation (optional)
122
+ if (options.validateSignature === true) {
123
+ const webhookData = this.getWorkflowStaticData('node');
124
+ const secret = webhookData.webhookSecret;
125
+ if (secret) {
126
+ const headers = this.getHeaderData();
127
+ const sigHeader = (headers['ycloud-signature'] ||
128
+ headers['x-ycloud-signature'] ||
129
+ headers['x-signature-256']);
130
+ if (sigHeader) {
131
+ const hmac = crypto_1.default.createHmac('sha256', secret).update(JSON.stringify(bodyData)).digest('hex');
132
+ if (sigHeader !== `sha256=${hmac}`) {
133
+ const out = Array(OUTPUT_NAMES.length).fill(null).map(() => []);
134
+ out[OUTPUT_NAMES.length - 1] = [{ json: { ...bodyData, _signatureValid: false } }];
135
+ return { workflowData: out };
136
+ }
137
+ }
138
+ }
139
+ }
140
+ // Extract message type
141
+ const message = bodyData.whatsappInboundMessage || {};
142
+ const msgType = (message.type || 'other').toLowerCase();
143
+ // Keyword detection for text messages
144
+ const enriched = { ...bodyData };
145
+ if (msgType === 'text') {
146
+ const keywordRulesData = options.keywordRules || {};
147
+ const keywordRules = keywordRulesData.rules || [];
148
+ if (keywordRules.length > 0) {
149
+ const textBody = (((_a = message.text) === null || _a === void 0 ? void 0 : _a.body) || '').toLowerCase();
150
+ const matched = keywordRules.find((r) => textBody.includes((r.keyword || '').toLowerCase()));
151
+ if (matched)
152
+ enriched._keyword = matched.label;
153
+ }
154
+ }
155
+ // Route to the correct output — all other outputs get empty arrays
156
+ const typeIdx = MSG_TYPES.indexOf(msgType);
157
+ const outputIdx = typeIdx === -1 ? OUTPUT_NAMES.length - 1 : typeIdx;
158
+ const workflowData = Array(OUTPUT_NAMES.length).fill(null).map(() => []);
159
+ workflowData[outputIdx] = [{ json: enriched }];
160
+ return { workflowData };
161
+ }
162
+ }
163
+ exports.YCloudInboundTrigger = YCloudInboundTrigger;
164
+ //# sourceMappingURL=YCloudInboundTrigger.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"YCloudInboundTrigger.node.js","sourceRoot":"","sources":["../../../nodes/YCloud/YCloudInboundTrigger.node.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAU5B,+CAAmD;AACnD,yDAAsD;AAEtD,MAAM,SAAS,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AACpH,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;AAEhI,MAAa,oBAAoB;IAAjC;QACE,gBAAW,GAAyB;YAClC,WAAW,EAAE,wBAAwB;YACrC,IAAI,EAAE,sBAAsB;YAC5B,IAAI,EAAE,sBAAsB;YAC5B,KAAK,EAAE,CAAC,SAAS,CAAC;YAClB,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,8IAA8I;YAC3J,QAAQ,EAAE,EAAE,IAAI,EAAE,wBAAwB,EAAE;YAC5C,MAAM,EAAE,EAAE;YACV,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,kCAA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C,OAAO,CAAC,CAAC;QAC3C,MAAM,SAAS,GAAG,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QAErE,MAAM,YAAY,GAA2B,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;QACjG,YAAY,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;QAE/C,OAAO,EAAE,YAAY,EAAE,CAAC;IAC1B,CAAC;CACF;AA7JD,oDA6JC"}
@@ -0,0 +1,5 @@
1
+ import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class YCloudSequences implements INodeType {
3
+ description: INodeTypeDescription;
4
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
+ }
@@ -0,0 +1,645 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.YCloudSequences = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const GenericFunctions_1 = require("./GenericFunctions");
6
+ const OUTPUT_MAP = {
7
+ contactUpsert: ['Found', 'Created'],
8
+ inboundRouter: ['Text', 'Image', 'Video', 'Audio', 'Document', 'Location', 'Interactive', 'Sticker', 'Reaction', 'Other'],
9
+ optHandler: ['Opted Out', 'Opted In', 'Other'],
10
+ contactOnboarding: ['Success'],
11
+ messageStatusRouter: ['Sent', 'Delivered', 'Read', 'Failed', 'Other'],
12
+ tagCampaign: ['Results'],
13
+ autoResponder: ['Matched', 'No Match'],
14
+ };
15
+ class YCloudSequences {
16
+ constructor() {
17
+ this.description = {
18
+ displayName: 'YCloud Sequences',
19
+ name: 'yCloudSequences',
20
+ icon: 'file:logo-ycloud.png',
21
+ group: ['output'],
22
+ version: 1,
23
+ subtitle: '={{ $parameter["operation"] }}',
24
+ description: 'Pre-built WhatsApp automation sequences: contact upsert, inbound routing, opt-in/out, onboarding, message status routing, tag campaigns and auto-responses.',
25
+ defaults: { name: 'YCloud Sequences' },
26
+ codex: {
27
+ categories: ['Communication'],
28
+ subcategories: { Communication: ['YCloud'] },
29
+ resources: {},
30
+ },
31
+ inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
32
+ outputs: `={{ (() => { const m = {'contactUpsert':[{type:'main',displayName:'Found'},{type:'main',displayName:'Created'}],'inboundRouter':[{type:'main',displayName:'Text'},{type:'main',displayName:'Image'},{type:'main',displayName:'Video'},{type:'main',displayName:'Audio'},{type:'main',displayName:'Document'},{type:'main',displayName:'Location'},{type:'main',displayName:'Interactive'},{type:'main',displayName:'Sticker'},{type:'main',displayName:'Reaction'},{type:'main',displayName:'Other'}],'optHandler':[{type:'main',displayName:'Opted Out'},{type:'main',displayName:'Opted In'},{type:'main',displayName:'Other'}],'contactOnboarding':[{type:'main',displayName:'Success'}],'messageStatusRouter':[{type:'main',displayName:'Sent'},{type:'main',displayName:'Delivered'},{type:'main',displayName:'Read'},{type:'main',displayName:'Failed'},{type:'main',displayName:'Other'}],'tagCampaign':[{type:'main',displayName:'Results'}],'autoResponder':[{type:'main',displayName:'Matched'},{type:'main',displayName:'No Match'}]}; return m[$parameter['operation']]||[{type:'main'}]; })() }}`,
33
+ credentials: [{ name: 'yCloudApi', required: true }],
34
+ properties: [
35
+ // ── Sequence selector ──────────────────────────────────────────────────
36
+ {
37
+ displayName: 'Sequence',
38
+ name: 'operation',
39
+ type: 'options',
40
+ noDataExpression: true,
41
+ default: 'contactUpsert',
42
+ options: [
43
+ { name: 'Auto Responder', value: 'autoResponder', description: 'Check contact tags/attributes and send the matching WhatsApp template', action: 'Run auto responder' },
44
+ { name: 'Contact Onboarding', value: 'contactOnboarding', description: 'Send a welcome template and tag a new contact', action: 'Run contact onboarding' },
45
+ { name: 'Contact Upsert', value: 'contactUpsert', description: 'Find a contact by phone number — create if not found', action: 'Run contact upsert' },
46
+ { name: 'Inbound Message Router', value: 'inboundRouter', description: 'Route inbound WhatsApp messages by type (text, image, video…)', action: 'Run inbound router' },
47
+ { name: 'Message Status Router', value: 'messageStatusRouter', description: 'Route whatsapp.message.updated events by delivery status', action: 'Run message status router' },
48
+ { name: 'Opt-in / Opt-out Handler', value: 'optHandler', description: 'Detect consent keywords and manage the unsubscriber list', action: 'Run opt handler' },
49
+ { name: 'Tag Campaign', value: 'tagCampaign', description: 'Send a WhatsApp template to all contacts with a specific tag', action: 'Run tag campaign' },
50
+ ],
51
+ },
52
+ // ── Contact Upsert ─────────────────────────────────────────────────────
53
+ {
54
+ displayName: 'Phone Number',
55
+ name: 'phoneNumber',
56
+ type: 'string',
57
+ required: true,
58
+ default: '',
59
+ placeholder: '+16315551111',
60
+ displayOptions: { show: { operation: ['contactUpsert'] } },
61
+ description: 'Phone number in E.164 format. Supports expressions.',
62
+ },
63
+ {
64
+ displayName: 'On Contact Found',
65
+ name: 'ifExists',
66
+ type: 'options',
67
+ default: 'doNothing',
68
+ displayOptions: { show: { operation: ['contactUpsert'] } },
69
+ options: [
70
+ { name: 'Do Nothing — Return Existing Data', value: 'doNothing' },
71
+ { name: 'Update Contact Fields', value: 'update' },
72
+ ],
73
+ },
74
+ {
75
+ displayName: 'Contact Fields',
76
+ name: 'contactFields',
77
+ type: 'collection',
78
+ placeholder: 'Add Field',
79
+ default: {},
80
+ displayOptions: { show: { operation: ['contactUpsert'] } },
81
+ description: 'Fields to set on create (and on update when selected)',
82
+ options: [
83
+ { displayName: 'Country Code', name: 'countryCode', type: 'string', default: '' },
84
+ { displayName: 'Custom Attributes (JSON)', name: 'customAttributes', type: 'string', typeOptions: { rows: 3 }, default: '' },
85
+ { displayName: 'Nickname', name: 'nickname', type: 'string', default: '' },
86
+ { displayName: 'Owner Email', name: 'ownerEmail', type: 'string', default: '', placeholder: 'owner@example.com' },
87
+ { displayName: 'Tags', name: 'tags', type: 'string', default: '', description: 'Comma-separated list of tags' },
88
+ ],
89
+ },
90
+ // ── Inbound Router ─────────────────────────────────────────────────────
91
+ {
92
+ displayName: 'Message Object Field',
93
+ name: 'messageField',
94
+ type: 'string',
95
+ default: 'whatsappInboundMessage',
96
+ displayOptions: { show: { operation: ['inboundRouter', 'optHandler', 'autoResponder'] } },
97
+ description: 'Field in the input item containing the WhatsApp message object (from YCloud Trigger)',
98
+ },
99
+ {
100
+ displayName: 'Keyword Rules (Text Messages)',
101
+ name: 'keywordRules',
102
+ type: 'fixedCollection',
103
+ typeOptions: { multipleValues: true },
104
+ default: { rules: [] },
105
+ placeholder: 'Add Keyword Rule',
106
+ displayOptions: { show: { operation: ['inboundRouter'] } },
107
+ description: 'Detect keywords in text messages and add a "_keyword" label to the output item',
108
+ options: [
109
+ {
110
+ name: 'rules',
111
+ displayName: 'Rule',
112
+ values: [
113
+ { displayName: 'Keyword', name: 'keyword', type: 'string', default: '', description: 'Case-insensitive partial match' },
114
+ { displayName: 'Label', name: 'label', type: 'string', default: '', description: 'Written to _keyword field when matched' },
115
+ ],
116
+ },
117
+ ],
118
+ },
119
+ // ── Opt Handler ────────────────────────────────────────────────────────
120
+ {
121
+ displayName: 'Opt-out Keywords',
122
+ name: 'optOutKeywords',
123
+ type: 'string',
124
+ default: 'STOP,PARAR,SAIR,CANCELAR,UNSUBSCRIBE,NÃO QUERO',
125
+ displayOptions: { show: { operation: ['optHandler'] } },
126
+ description: 'Comma-separated keywords that trigger opt-out (case-insensitive)',
127
+ },
128
+ {
129
+ displayName: 'Opt-in Keywords',
130
+ name: 'optInKeywords',
131
+ type: 'string',
132
+ default: 'START,INICIAR,QUERO,CONTINUAR,SUBSCRIBE,SIM',
133
+ displayOptions: { show: { operation: ['optHandler'] } },
134
+ description: 'Comma-separated keywords that trigger opt-in (case-insensitive)',
135
+ },
136
+ {
137
+ displayName: 'Channel',
138
+ name: 'channel',
139
+ type: 'options',
140
+ default: 'whatsApp',
141
+ displayOptions: { show: { operation: ['optHandler'] } },
142
+ options: [
143
+ { name: 'WhatsApp', value: 'whatsApp' },
144
+ { name: 'SMS', value: 'sms' },
145
+ { name: 'Voice', value: 'voice' },
146
+ { name: 'Email', value: 'email' },
147
+ { name: 'All', value: 'all' },
148
+ ],
149
+ },
150
+ {
151
+ displayName: 'Match Mode',
152
+ name: 'matchMode',
153
+ type: 'options',
154
+ default: 'contains',
155
+ displayOptions: { show: { operation: ['optHandler'] } },
156
+ options: [
157
+ { name: 'Contains Keyword', value: 'contains' },
158
+ { name: 'Exact Match (whole message)', value: 'exact' },
159
+ ],
160
+ },
161
+ // ── Contact Onboarding ─────────────────────────────────────────────────
162
+ {
163
+ displayName: 'Contact Phone Field',
164
+ name: 'contactPhoneField',
165
+ type: 'string',
166
+ default: 'contact.phoneNumber',
167
+ displayOptions: { show: { operation: ['contactOnboarding'] } },
168
+ description: 'Dot-path to the phone number in the input item, e.g. "contact.phoneNumber"',
169
+ },
170
+ {
171
+ displayName: 'Contact ID Field',
172
+ name: 'contactIdField',
173
+ type: 'string',
174
+ default: 'contact.id',
175
+ displayOptions: { show: { operation: ['contactOnboarding'] } },
176
+ description: 'Dot-path to the contact ID. Used to add the welcome tag.',
177
+ },
178
+ {
179
+ displayName: 'Welcome Tag',
180
+ name: 'welcomeTag',
181
+ type: 'string',
182
+ default: 'onboarded',
183
+ displayOptions: { show: { operation: ['contactOnboarding'] } },
184
+ description: 'Tag added after sending the welcome message. Leave empty to skip.',
185
+ },
186
+ // ── Message Status Router ──────────────────────────────────────────────
187
+ {
188
+ displayName: 'Message Object Field',
189
+ name: 'statusMessageField',
190
+ type: 'string',
191
+ default: 'whatsappMessage',
192
+ displayOptions: { show: { operation: ['messageStatusRouter'] } },
193
+ description: 'Field containing the WhatsApp message object from whatsapp.message.updated events',
194
+ },
195
+ // ── Tag Campaign ───────────────────────────────────────────────────────
196
+ {
197
+ displayName: 'Tag',
198
+ name: 'tag',
199
+ type: 'string',
200
+ required: true,
201
+ default: '',
202
+ placeholder: 'premium',
203
+ displayOptions: { show: { operation: ['tagCampaign'] } },
204
+ description: 'Only contacts with this tag receive the campaign message',
205
+ },
206
+ // ── Shared: From Phone (Onboarding / Campaign / Auto Responder) ────────
207
+ {
208
+ displayName: 'From Phone Number',
209
+ name: 'fromPhone',
210
+ type: 'string',
211
+ required: true,
212
+ default: '',
213
+ placeholder: '+16315551111',
214
+ displayOptions: { show: { operation: ['contactOnboarding', 'tagCampaign', 'autoResponder'] } },
215
+ description: 'Your WhatsApp Business phone number registered in YCloud',
216
+ },
217
+ {
218
+ displayName: 'Template Name',
219
+ name: 'templateName',
220
+ type: 'string',
221
+ required: true,
222
+ default: '',
223
+ placeholder: 'welcome_message',
224
+ displayOptions: { show: { operation: ['contactOnboarding', 'tagCampaign'] } },
225
+ description: 'Name of the approved WhatsApp template to send',
226
+ },
227
+ {
228
+ displayName: 'Template Language',
229
+ name: 'templateLanguage',
230
+ type: 'string',
231
+ required: true,
232
+ default: 'pt_BR',
233
+ displayOptions: { show: { operation: ['contactOnboarding', 'tagCampaign'] } },
234
+ description: 'Language code, e.g. pt_BR, en_US',
235
+ },
236
+ {
237
+ displayName: 'Template Body Variables (JSON)',
238
+ name: 'templateVarsJSON',
239
+ type: 'string',
240
+ typeOptions: { rows: 3 },
241
+ default: '[]',
242
+ displayOptions: { show: { operation: ['contactOnboarding', 'tagCampaign'] } },
243
+ description: 'JSON array of body variable values: ["John", "Premium"]',
244
+ },
245
+ // ── Auto Responder Rules ───────────────────────────────────────────────
246
+ {
247
+ displayName: 'Response Rules',
248
+ name: 'rules',
249
+ type: 'fixedCollection',
250
+ typeOptions: { multipleValues: true, sortable: true },
251
+ default: { items: [] },
252
+ placeholder: 'Add Rule',
253
+ displayOptions: { show: { operation: ['autoResponder'] } },
254
+ description: 'Rules evaluated in order — first match determines the template sent',
255
+ options: [
256
+ {
257
+ name: 'items',
258
+ displayName: 'Rule',
259
+ values: [
260
+ {
261
+ displayName: 'Condition Type',
262
+ name: 'conditionType',
263
+ type: 'options',
264
+ default: 'hasTag',
265
+ options: [
266
+ { name: 'Contact Has Tag', value: 'hasTag' },
267
+ { name: 'Contact Attribute Equals', value: 'attributeEquals' },
268
+ { name: 'Match All (fallback)', value: 'always' },
269
+ ],
270
+ },
271
+ { displayName: 'Tag', name: 'tag', type: 'string', default: '', displayOptions: { show: { conditionType: ['hasTag'] } } },
272
+ { displayName: 'Attribute Key', name: 'attributeKey', type: 'string', default: '', displayOptions: { show: { conditionType: ['attributeEquals'] } } },
273
+ { displayName: 'Attribute Value', name: 'attributeValue', type: 'string', default: '', displayOptions: { show: { conditionType: ['attributeEquals'] } } },
274
+ { displayName: 'Template Name', name: 'templateName', type: 'string', required: true, default: '' },
275
+ { displayName: 'Template Language', name: 'templateLanguage', type: 'string', default: 'pt_BR' },
276
+ { displayName: 'Template Body Variables (JSON)', name: 'templateVarsJSON', type: 'string', default: '[]' },
277
+ ],
278
+ },
279
+ ],
280
+ },
281
+ // ── Options: Contact Onboarding ────────────────────────────────────────
282
+ {
283
+ displayName: 'Options',
284
+ name: 'onboardingOptions',
285
+ type: 'collection',
286
+ placeholder: 'Add Option',
287
+ default: {},
288
+ displayOptions: { show: { operation: ['contactOnboarding'] } },
289
+ options: [
290
+ { displayName: 'Filter Unsubscribed', name: 'filterUnsubscribed', type: 'boolean', default: true },
291
+ { displayName: 'Header Media URL or ID', name: 'headerMedia', type: 'string', default: '' },
292
+ ],
293
+ },
294
+ // ── Options: Tag Campaign ──────────────────────────────────────────────
295
+ {
296
+ displayName: 'Options',
297
+ name: 'campaignOptions',
298
+ type: 'collection',
299
+ placeholder: 'Add Option',
300
+ default: {},
301
+ displayOptions: { show: { operation: ['tagCampaign'] } },
302
+ options: [
303
+ { displayName: 'Filter Unsubscribed', name: 'filterUnsubscribed', type: 'boolean', default: true },
304
+ { displayName: 'Header Media URL or ID', name: 'headerMedia', type: 'string', default: '' },
305
+ { displayName: 'Delay Between Sends (ms)', name: 'delay', type: 'number', default: 0, description: 'Wait between each message to avoid rate limit bursts' },
306
+ ],
307
+ },
308
+ // ── Options: Auto Responder ────────────────────────────────────────────
309
+ {
310
+ displayName: 'Options',
311
+ name: 'autoResponderOptions',
312
+ type: 'collection',
313
+ placeholder: 'Add Option',
314
+ default: {},
315
+ displayOptions: { show: { operation: ['autoResponder'] } },
316
+ options: [
317
+ { displayName: 'Filter Unsubscribed', name: 'filterUnsubscribed', type: 'boolean', default: true },
318
+ { displayName: 'Reply to Inbound Message', name: 'replyToMessage', type: 'boolean', default: false, description: 'Send response as a reply to the inbound message' },
319
+ ],
320
+ },
321
+ ],
322
+ };
323
+ }
324
+ async execute() {
325
+ const operation = this.getNodeParameter('operation', 0);
326
+ switch (operation) {
327
+ case 'contactUpsert': return runContactUpsert.call(this);
328
+ case 'inboundRouter': return runInboundRouter.call(this);
329
+ case 'optHandler': return runOptHandler.call(this);
330
+ case 'contactOnboarding': return runContactOnboarding.call(this);
331
+ case 'messageStatusRouter': return runMessageStatusRouter.call(this);
332
+ case 'tagCampaign': return runTagCampaign.call(this);
333
+ case 'autoResponder': return runAutoResponder.call(this);
334
+ default: return [[]];
335
+ }
336
+ }
337
+ }
338
+ exports.YCloudSequences = YCloudSequences;
339
+ // ─── Sequence implementations ────────────────────────────────────────────────
340
+ async function runContactUpsert() {
341
+ const items = this.getInputData();
342
+ const found = [];
343
+ const created = [];
344
+ for (let i = 0; i < items.length; i++) {
345
+ try {
346
+ const phoneNumber = this.getNodeParameter('phoneNumber', i);
347
+ const ifExists = this.getNodeParameter('ifExists', i);
348
+ const fields = this.getNodeParameter('contactFields', i);
349
+ const body = {};
350
+ if (fields.nickname)
351
+ body.nickname = fields.nickname;
352
+ if (fields.countryCode)
353
+ body.countryCode = fields.countryCode;
354
+ if (fields.ownerEmail)
355
+ body.ownerEmail = fields.ownerEmail;
356
+ if (fields.tags)
357
+ body.tags = fields.tags.split(',').map((t) => t.trim()).filter(Boolean);
358
+ if (fields.customAttributes)
359
+ body.customAttributes = JSON.parse(fields.customAttributes);
360
+ const resp = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', '/contact/contacts', {}, { phoneNumber });
361
+ const existing = (resp.items || []).find((c) => c.phoneNumber === phoneNumber);
362
+ if (existing) {
363
+ let result = existing;
364
+ if (ifExists === 'update' && Object.keys(body).length > 0) {
365
+ result = await GenericFunctions_1.ycloudApiRequest.call(this, 'PATCH', `/contact/contacts/${existing.id}`, body);
366
+ }
367
+ found.push({ json: result, pairedItem: { item: i } });
368
+ }
369
+ else {
370
+ const newContact = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/contact/contacts', { phoneNumber, ...body });
371
+ created.push({ json: newContact, pairedItem: { item: i } });
372
+ }
373
+ }
374
+ catch (error) {
375
+ if (this.continueOnFail()) {
376
+ found.push({ json: { error: error.message }, pairedItem: { item: i } });
377
+ }
378
+ else
379
+ throw error;
380
+ }
381
+ }
382
+ return [found, created];
383
+ }
384
+ async function runInboundRouter() {
385
+ var _a;
386
+ const items = this.getInputData();
387
+ const msgTypes = ['text', 'image', 'video', 'audio', 'document', 'location', 'interactive', 'sticker', 'reaction'];
388
+ const outputs = Array.from({ length: 10 }, () => []);
389
+ for (let i = 0; i < items.length; i++) {
390
+ const messageField = this.getNodeParameter('messageField', i);
391
+ const keywordRulesData = this.getNodeParameter('keywordRules', i);
392
+ const keywordRules = keywordRulesData.rules || [];
393
+ const data = items[i].json;
394
+ const message = data[messageField] || {};
395
+ const msgType = (message.type || 'other').toLowerCase();
396
+ const enriched = { ...data };
397
+ if (msgType === 'text' && keywordRules.length > 0) {
398
+ const body = (((_a = message.text) === null || _a === void 0 ? void 0 : _a.body) || '').toLowerCase();
399
+ const match = keywordRules.find((r) => body.includes((r.keyword || '').toLowerCase()));
400
+ if (match)
401
+ enriched._keyword = match.label;
402
+ }
403
+ const idx = msgTypes.indexOf(msgType);
404
+ outputs[idx === -1 ? 9 : idx].push({ json: enriched, pairedItem: { item: i } });
405
+ }
406
+ return outputs;
407
+ }
408
+ async function runOptHandler() {
409
+ var _a;
410
+ const items = this.getInputData();
411
+ const optedOut = [];
412
+ const optedIn = [];
413
+ const other = [];
414
+ for (let i = 0; i < items.length; i++) {
415
+ try {
416
+ const messageField = this.getNodeParameter('messageField', i);
417
+ const channel = this.getNodeParameter('channel', i);
418
+ const matchMode = this.getNodeParameter('matchMode', i);
419
+ const outKw = this.getNodeParameter('optOutKeywords', i).split(',').map((k) => k.trim().toLowerCase()).filter(Boolean);
420
+ const inKw = this.getNodeParameter('optInKeywords', i).split(',').map((k) => k.trim().toLowerCase()).filter(Boolean);
421
+ const data = items[i].json;
422
+ const message = data[messageField] || {};
423
+ const phone = message.from || '';
424
+ const rawText = (((_a = message.text) === null || _a === void 0 ? void 0 : _a.body) || '').trim();
425
+ const text = rawText.toLowerCase();
426
+ const matches = (kws) => matchMode === 'exact' ? kws.includes(text) : kws.some((k) => text.includes(k));
427
+ const enriched = { ...data, _phone: phone, _text: rawText };
428
+ if (matches(outKw)) {
429
+ if (phone) {
430
+ try {
431
+ await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/unsubscribers', { customer: phone, channel });
432
+ }
433
+ catch (_) { }
434
+ }
435
+ enriched._optAction = 'opted_out';
436
+ optedOut.push({ json: enriched, pairedItem: { item: i } });
437
+ }
438
+ else if (matches(inKw)) {
439
+ if (phone) {
440
+ try {
441
+ await GenericFunctions_1.ycloudApiRequest.call(this, 'DELETE', `/unsubscribers/${encodeURIComponent(phone)}/${channel}`);
442
+ }
443
+ catch (_) { }
444
+ }
445
+ enriched._optAction = 'opted_in';
446
+ optedIn.push({ json: enriched, pairedItem: { item: i } });
447
+ }
448
+ else {
449
+ other.push({ json: enriched, pairedItem: { item: i } });
450
+ }
451
+ }
452
+ catch (error) {
453
+ if (this.continueOnFail()) {
454
+ other.push({ json: { error: error.message }, pairedItem: { item: i } });
455
+ }
456
+ else
457
+ throw error;
458
+ }
459
+ }
460
+ return [optedOut, optedIn, other];
461
+ }
462
+ async function runContactOnboarding() {
463
+ const items = this.getInputData();
464
+ const success = [];
465
+ const getField = (obj, path) => path.split('.').reduce((acc, key) => acc && typeof acc === 'object' ? acc[key] : undefined, obj);
466
+ for (let i = 0; i < items.length; i++) {
467
+ try {
468
+ const phoneField = this.getNodeParameter('contactPhoneField', i);
469
+ const idField = this.getNodeParameter('contactIdField', i);
470
+ const fromPhone = this.getNodeParameter('fromPhone', i);
471
+ const templateName = this.getNodeParameter('templateName', i);
472
+ const templateLanguage = this.getNodeParameter('templateLanguage', i);
473
+ const templateVars = JSON.parse(this.getNodeParameter('templateVarsJSON', i) || '[]');
474
+ const welcomeTag = this.getNodeParameter('welcomeTag', i);
475
+ const options = this.getNodeParameter('onboardingOptions', i);
476
+ const toPhone = getField(items[i].json, phoneField);
477
+ const contactId = getField(items[i].json, idField);
478
+ if (!toPhone)
479
+ throw new Error(`Phone field "${phoneField}" not found`);
480
+ const components = [];
481
+ if (options.headerMedia) {
482
+ const hm = options.headerMedia;
483
+ components.push({ type: 'header', parameters: [{ type: 'image', image: hm.startsWith('http') ? { link: hm } : { id: hm } }] });
484
+ }
485
+ if (templateVars.length)
486
+ components.push({ type: 'body', parameters: templateVars.map((v) => ({ type: 'text', text: v })) });
487
+ const msgResult = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/whatsapp/messages', {
488
+ from: fromPhone, to: toPhone, type: 'template',
489
+ filterUnsubscribed: options.filterUnsubscribed !== false,
490
+ template: { name: templateName, language: { code: templateLanguage }, ...(components.length ? { components } : {}) },
491
+ });
492
+ let tagResult = {};
493
+ if (welcomeTag && contactId) {
494
+ const contact = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', `/contact/contacts/${contactId}`);
495
+ const existing = contact.tags || [];
496
+ if (!existing.includes(welcomeTag)) {
497
+ tagResult = await GenericFunctions_1.ycloudApiRequest.call(this, 'PATCH', `/contact/contacts/${contactId}`, { tags: [...existing, welcomeTag] });
498
+ }
499
+ else
500
+ tagResult = contact;
501
+ }
502
+ success.push({ json: { message: msgResult, contact: tagResult, _phone: toPhone }, pairedItem: { item: i } });
503
+ }
504
+ catch (error) {
505
+ if (this.continueOnFail()) {
506
+ success.push({ json: { error: error.message }, pairedItem: { item: i } });
507
+ }
508
+ else
509
+ throw error;
510
+ }
511
+ }
512
+ return [success];
513
+ }
514
+ async function runMessageStatusRouter() {
515
+ var _a;
516
+ const items = this.getInputData();
517
+ const statuses = ['sent', 'delivered', 'read', 'failed'];
518
+ const outputs = Array.from({ length: 5 }, () => []);
519
+ for (let i = 0; i < items.length; i++) {
520
+ const msgField = this.getNodeParameter('statusMessageField', i);
521
+ const data = items[i].json;
522
+ const status = (((_a = data[msgField]) === null || _a === void 0 ? void 0 : _a.status) || '').toLowerCase();
523
+ const idx = statuses.indexOf(status);
524
+ outputs[idx === -1 ? 4 : idx].push({ json: { ...data, _status: status }, pairedItem: { item: i } });
525
+ }
526
+ return outputs;
527
+ }
528
+ async function runTagCampaign() {
529
+ const items = this.getInputData();
530
+ const results = [];
531
+ for (let i = 0; i < items.length; i++) {
532
+ try {
533
+ const tag = this.getNodeParameter('tag', i);
534
+ const fromPhone = this.getNodeParameter('fromPhone', i);
535
+ const templateName = this.getNodeParameter('templateName', i);
536
+ const templateLanguage = this.getNodeParameter('templateLanguage', i);
537
+ const templateVars = JSON.parse(this.getNodeParameter('templateVarsJSON', i) || '[]');
538
+ const options = this.getNodeParameter('campaignOptions', i);
539
+ const components = [];
540
+ if (options.headerMedia) {
541
+ const hm = options.headerMedia;
542
+ components.push({ type: 'header', parameters: [{ type: 'image', image: hm.startsWith('http') ? { link: hm } : { id: hm } }] });
543
+ }
544
+ if (templateVars.length)
545
+ components.push({ type: 'body', parameters: templateVars.map((v) => ({ type: 'text', text: v })) });
546
+ const contacts = await GenericFunctions_1.ycloudApiRequestAllItems.call(this, 'GET', '/contact/contacts', {}, { tag });
547
+ const delay = options.delay || 0;
548
+ for (const contact of contacts) {
549
+ const toPhone = contact.phoneNumber;
550
+ if (!toPhone)
551
+ continue;
552
+ let sendResult = {};
553
+ let sendError = null;
554
+ try {
555
+ sendResult = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/whatsapp/messages', {
556
+ from: fromPhone, to: toPhone, type: 'template',
557
+ filterUnsubscribed: options.filterUnsubscribed !== false,
558
+ template: { name: templateName, language: { code: templateLanguage }, ...(components.length ? { components } : {}) },
559
+ });
560
+ }
561
+ catch (err) {
562
+ sendError = err.message;
563
+ }
564
+ results.push({ json: { contact, message: sendResult, error: sendError, _sent: sendError === null, _tag: tag }, pairedItem: { item: i } });
565
+ if (delay > 0)
566
+ await new Promise((r) => setTimeout(r, delay));
567
+ }
568
+ }
569
+ catch (error) {
570
+ if (this.continueOnFail()) {
571
+ results.push({ json: { error: error.message }, pairedItem: { item: i } });
572
+ }
573
+ else
574
+ throw error;
575
+ }
576
+ }
577
+ return [results];
578
+ }
579
+ async function runAutoResponder() {
580
+ const items = this.getInputData();
581
+ const matched = [];
582
+ const noMatch = [];
583
+ for (let i = 0; i < items.length; i++) {
584
+ try {
585
+ const messageField = this.getNodeParameter('messageField', i);
586
+ const fromPhone = this.getNodeParameter('fromPhone', i);
587
+ const rules = this.getNodeParameter('rules', i).items || [];
588
+ const options = this.getNodeParameter('autoResponderOptions', i);
589
+ const data = items[i].json;
590
+ const message = data[messageField] || {};
591
+ const senderPhone = message.from;
592
+ if (!senderPhone) {
593
+ noMatch.push({ json: { ...data, _reason: 'no_sender_phone' }, pairedItem: { item: i } });
594
+ continue;
595
+ }
596
+ const resp = await GenericFunctions_1.ycloudApiRequest.call(this, 'GET', '/contact/contacts', {}, { phoneNumber: senderPhone });
597
+ const contact = (resp.items || []).find((c) => c.phoneNumber === senderPhone) || {};
598
+ const tags = contact.tags || [];
599
+ const attrMap = {};
600
+ for (const a of (contact.customAttributes || [])) {
601
+ if (a.key)
602
+ attrMap[a.key] = (a.value || '').toLowerCase();
603
+ }
604
+ let rule = null;
605
+ for (const r of rules) {
606
+ if (r.conditionType === 'always') {
607
+ rule = r;
608
+ break;
609
+ }
610
+ if (r.conditionType === 'hasTag' && tags.includes(r.tag)) {
611
+ rule = r;
612
+ break;
613
+ }
614
+ if (r.conditionType === 'attributeEquals' && attrMap[r.attributeKey] === (r.attributeValue || '').toLowerCase()) {
615
+ rule = r;
616
+ break;
617
+ }
618
+ }
619
+ if (!rule) {
620
+ noMatch.push({ json: { ...data, contact, _reason: 'no_rule_matched' }, pairedItem: { item: i } });
621
+ continue;
622
+ }
623
+ const vars = JSON.parse(rule.templateVarsJSON || '[]');
624
+ const components = vars.length ? [{ type: 'body', parameters: vars.map((v) => ({ type: 'text', text: v })) }] : [];
625
+ const msgBody = {
626
+ from: fromPhone, to: senderPhone, type: 'template',
627
+ filterUnsubscribed: options.filterUnsubscribed !== false,
628
+ template: { name: rule.templateName, language: { code: rule.templateLanguage || 'pt_BR' }, ...(components.length ? { components } : {}) },
629
+ };
630
+ if (options.replyToMessage && message.id)
631
+ msgBody.context = { message_id: message.id };
632
+ const sendResult = await GenericFunctions_1.ycloudApiRequest.call(this, 'POST', '/whatsapp/messages', msgBody);
633
+ matched.push({ json: { message: sendResult, contact, _rule: rule.conditionType, _template: rule.templateName, _phone: senderPhone }, pairedItem: { item: i } });
634
+ }
635
+ catch (error) {
636
+ if (this.continueOnFail()) {
637
+ noMatch.push({ json: { error: error.message }, pairedItem: { item: i } });
638
+ }
639
+ else
640
+ throw error;
641
+ }
642
+ }
643
+ return [matched, noMatch];
644
+ }
645
+ //# sourceMappingURL=YCloudSequences.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"YCloudSequences.node.js","sourceRoot":"","sources":["../../../nodes/YCloud/YCloudSequences.node.ts"],"names":[],"mappings":";;;AACA,+CAAmD;AACnD,yDAAgF;AAEhF,MAAM,UAAU,GAA6B;IAC3C,aAAa,EAAE,CAAC,OAAO,EAAE,SAAS,CAAC;IACnC,aAAa,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,E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CAAC,EAAE,EAAE,CAAC,CAAC;QAClK,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;gBAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAG,KAAe,CAAC,OAAO,EAAE,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;YAAC,CAAC;;gBAC/G,MAAM,KAAK,CAAC;QACnB,CAAC;IACH,CAAC;IACD,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC5B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@growsalesai/n8n-nodes-ycloud",
3
- "version": "2.6.1",
3
+ "version": "2.7.1",
4
4
  "description": "n8n community nodes for YCloud API — WhatsApp, SMS, Email, Voice, Verification and more",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",
@@ -43,13 +43,8 @@
43
43
  "nodes": [
44
44
  "dist/nodes/YCloud/YCloud.node.js",
45
45
  "dist/nodes/YCloud/YCloudTrigger.node.js",
46
- "dist/nodes/YCloud/sequences/YCloudContactUpsert.node.js",
47
- "dist/nodes/YCloud/sequences/YCloudInboundRouter.node.js",
48
- "dist/nodes/YCloud/sequences/YCloudOptHandler.node.js",
49
- "dist/nodes/YCloud/sequences/YCloudContactOnboarding.node.js",
50
- "dist/nodes/YCloud/sequences/YCloudMessageStatusRouter.node.js",
51
- "dist/nodes/YCloud/sequences/YCloudTagCampaign.node.js",
52
- "dist/nodes/YCloud/sequences/YCloudAutoResponder.node.js"
46
+ "dist/nodes/YCloud/YCloudInboundTrigger.node.js",
47
+ "dist/nodes/YCloud/YCloudSequences.node.js"
53
48
  ]
54
49
  },
55
50
  "devDependencies": {