{ "name": "Send Slack alerts when public pricing, policies or docs change", "nodes": [ { "id": "2adf8622-06d6-413e-970f-4ccf40ff64fd", "name": "Run a manual check", "type": "n8n-nodes-base.manualTrigger", "typeVersion": 1, "position": [0, 0], "parameters": {} }, { "id": "d437d333-ff0e-4b9b-bd0d-1ab712af8adc", "name": "Check daily", "type": "n8n-nodes-base.scheduleTrigger", "typeVersion": 1.2, "position": [0, 200], "parameters": { "rule": { "interval": [{ "field": "days", "daysInterval": 1, "triggerAtHour": 9, "triggerAtMinute": 0 }] } } }, { "id": "f0eef663-07eb-4371-8f28-1aa9df56c245", "name": "Watch settings", "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [220, 100], "parameters": { "assignments": { "assignments": [ { "id": "35ca6c9b-069e-4423-a3a9-ac811c632d79", "name": "apifyTaskId", "value": "", "type": "string" }, { "id": "c4951d2e-c8f8-4509-9c84-13ab017424c6", "name": "slackChannelId", "value": "", "type": "string" } ] }, "options": {} } }, { "id": "3c6a58fc-f1c8-418f-b762-52654ab56b37", "name": "Validate settings", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [440, 100], "parameters": { "jsCode": "const settings = $input.first().json;\nconst taskId = settings.apifyTaskId.trim();\nconst channel = settings.slackChannelId.trim();\nconst sample = !taskId;\nif (sample && $('Check daily').isExecuted) {\n throw new Error('Set a private Apify task ID before publishing the daily schedule.');\n}\nif (!sample && !/^[a-zA-Z0-9]{1,64}$/.test(taskId)) {\n throw new Error('Paste the Apify task ID from the task details, without its URL.');\n}\nif (!sample && !/^[CGD][A-Z0-9]+$/.test(channel)) {\n throw new Error('Set the Slack channel ID and invite your Slack bot to that channel.');\n}\nreturn [{ json: { sample, taskId, channel } }];" } }, { "id": "0862a603-c5e9-4f46-838f-3628a3332043", "name": "Check for page changes in Apify", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [660, 100], "parameters": { "method": "POST", "url": "={{ 'https://api.apify.com/v2/' + ($json.sample ? 'acts/suprsonic~web-change-monitor' : 'actor-tasks/' + $json.taskId) + '/run-sync-get-dataset-items?timeout=120' }}", "authentication": "genericCredentialType", "genericAuthType": "httpBearerAuth", "sendBody": true, "specifyBody": "json", "jsonBody": "={{ JSON.stringify($json.sample ? { mode: 'sample' } : {}) }}", "options": { "timeout": 150000, "redirect": { "redirect": { "followRedirects": false } }, "response": { "response": { "fullResponse": true, "responseFormat": "json" } } } } }, { "id": "d507413c-5d4a-4967-969c-f26ed2486c91", "name": "Read diff and prepare alert", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [880, 100], "parameters": { "jsCode": "const { sample, channel } = $('Validate settings').first().json;\nconst rows = $input.first().json.body;\nif (!Array.isArray(rows) || rows.length !== 1) {\n throw new Error('Expected one Website Change Monitor result. Check the Apify run history and task.');\n}\nconst [row] = rows;\nif (row?.status === 'error') {\n throw new Error('The page check failed. See the Apify task run for details.');\n}\nconst expectedSource = sample ? 'sample' : 'live';\nif (row?.source !== expectedSource || !['baseline', 'unchanged', 'changed'].includes(row.status)) {\n throw new Error('The task did not return the expected monitor result. Check its Actor and mode.');\n}\nconst notify = row.status === 'changed' && !sample;\nif (!notify) return [{ json: { ...row, notify } }];\nif (typeof row.url !== 'string' || !row.url.startsWith('https://') || typeof row.changeId !== 'string') {\n throw new Error('The change result is missing its public page URL or change ID.');\n}\nconst excerpt = (text) => {\n const value = typeof text === 'string' && text.length ? text : '(none)';\n return value.length > 1000 ? `${value.slice(0, 1000)}…` : value;\n};\nconst message = [\n `Public page changed: ${excerpt(row.url)}`,\n `Checked: ${row.checkedAt}`,\n `Added:\\n${excerpt(row.addedText)}`,\n `Removed:\\n${excerpt(row.removedText)}`,\n `Change ID: ${row.changeId}`,\n].join('\\n\\n');\nreturn [{ json: { ...row, notify, channel, message } }];" } }, { "id": "1fe04bcc-8b11-4ff8-8881-ce6c3bddece6", "name": "Send only live changes", "type": "n8n-nodes-base.if", "typeVersion": 2.2, "position": [1100, 100], "parameters": { "conditions": { "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict", "version": 2 }, "conditions": [{ "id": "cc15ecb3-4c06-4d3a-a8c1-86035f0f261b", "leftValue": "={{ $json.notify }}", "rightValue": "", "operator": { "type": "boolean", "operation": "true", "singleValue": true } }], "combinator": "and" }, "options": {} } }, { "id": "1bb34bba-30c7-4399-8bc1-7acff657a81c", "name": "Post the diff to Slack", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [1320, 0], "parameters": { "method": "POST", "url": "https://slack.com/api/chat.postMessage", "authentication": "genericCredentialType", "genericAuthType": "httpBearerAuth", "sendBody": true, "specifyBody": "json", "jsonBody": "={{ JSON.stringify({ channel: $json.channel, text: $json.message, mrkdwn: false, parse: 'none', unfurl_links: false, unfurl_media: false }) }}", "options": { "timeout": 15000, "redirect": { "redirect": { "followRedirects": false } }, "response": { "response": { "responseFormat": "json" } } } } }, { "id": "6dc7d72a-b2a8-4469-9023-bcf3da97ae8e", "name": "Confirm Slack delivery", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [1540, 0], "parameters": { "jsCode": "const reply = $input.first().json;\nif (reply.ok !== true) {\n throw new Error(`Slack rejected the alert (${reply.error ?? 'unknown error'}). Check the bot scope and channel membership, then rerun the Slack request with the saved alert.`);\n}\nreturn [{ json: { delivered: true, channel: reply.channel, timestamp: reply.ts } }];" } }, { "id": "82130f3e-2e6e-40c3-9b95-486997ac3829", "name": "Setup and pricing", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, "position": [0, -520], "parameters": { "width": 820, "height": 460, "content": "## Watch public pricing, policy or documentation changes\n\n**Try it:** In **Check for page changes in Apify**, choose a Bearer Auth credential holding your Apify API token. Leave **Watch settings** blank and run manually. Open **Read diff and prepare alert** to see the sample output. The sample uses zero Suprsonic credits and sends no Slack message.\n\n**Go live:** In the [Website Change Monitor](https://apify.com/suprsonic/web-change-monitor), select **Monitor a live page**, enter a permitted public HTTPS URL and a monitor name, then add [your Suprsonic API key](https://suprsonic.ai/app/api?utm_source=n8n&utm_medium=workflow_template&utm_campaign=web-change-monitor). Save this as a private Apify task. Put its task ID and your Slack channel ID in **Watch settings**. In **Post the diff to Slack**, use a separate Bearer Auth credential for a Slack bot with `chat:write` and invite the bot to the channel.\n\nRun manually to save a baseline. Publish the workflow only when you are ready for the daily check. It uses the workflow's timezone. Pick a cadence the public source allows.\n\nLive checks use one Suprsonic credit per successful Fast Scrape request. [Suprsonic plans](https://suprsonic.ai/plans?utm_source=n8n&utm_medium=workflow_template&utm_campaign=web-change-monitor) include API credits. Apify platform usage is separate." } }, { "id": "cd6440de-6674-49fa-8166-2faec93db50b", "name": "Results and alerts", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, "position": [880, -360], "parameters": { "width": 710, "height": 300, "content": "## A text diff when a watched page changes\n\nApify stores the baseline in your account. Keep the monitor name and URL stable and use one schedule for each watch. The first successful live check sets the baseline. Later checks send the added and removed lines to Slack when the readable text changes. Review the Apify run for the full result.\n\nThe monitor reads public server-rendered text. Choose a page that permits automated reads and whose relevant text is visible without JavaScript. A failed check appears as a failed n8n execution." } } ], "connections": { "Run a manual check": { "main": [[{ "node": "Watch settings", "type": "main", "index": 0 }]] }, "Check daily": { "main": [[{ "node": "Watch settings", "type": "main", "index": 0 }]] }, "Watch settings": { "main": [[{ "node": "Validate settings", "type": "main", "index": 0 }]] }, "Validate settings": { "main": [[{ "node": "Check for page changes in Apify", "type": "main", "index": 0 }]] }, "Check for page changes in Apify": { "main": [[{ "node": "Read diff and prepare alert", "type": "main", "index": 0 }]] }, "Read diff and prepare alert": { "main": [[{ "node": "Send only live changes", "type": "main", "index": 0 }]] }, "Send only live changes": { "main": [[{ "node": "Post the diff to Slack", "type": "main", "index": 0 }], []] }, "Post the diff to Slack": { "main": [[{ "node": "Confirm Slack delivery", "type": "main", "index": 0 }]] } }, "active": false, "settings": { "executionOrder": "v1" } }