{
  "name": "Monitor data breaches in real-time with Have I Been Pwned",
  "nodes": [
    {
      "id": "00140d4e-0975-4835-91f2-c4890bb373b2",
      "name": "When clicking ‘Test workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -1900,
        1580
      ]
    },
    {
      "id": "ad4ef337-09a6-4031-882a-ec5d40ef9ae4",
      "name": "Convert to File",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        -900,
        780
      ]
    },
    {
      "id": "194bd486-b24d-4169-b447-ff5878c92bdb",
      "name": "Split Out",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -1200,
        1220
      ]
    },
    {
      "id": "a781fb7f-1ab6-4a8c-a1ab-c301dbd465e5",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -2040,
        860
      ]
    },
    {
      "id": "8ee8b36c-da98-40b7-850f-aa8957734f6b",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2060,
        680
      ],
      "parameters": {
        "width": 760,
        "height": null,
        "content": "### Receive an alert when new breaches are added to haveibeenpwned.com\n\n*📜 Review the [changelog](https://relezy.com/changelog/xqus-haveibeenpwnedcom-breaches).*\n\nThis workflow demonstrates how we can"
      }
    },
    {
      "id": "b24ef1a2-f8d2-4d0b-9df2-58d657d80672",
      "name": "Request breaches",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1780,
        860
      ]
    },
    {
      "id": "b7e516d2-bb44-4d1a-8381-5ace8f13e793",
      "name": "Read last breach",
      "type": "n8n-nodes-base.readWriteFile",
      "position": [
        -1560,
        1040
      ]
    },
    {
      "id": "367732d5-357a-4b96-ab78-f2101bc6519f",
      "name": "Get JSON from file",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        -1380,
        1120
      ]
    },
    {
      "id": "cfa77370-ae6c-48b6-b43a-e7ce2223bb48",
      "name": "Check for content",
      "type": "n8n-nodes-base.if",
      "position": [
        -1020,
        1220
      ]
    },
    {
      "id": "9219d25d-72a9-4cb7-9ed3-889a6a022fef",
      "name": "Set to none",
      "type": "n8n-nodes-base.set",
      "position": [
        -840,
        1280
      ]
    },
    {
      "id": "6b99d638-0eb5-4bbe-b7c7-731d5e5efc92",
      "name": "If - check for new",
      "type": "n8n-nodes-base.if",
      "position": [
        -1380,
        860
      ]
    },
    {
      "id": "19c9a9ec-3f79-4de3-bd12-8887c35577d3",
      "name": "Set breach name",
      "type": "n8n-nodes-base.set",
      "position": [
        -1100,
        780
      ]
    },
    {
      "id": "fd800b7d-6b28-4764-8d24-02e1f573f579",
      "name": "Write breach name to file",
      "type": "n8n-nodes-base.readWriteFile",
      "position": [
        -720,
        780
      ]
    },
    {
      "id": "981fe638-de7f-4866-a195-ee2bdbcfbf4d",
      "name": "New breach",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -1100,
        520
      ]
    },
    {
      "id": "0266e90f-46cd-490f-8897-bc7b9080de40",
      "name": "Old breach",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -1100,
        1040
      ]
    },
    {
      "id": "95a4c08a-dfb6-40b4-88ef-bfb24f862495",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1140,
        700
      ],
      "parameters": {
        "width": 640,
        "height": 240,
        "content": "### Save the name of the breach\nWe will check it the next time the workflow runs to see if we have a new breach."
      }
    },
    {
      "id": "79eaf6a2-2120-4525-b597-ca08ac4d103c",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1140,
        960
      ],
      "parameters": {
        "width": 640,
        "height": 240,
        "content": "### This breach has been seen before\nIf we end up here it means that the latest breach has been seen before."
      }
    },
    {
      "id": "bf48f803-2355-4d7f-abb7-6ddcbcf81f8d",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1140,
        440
      ],
      "parameters": {
        "width": 640,
        "height": 240,
        "content": "### This is a new breach - send alert\nIf we end up here it means that the latest breach is new. Time to send some alerts to Slack, or Discord or something."
      }
    },
    {
      "id": "6a805df1-3a30-447f-86c6-2cdef050e044",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1760,
        1500
      ],
      "parameters": {
        "width": 600,
        "height": 260,
        "content": "### Clean up the cache\nDelete the `./cache.json` file. This will make sure the alert is triggered on the next run."
      }
    },
    {
      "id": "9734f72b-eaf6-4a8e-bdcb-59920ac0ac04",
      "name": "Set empty json",
      "type": "n8n-nodes-base.set",
      "position": [
        -1720,
        1580
      ]
    },
    {
      "id": "04b4747c-0bf3-4e41-9bff-b41e2820634c",
      "name": "Write cache.json",
      "type": "n8n-nodes-base.readWriteFile",
      "position": [
        -1380,
        1580
      ]
    },
    {
      "id": "48b12238-8358-4e68-92be-a7e3a2a80ca1",
      "name": "Convert json to file",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        -1540,
        1580
      ]
    },
    {
      "id": "4908e314-d80a-4cfd-9f0f-01f395550863",
      "name": "Add information about the last breach we alerted",
      "type": "n8n-nodes-base.merge",
      "position": [
        -1560,
        860
      ]
    },
    {
      "id": "f8dbd041-11c3-460d-9728-956d0de657d9",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2020,
        1100
      ],
      "parameters": {
        "width": 380,
        "height": 240,
        "content": "## Support My Work! ❤️\n\n**👋 Hello! I'm Audun / xqus** \n🔗 My work: [xqus.com](https://xqus.com)\n💸 n8n shop: [xqus.gumroad.com](https://xqus.gumroad.com)\n\n**If you find this workflow helpful**, consider"
      }
    }
  ],
  "connections": {
    "Split Out": {
      "main": [
        [
          {
            "node": "Check for content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set to none": {
      "main": [
        [
          {
            "node": "Add information about the last breach we alerted",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Set empty json": {
      "main": [
        [
          {
            "node": "Convert json to file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to File": {
      "main": [
        [
          {
            "node": "Write breach name to file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set breach name": {
      "main": [
        [
          {
            "node": "Convert to File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read last breach": {
      "main": [
        [
          {
            "node": "Get JSON from file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Request breaches": {
      "main": [
        [
          {
            "node": "Read last breach",
            "type": "main",
            "index": 0
          },
          {
            "node": "Add information about the last breach we alerted",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Request breaches",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check for content": {
      "main": [
        [
          {
            "node": "Add information about the last breach we alerted",
            "type": "main",
            "index": 1
          }
        ],
        [
          {
            "node": "Set to none",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get JSON from file": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If - check for new": {
      "main": [
        [
          {
            "node": "Set breach name",
            "type": "main",
            "index": 0
          },
          {
            "node": "New breach",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Old breach",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert json to file": {
      "main": [
        [
          {
            "node": "Write cache.json",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Set empty json",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add information about the last breach we alerted": {
      "main": [
        [
          {
            "node": "If - check for new",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}