{
  "name": "Verifly - Batch verify (100 per call) before Instantly/Smartlead",
  "nodes": [
    {
      "parameters": {
        "content": "## Batch verify\nReplace 'Sample emails' with your source (Read CSV, HubSpot, Apollo export...).\nChunks into 100 and calls POST /api/v1/verify/batch.\nKeep only result = deliverable before pushing to your sequencer.\nEnv: VERIFLY_API_KEY.",
        "height": 260,
        "width": 380
      },
      "id": "note",
      "name": "Read me",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        0,
        0
      ]
    },
    {
      "parameters": {},
      "id": "t",
      "name": "Run manually",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        320
      ]
    },
    {
      "parameters": {
        "jsCode": "return [{json:{email:'test@verifly.email'}},{json:{email:'nobody@example.com'}}];"
      },
      "id": "s",
      "name": "Sample emails",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        220,
        320
      ]
    },
    {
      "parameters": {
        "jsCode": "// Input: items with an `email` field (from any node: CSV, CRM, Sheets...)\nconst emails = $input.all().map(i => String(i.json.email || '').trim()).filter(Boolean);\nconst out = [];\nfor (let i = 0; i < emails.length; i += 100) out.push({ json: { emails: emails.slice(i, i + 100) } });\nreturn out;"
      },
      "id": "k",
      "name": "Chunk into 100",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        440,
        320
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://verifly.email/api/v1/verify/batch",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{ $env.VERIFLY_API_KEY }}"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ emails: $json.emails }) }}",
        "options": {
          "response": {
            "response": {
              "neverError": true
            }
          }
        }
      },
      "id": "v",
      "name": "Verifly batch",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        660,
        320
      ]
    },
    {
      "parameters": {
        "jsCode": "// Flatten batch results into one item per email\nconst out = [];\nfor (const item of $input.all()) {\n  for (const r of (item.json.results || [])) out.push({ json: { email: r.email, result: r.result, reason: r.reason, is_catch_all: r.details?.is_catch_all ?? null } });\n  if (item.json.success === false) out.push({ json: { error: item.json.error } });\n}\nreturn out;"
      },
      "id": "x",
      "name": "One item per email",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        880,
        320
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "conditions": [
            {
              "id": "c1",
              "leftValue": "={{ $json.result }}",
              "rightValue": "deliverable",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "if",
      "name": "Deliverable?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        1100,
        320
      ]
    },
    {
      "parameters": {},
      "id": "ok",
      "name": "Send to sequencer (replace)",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        1320,
        220
      ]
    },
    {
      "parameters": {},
      "id": "bad",
      "name": "Suppress / review",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        1320,
        420
      ]
    }
  ],
  "connections": {
    "Run manually": {
      "main": [
        [
          {
            "node": "Sample emails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sample emails": {
      "main": [
        [
          {
            "node": "Chunk into 100",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Chunk into 100": {
      "main": [
        [
          {
            "node": "Verifly batch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Verifly batch": {
      "main": [
        [
          {
            "node": "One item per email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "One item per email": {
      "main": [
        [
          {
            "node": "Deliverable?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Deliverable?": {
      "main": [
        [
          {
            "node": "Send to sequencer (replace)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Suppress / review",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {}
}