@pagecrawl/n8n-nodes-pagecrawl 0.3.8 → 0.3.9
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.
|
@@ -33,6 +33,7 @@ exports.WEBHOOK_PAYLOAD_FIELDS = [
|
|
|
33
33
|
{ value: 'id', description: 'Unique identifier of this check' },
|
|
34
34
|
{ value: 'title', description: 'The page title extracted from the monitored page' },
|
|
35
35
|
{ value: 'status', description: 'Check status (e.g., changed, unchanged, failed)' },
|
|
36
|
+
{ value: 'event_type', description: 'Type of event that triggered the webhook (change_detected or error)' },
|
|
36
37
|
{ value: 'content_type', description: 'Document content type (e.g., text/html, text/css, application/json)' },
|
|
37
38
|
{ value: 'visual_diff', description: 'Visual difference percentage between current and previous screenshots (0-100)' },
|
|
38
39
|
{ value: 'changed_at', description: 'ISO 8601 timestamp when the change was detected' },
|
|
@@ -102,6 +102,26 @@ class PageCrawlTrigger {
|
|
|
102
102
|
},
|
|
103
103
|
],
|
|
104
104
|
},
|
|
105
|
+
{
|
|
106
|
+
displayName: 'Events',
|
|
107
|
+
name: 'events',
|
|
108
|
+
type: 'multiOptions',
|
|
109
|
+
required: true,
|
|
110
|
+
options: [
|
|
111
|
+
{
|
|
112
|
+
name: 'Change Detected',
|
|
113
|
+
value: 'change_detected',
|
|
114
|
+
description: 'Triggered when a monitored page content changes',
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: 'Error',
|
|
118
|
+
value: 'error',
|
|
119
|
+
description: 'Triggered when a page check fails (timeout, blocked, etc.)',
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
default: ['change_detected'],
|
|
123
|
+
description: 'Which events should trigger this workflow',
|
|
124
|
+
},
|
|
105
125
|
{
|
|
106
126
|
displayName: 'Simplify Output',
|
|
107
127
|
name: 'simplifyOutput',
|
|
@@ -232,6 +252,7 @@ class PageCrawlTrigger {
|
|
|
232
252
|
const workspaceValue = workspaceLocator.value || '';
|
|
233
253
|
const pageLocator = this.getNodeParameter('page', { mode: 'list', value: '' });
|
|
234
254
|
const pageValue = pageLocator.value || '';
|
|
255
|
+
const events = this.getNodeParameter('events', ['change_detected']);
|
|
235
256
|
const simplifyOutput = this.getNodeParameter('simplifyOutput', true);
|
|
236
257
|
const sendTestOnListen = this.getNodeParameter('sendTestOnListen', true);
|
|
237
258
|
const baseUrl = 'https://pagecrawl.io';
|
|
@@ -245,9 +266,14 @@ class PageCrawlTrigger {
|
|
|
245
266
|
else {
|
|
246
267
|
payloadFields = this.getNodeParameter('payloadFields', defaultPayloadFields);
|
|
247
268
|
}
|
|
269
|
+
// Add event_type to payload fields if both events are selected
|
|
270
|
+
if (events.includes('change_detected') && events.includes('error') && !payloadFields.includes('event_type')) {
|
|
271
|
+
payloadFields = [...payloadFields, 'event_type'];
|
|
272
|
+
}
|
|
248
273
|
const body = {
|
|
249
274
|
target_url: webhookUrl,
|
|
250
275
|
event_type: 'n8n',
|
|
276
|
+
events: events,
|
|
251
277
|
};
|
|
252
278
|
// Add workspace_id (required)
|
|
253
279
|
if (workspaceValue) {
|
|
@@ -326,6 +352,7 @@ class PageCrawlTrigger {
|
|
|
326
352
|
async webhook() {
|
|
327
353
|
const req = this.getRequestObject();
|
|
328
354
|
const simplifyOutput = this.getNodeParameter('simplifyOutput', true);
|
|
355
|
+
const events = this.getNodeParameter('events', ['change_detected']);
|
|
329
356
|
const webhookData = req.body;
|
|
330
357
|
// Simplify output if requested
|
|
331
358
|
let responseData = webhookData;
|
|
@@ -342,6 +369,10 @@ class PageCrawlTrigger {
|
|
|
342
369
|
pageLink: webhookData.page ? webhookData.page.link : undefined,
|
|
343
370
|
contents: webhookData.contents,
|
|
344
371
|
};
|
|
372
|
+
// Include eventType if both events are selected
|
|
373
|
+
if (events.includes('change_detected') && events.includes('error')) {
|
|
374
|
+
responseData.eventType = webhookData.event_type;
|
|
375
|
+
}
|
|
345
376
|
}
|
|
346
377
|
return {
|
|
347
378
|
workflowData: [this.helpers.returnJsonArray(responseData)],
|
package/dist/package.json
CHANGED