n8n-nodes-chatads 0.1.4 → 0.1.5

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.
@@ -10,8 +10,8 @@ class ChatAdsApi {
10
10
  displayName: 'Base URL',
11
11
  name: 'baseUrl',
12
12
  type: 'string',
13
- default: 'https://app.getchatads.com',
14
- description: 'Root domain where the ChatAds FastAPI service (affiliate/chatads_backend.py) is deployed',
13
+ default: 'https://api.getchatads.com',
14
+ description: 'ChatAds API endpoint URL',
15
15
  },
16
16
  {
17
17
  displayName: 'API Key',
@@ -36,7 +36,7 @@ class ChatAdsApi {
36
36
  this.test = {
37
37
  request: {
38
38
  method: 'GET',
39
- url: '={{($credentials.baseUrl || "").replace(/\/+$/, "") || "https://app.getchatads.com"}}',
39
+ url: '={{($credentials.baseUrl || "").replace(/\/+$/, "") || "https://api.getchatads.com"}}',
40
40
  qs: {
41
41
  source: 'n8n-credential-test',
42
42
  },
@@ -10,6 +10,8 @@ const OPTIONAL_FIELDS = new Set([
10
10
  'fill_priority',
11
11
  'min_intent',
12
12
  'skip_message_analysis',
13
+ 'demo',
14
+ 'max_offers',
13
15
  ]);
14
16
  const FIELD_ALIASES = {
15
17
  messageanalysis: 'message_analysis',
@@ -20,6 +22,8 @@ const FIELD_ALIASES = {
20
22
  min_intent: 'min_intent',
21
23
  skipmessageanalysis: 'skip_message_analysis',
22
24
  skip_message_analysis: 'skip_message_analysis',
25
+ maxoffers: 'max_offers',
26
+ max_offers: 'max_offers',
23
27
  };
24
28
  const RESERVED_PAYLOAD_KEYS = new Set(['message', ...OPTIONAL_FIELDS]);
25
29
  const isPlainObject = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
@@ -90,13 +94,20 @@ const buildPayloadFromObject = (context, input, source, itemIndex) => {
90
94
  }
91
95
  const optionalKey = normalizeOptionalField(rawKey);
92
96
  if (optionalKey) {
93
- if (optionalKey === 'skip_message_analysis') {
97
+ if (optionalKey === 'skip_message_analysis' || optionalKey === 'demo') {
94
98
  if (typeof rawValue !== 'boolean') {
95
99
  throw new n8n_workflow_1.NodeOperationError(context.getNode(), `${source} field "${rawKey}" must be a boolean`, { itemIndex });
96
100
  }
97
101
  payload[optionalKey] = rawValue;
98
102
  continue;
99
103
  }
104
+ if (optionalKey === 'max_offers') {
105
+ if (typeof rawValue !== 'number') {
106
+ throw new n8n_workflow_1.NodeOperationError(context.getNode(), `${source} field "${rawKey}" must be a number`, { itemIndex });
107
+ }
108
+ payload[optionalKey] = rawValue;
109
+ continue;
110
+ }
100
111
  payload[optionalKey] = coerceToString(context, source, rawKey, rawValue, itemIndex);
101
112
  continue;
102
113
  }
@@ -220,7 +231,7 @@ class ChatAds {
220
231
  name: 'ip',
221
232
  type: 'string',
222
233
  default: '',
223
- description: 'IPv4 address for country detection (max 64 characters)',
234
+ description: 'IPv4/IPv6 address for country detection (max 45 characters)',
224
235
  },
225
236
  {
226
237
  displayName: 'Country',
@@ -271,6 +282,24 @@ class ChatAds {
271
282
  default: false,
272
283
  description: 'Treat exact message as product keyword. When true, goes straight to affiliate link discovery without keyword extraction',
273
284
  },
285
+ {
286
+ displayName: 'Demo Mode',
287
+ name: 'demo',
288
+ type: 'boolean',
289
+ default: false,
290
+ description: 'Enable demo mode',
291
+ },
292
+ {
293
+ displayName: 'Max Offers',
294
+ name: 'max_offers',
295
+ type: 'number',
296
+ typeOptions: {
297
+ minValue: 1,
298
+ maxValue: 2,
299
+ },
300
+ default: 1,
301
+ description: 'Maximum number of affiliate offers to return (1-2)',
302
+ },
274
303
  {
275
304
  displayName: 'Extra Fields (JSON)',
276
305
  name: 'extraFieldsJson',
@@ -375,13 +404,20 @@ class ChatAds {
375
404
  if (!normalizedKey) {
376
405
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Field "${field}" is not supported`, { itemIndex });
377
406
  }
378
- if (normalizedKey === 'skip_message_analysis') {
407
+ if (normalizedKey === 'skip_message_analysis' || normalizedKey === 'demo') {
379
408
  if (typeof value !== 'boolean') {
380
409
  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Field "${field}" must be provided as a boolean`, { itemIndex });
381
410
  }
382
411
  constructed[normalizedKey] = value;
383
412
  continue;
384
413
  }
414
+ if (normalizedKey === 'max_offers') {
415
+ if (typeof value !== 'number') {
416
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Field "${field}" must be provided as a number`, { itemIndex });
417
+ }
418
+ constructed[normalizedKey] = value;
419
+ continue;
420
+ }
385
421
  constructed[normalizedKey] = coerceToString(this, 'Additional fields', field, value, itemIndex);
386
422
  }
387
423
  body = buildPayloadFromObject(this, constructed, 'Additional fields', itemIndex);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-chatads",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "n8n wrapper around the ChatAds FastAPI backend (affiliate/chatads_backend.py)",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",