{
  "name": "UK Company Change Alerts - daily monitoring",
  "nodes": [
    {
      "parameters": {
        "content": "# UK Company Change Alerts\n\n1. Attach an n8n Header Auth credential to **Run UK Company Alerts Actor**. Use header `Authorization` and value `Bearer YOUR_APIFY_API_TOKEN`.\n2. Edit that node's JSON body with your company numbers and one stable `monitorId`.\n3. Test once to create the baseline. Baseline and unchanged rows do not reach the final node.\n4. Replace **Connect Slack or email here** with your private notification node.\n\nEvery successful company check uses the Actor's published pay-per-event pricing.",
        "height": 340,
        "width": 500,
        "color": 5
      },
      "id": "2fbeb3ce-5f2c-4cec-b8ff-5092a039fa20",
      "name": "Setup notes",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -620,
        -300
      ]
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 8 * * *"
            }
          ]
        }
      },
      "id": "66494679-87d9-42a1-9451-92c8f6bd319e",
      "name": "Every morning",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        -540,
        80
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.apify.com/v2/actors/ai-coding-radar~uk-company-change-alerts/run-sync-get-dataset-items?clean=1",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "contentType": "json",
        "specifyBody": "json",
        "jsonBody": "{\n  \"companyNumbers\": [\"02050399\"],\n  \"monitorId\": \"supplier-watchlist\",\n  \"emitUnchanged\": false\n}",
        "options": {
          "timeout": 120000
        }
      },
      "id": "1f720f42-1374-4164-bff3-8b1f0dc6f954",
      "name": "Run UK Company Alerts Actor",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -260,
        80
      ]
    },
    {
      "parameters": {
        "jsCode": "const entries = $input.all();\nconst rows = entries.flatMap(({ json }) => {\n  if (Array.isArray(json)) return json;\n  if (json && Array.isArray(json.body)) return json.body;\n  if (json && Array.isArray(json.data)) return json.data;\n  if (json && Array.isArray(json.items)) return json.items;\n  return json && typeof json === 'object' ? [json] : [];\n});\nconst actionable = new Set(['changed', 'source_not_found', 'source_error']);\nreturn rows\n  .filter(row => row && actionable.has(row.status))\n  .map(row => ({\n    json: {\n      ...row,\n      alertType: row.status === 'changed' ? 'company_change' : 'source_warning',\n      alertText: row.status === 'changed'\n        ? `${row.companyName || row.companyNumber}: ${row.field} changed`\n        : `${row.companyNumber}: ${row.errorMessage || row.status}`\n    }\n  }));"
      },
      "id": "bb1a2af7-f03a-4681-ab76-aa7ecec3749f",
      "name": "Keep changes and source failures",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        20,
        80
      ]
    },
    {
      "parameters": {},
      "id": "691ff0e5-b403-42d7-a548-48278724e201",
      "name": "Connect Slack or email here",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        300,
        80
      ]
    }
  ],
  "connections": {
    "Every morning": {
      "main": [
        [
          {
            "node": "Run UK Company Alerts Actor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run UK Company Alerts Actor": {
      "main": [
        [
          {
            "node": "Keep changes and source failures",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Keep changes and source failures": {
      "main": [
        [
          {
            "node": "Connect Slack or email here",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "timezone": "Europe/London",
    "saveManualExecutions": true
  },
  "versionId": "c3289342-b7a0-49fd-b07d-4c90959c8e83",
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": []
}