{
  "id": "rzxAcZoxnmBi7ipN",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Email Pattern Generator and Verifier",
  "tags": [],
  "nodes": [
    {
      "id": "3010955c-90d1-4fc1-813c-7c718db5abf2",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2848,
        2656
      ],
      "parameters": {
        "color": 7,
        "width": 848,
        "height": 304,
        "content": "## Collect contact details\n\nStarts the chat workflow and asks the user for the first name, last name, and company website needed to infer possible email addresses."
      },
      "typeVersion": 1
    },
    {
      "id": "8e9be6e6-9f6a-448c-876c-c1444e15dbfd",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1968,
        2416
      ],
      "parameters": {
        "color": 7,
        "width": 688,
        "height": 528,
        "content": "## Generate and iterate candidates\n\nBuilds likely email variations from the collected name and domain, then loops through each candidate. If the loop finishes without finding a valid address, it sends a no-result chat response."
      },
      "typeVersion": 1
    },
    {
      "id": "64e34c04-3d7c-4f4c-81f0-cbc07a1c1efa",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1248,
        2592
      ],
      "parameters": {
        "color": 7,
        "width": 384,
        "height": 336,
        "content": "## Verify email candidate\n\nChecks each generated email address with the Reoon email verification API and normalizes the API response into a consistent format for scoring.\nhttps://emailverifier.reoon.com/"
      },
      "typeVersion": 1
    },
    {
      "id": "558e1163-c9ce-4842-9593-b5d86420e098",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -832,
        2560
      ],
      "parameters": {
        "color": 7,
        "width": 448,
        "height": 464,
        "content": "## Evaluate verification result\n\nApplies decision rules to the normalized verification data, first checking whether the confidence score is high enough and then whether the address is safe or deliverable. Failed candidates are sent back into the loop for the next variation."
      },
      "typeVersion": 1
    },
    {
      "id": "6d6654f0-af85-476c-955b-d3de5e4501c2",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -352,
        2544
      ],
      "parameters": {
        "color": 7,
        "height": 368,
        "content": "## Return successful match\n\nSends the successful email result back to the chat once a candidate passes the score or deliverability checks."
      },
      "typeVersion": 1
    },
    {
      "id": "ff3458e0-7826-45fc-8d73-3e45e636a06c",
      "name": "Loop Over Email Variations",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -1712,
        2784
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "ff498314-4a61-46c3-a8e6-14147ddcc254",
      "name": "If Score Above 70",
      "type": "n8n-nodes-base.if",
      "position": [
        -784,
        2768
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "score-check",
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{ $json.overall_score }}",
              "rightValue": 70
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "ec8331ab-db2e-4ace-92aa-a221aca2c791",
      "name": "Check Email Status",
      "type": "n8n-nodes-base.if",
      "position": [
        -528,
        2864
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "status-safe",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "safe"
            },
            {
              "id": "deliverable-true",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.is_deliverable }}",
              "rightValue": true
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "ae02f85f-dd75-4cc5-acae-7939c2a8fb34",
      "name": "Notify Chat Success",
      "type": "@n8n/n8n-nodes-langchain.chat",
      "position": [
        -304,
        2752
      ],
      "parameters": {
        "message": "=Email: {{ $json.email }}\n\nOverall_score: {{ $json.overall_score }}\n\nStatus: {{ $json.status }}",
        "options": {}
      },
      "typeVersion": 1.3
    },
    {
      "id": "ccc8e2ba-0e88-4db9-8ecc-a675a70da675",
      "name": "Notify No Email Result",
      "type": "@n8n/n8n-nodes-langchain.chat",
      "position": [
        -1424,
        2576
      ],
      "parameters": {
        "message": "No verified email found",
        "options": {}
      },
      "typeVersion": 1.3
    },
    {
      "id": "82bb7b4b-16fb-4a67-b669-9857f911788c",
      "name": "Query First Name",
      "type": "@n8n/n8n-nodes-langchain.chat",
      "position": [
        -2560,
        2784
      ],
      "parameters": {
        "message": "Please provide first name",
        "options": {},
        "operation": "sendAndWait"
      },
      "typeVersion": 1.3
    },
    {
      "id": "3241f6bb-a18d-45c3-8092-ccf646791ab2",
      "name": "Query Last Name",
      "type": "@n8n/n8n-nodes-langchain.chat",
      "position": [
        -2352,
        2784
      ],
      "parameters": {
        "message": "Please provide last name",
        "options": {},
        "operation": "sendAndWait"
      },
      "typeVersion": 1.3
    },
    {
      "id": "9fcc4206-d4c2-4f35-b3be-1bf4c2f6c5cc",
      "name": "Query Domain Name",
      "type": "@n8n/n8n-nodes-langchain.chat",
      "position": [
        -2144,
        2784
      ],
      "parameters": {
        "message": "Please provide website",
        "options": {},
        "operation": "sendAndWait"
      },
      "typeVersion": 1.3
    },
    {
      "id": "7533e360-b311-49f1-810a-e120b895bd82",
      "name": "Create Email Variations",
      "type": "n8n-nodes-base.code",
      "position": [
        -1920,
        2784
      ],
      "parameters": {
        "jsCode": "const firstName = ($item(0).$node['Ask First Name1'].json.chatInput || $item(0).$node['Ask First Name1'].json.response || '').trim().toLowerCase();\nconst lastName = ($item(0).$node['Ask Last Name1'].json.chatInput || $item(0).$node['Ask Last Name1'].json.response || '').trim().toLowerCase();\nconst websiteRaw = ($item(0).$node['Ask Website1'].json.chatInput || $item(0).$node['Ask Website1'].json.response || '').trim().toLowerCase();\nconst companyDomain = websiteRaw.replace(/^https?:\\/\\//,'').replace(/^www\\./,'').split('/')[0];\n\nif (!firstName || !lastName || !companyDomain) {\n  return [{ json: { status: 'error', message: 'Missing first name, last name, or website.' } }];\n}\n\nconst f = firstName.charAt(0);\nconst l = lastName.charAt(0);\n\nconst patterns = [\n  `${firstName}.${lastName}@${companyDomain}`,\n  `${f}.${lastName}@${companyDomain}`,\n  `${firstName}.${l}@${companyDomain}`,\n  `${f}${lastName}@${companyDomain}`,\n  `${firstName}${lastName}@${companyDomain}`,\n  `${firstName}@${companyDomain}`,\n  `${f}.${l}@${companyDomain}`,\n  `${f}_${lastName}@${companyDomain}`,\n  `${firstName}_${lastName}@${companyDomain}`,\n  `${firstName}-${lastName}@${companyDomain}`,\n  `${lastName}.${firstName}@${companyDomain}`,\n  `${lastName}.${f}@${companyDomain}`,\n  `${lastName}@${companyDomain}`,\n  `${f}${l}@${companyDomain}`,\n  `${firstName}1@${companyDomain}`,\n  `${firstName}.${lastName}1@${companyDomain}`,\n  `${firstName}.${lastName}00@${companyDomain}`,\n  `${firstName}${l}@${companyDomain}`,\n  `${firstName.slice(0,3)}.${lastName.slice(0,1)}@${companyDomain}`\n];\n\nconst uniquePatterns = [...new Set(patterns.filter(Boolean))];\n\nreturn uniquePatterns.map((email, index) => ({\n  json: {\n    inputFirstName: firstName,\n    inputLastName: lastName,\n    companyDomain,\n    patternIndex: index + 1,\n    email,\n    emailLocalPart: email.split('@')[0]\n  }\n}));"
      },
      "typeVersion": 2
    },
    {
      "id": "f1772a07-bad3-4006-a9a3-8fee3a181a86",
      "name": "Verify Email with Reoon",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1200,
        2768
      ],
      "parameters": {
        "url": "=https://emailverifier.reoon.com/api/v1/verify?email={{ $json.email }}&key={{APIKEY}}&mode=power",
        "options": {
          "response": {
            "response": {
              "fullResponse": true,
              "responseFormat": "json"
            }
          }
        }
      },
      "typeVersion": 4.2,
      "continueOnFail": true
    },
    {
      "id": "6f2eba07-9e75-4893-bb32-6ed2543f9607",
      "name": "Normalize Verification Data",
      "type": "n8n-nodes-base.code",
      "position": [
        -1008,
        2768
      ],
      "parameters": {
        "jsCode": "const b = $json.body || $json;\n\nreturn [{\n  json: {\n    email: b.email,\n    overall_score: Number(b.overall_score ?? 0),\n    status: b.status ?? null,\n    is_deliverable: b.is_deliverable ?? false,\n    is_safe_to_send: b.is_safe_to_send ?? false\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "b566419a-bedb-4ce7-98f6-fff1dc779d14",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3408,
        2416
      ],
      "parameters": {
        "width": 480,
        "height": 560,
        "content": "## Email Pattern Generator and Verifier\n\n### How it works\n\nThis workflow chats with a user to collect a person\u2019s first name, last name, and company website, then generates common email address patterns from that data. It loops through the generated candidates, verifies each one using the Reoon email verification API, normalizes the response, and applies confidence and deliverability checks. When a good candidate is found it returns the result in chat; if none pass, it reports that no result was found.\n\n### Setup steps\n\n- Configure the chat trigger and chat nodes for the desired n8n chat environment.\n- Add a valid Reoon Email Verifier API key or credential to the HTTP request node.\n- Review the code node that generates email variations to ensure it uses the expected input field names from the chat prompts.\n- Confirm the score and deliverability thresholds in the IF nodes match your acceptable validation criteria.\n\n### Customization\n\nYou can adjust the generated email patterns, change the confidence threshold above 70, or refine the safe/deliverable conditions depending on how strict the verification should be."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "executionOrder": "v1"
  },
  "versionId": "ce2babd6-4317-4287-b7ae-c24b62db5d5a",
  "connections": {
    "Query Last Name": {
      "main": [
        [
          {
            "node": "Query Domain Name",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Query First Name": {
      "main": [
        [
          {
            "node": "Query Last Name",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If Score Above 70": {
      "main": [
        [
          {
            "node": "Notify Chat Success",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Check Email Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Query Domain Name": {
      "main": [
        [
          {
            "node": "Create Email Variations",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Email Status": {
      "main": [
        [
          {
            "node": "Notify Chat Success",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Loop Over Email Variations",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Email Variations": {
      "main": [
        [
          {
            "node": "Loop Over Email Variations",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Verify Email with Reoon": {
      "main": [
        [
          {
            "node": "Normalize Verification Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Email Variations": {
      "main": [
        [
          {
            "node": "Notify No Email Result",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Verify Email with Reoon",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Verification Data": {
      "main": [
        [
          {
            "node": "If Score Above 70",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}