{
  "name": "Monitor Klaviyo list decay with Postgres logging and Gmail reports + BillionVerify",
  "nodes": [
    {
      "id": "f98419c4-d03d-4376-8754-41a5bba914fc",
      "name": "📉 List Decay Detection — Main",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        304,
        -32
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "295b4723-871a-48b4-b816-d153035a5165",
      "name": "⚠️ Critical Setup",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -752,
        -32
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "2db14079-e696-477e-80f9-a64f940e9561",
      "name": "Section — Setup & Profile Fetch",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        976
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "4e7b6f1c-0896-4523-8d02-4c31b8aea992",
      "name": "Section — Score, Persist & Report",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1408,
        688
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "c147877b-a7d8-458e-98e5-ecbcf9e743cd",
      "name": "Section — Critical Suppression Branch",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1664,
        1328
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "b135dea8-b459-40c6-9d51-808070db287b",
      "name": "Section — Error Handling Branch",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        512,
        1408
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "4b43378f-1f50-49bb-9da6-f1529599bffd",
      "name": "Schedule: Daily 2AM",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        544,
        1088
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "231fd606-bc28-428d-b994-2239ae2501fc",
      "name": "Set: Initialize Run",
      "type": "n8n-nodes-base.set",
      "position": [
        768,
        1088
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "bf4b1adb-4e34-4382-bb78-bb766e487552",
      "name": "Get All Profiles",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        992,
        1088
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "248fd7f4-c114-4e5a-a618-f396aab330d3",
      "name": "Extract Profile Items",
      "type": "n8n-nodes-base.code",
      "position": [
        1216,
        1088
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "1e5803d7-84b3-4191-b4ce-71c0255c0842",
      "name": "Score Profiles",
      "type": "n8n-nodes-base.code",
      "position": [
        1440,
        1088
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "6238651d-68cd-4a21-a56a-a500f87172c5",
      "name": "Log Profiles to DB",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1712,
        816
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "05b3aa23-1cb3-4e25-8d24-35a2f7ef7adb",
      "name": "Build Run Summary",
      "type": "n8n-nodes-base.code",
      "position": [
        1664,
        1088
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "67f51914-491f-4ee1-8f98-81f270a87a8b",
      "name": "Insert Run Summary",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1888,
        1088
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "b8c4c6f1-eea6-443e-babe-224c6a87981e",
      "name": "Build Email HTML",
      "type": "n8n-nodes-base.code",
      "position": [
        2112,
        1088
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "4654f6a8-9b2a-4ffe-ad28-e8c06cf2b7e4",
      "name": "Is Critical?",
      "type": "n8n-nodes-base.if",
      "position": [
        1712,
        1376
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "05f0eb40-3e8a-4eb4-a272-8924490fc336",
      "name": "Suppress Critical in Batches",
      "type": "n8n-nodes-base.code",
      "position": [
        1968,
        1360
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "e0f224e3-0feb-415d-a7cd-5c4289d9bf18",
      "name": "Error Trigger",
      "type": "n8n-nodes-base.errorTrigger",
      "position": [
        544,
        1504
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "969e7c6c-ff49-4f18-a320-5afc455e70a9",
      "name": "Prepare Error Data",
      "type": "n8n-nodes-base.code",
      "position": [
        768,
        1504
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "5d9f68e1-6152-4f77-9c64-f3cafaf75d7c",
      "name": "Log Error to DB",
      "type": "n8n-nodes-base.postgres",
      "position": [
        992,
        1504
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "9fbb554a-9a52-4b99-ba17-af09634d9767",
      "name": "Send Error Alert",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1216,
        1504
      ],
      "webhookId": "20753bdf-aa45-4c1e-adbc-fd1b742f8288",
      "parameters": {},
      "typeVersion": 2.1
    },
    {
      "id": "01cd7e2e-ade3-47ac-87bf-a344bd212c2b",
      "name": "Send a message",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2336,
        1088
      ],
      "webhookId": "64071c63-a7bc-459f-8c4e-f1e6bf7935ed",
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "parameters": {
        "operation": "verify",
        "email": "={{ $json.email || $json.Email }}",
        "additionalOptions": {}
      },
      "type": "n8n-nodes-billionverify.billionVerify",
      "typeVersion": 1,
      "position": [
        856,
        1504
      ],
      "name": "Verify Email (BillionVerify)",
      "credentials": {
        "billionVerifyApi": {
          "id": "",
          "name": "BillionVerify account"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "is-deliverable",
              "leftValue": "={{ $json.is_deliverable }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ]
        }
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        1036,
        1504
      ],
      "name": "IF deliverable"
    },
    {
      "parameters": {
        "operation": "verify",
        "email": "={{ $json.email || $json.Email }}",
        "additionalOptions": {}
      },
      "type": "n8n-nodes-billionverify.billionVerify",
      "typeVersion": 1,
      "position": [
        1976,
        1088
      ],
      "name": "Verify Email (BillionVerify) 2",
      "credentials": {
        "billionVerifyApi": {
          "id": "",
          "name": "BillionVerify account"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "is-deliverable",
              "leftValue": "={{ $json.is_deliverable }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ]
        }
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        2156,
        1088
      ],
      "name": "IF deliverable 2"
    }
  ],
  "connections": {
    "Is Critical?": {
      "main": [
        [
          {
            "node": "Suppress Critical in Batches",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Error Trigger": {
      "main": [
        [
          {
            "node": "Prepare Error Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Score Profiles": {
      "main": [
        [
          {
            "node": "Log Profiles to DB",
            "type": "main",
            "index": 0
          },
          {
            "node": "Build Run Summary",
            "type": "main",
            "index": 0
          },
          {
            "node": "Is Critical?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log Error to DB": {
      "main": [
        [
          {
            "node": "Verify Email (BillionVerify)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Email HTML": {
      "main": [
        [
          {
            "node": "Verify Email (BillionVerify) 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get All Profiles": {
      "main": [
        [
          {
            "node": "Extract Profile Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Run Summary": {
      "main": [
        [
          {
            "node": "Insert Run Summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Insert Run Summary": {
      "main": [
        [
          {
            "node": "Build Email HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Error Data": {
      "main": [
        [
          {
            "node": "Log Error to DB",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule: Daily 2AM": {
      "main": [
        [
          {
            "node": "Set: Initialize Run",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set: Initialize Run": {
      "main": [
        [
          {
            "node": "Get All Profiles",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Profile Items": {
      "main": [
        [
          {
            "node": "Score Profiles",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Verify Email (BillionVerify)": {
      "main": [
        [
          {
            "node": "IF deliverable",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF deliverable": {
      "main": [
        [
          {
            "node": "Send Error Alert",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Verify Email (BillionVerify) 2": {
      "main": [
        [
          {
            "node": "IF deliverable 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF deliverable 2": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    }
  },
  "settings": {
    "binaryMode": "separate",
    "executionOrder": "v1"
  }
}