{
  "id": "ttpfi7eLWpC3Hdxi",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "My workflow 11",
  "tags": [],
  "nodes": [
    {
      "id": "19cfc4f3-a220-4788-8e19-c6abbf65b948",
      "name": "When clicking \u2018Test workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        240,
        460
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "75cfd806-858f-4355-9d93-820620098657",
      "name": "Get Rows",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        460,
        460
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "false",
              "lookupColumn": "Status"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.YOUR_AWS_SECRET_KEY_HERE_WDKOmdbhkAr7c4keuDz2cc/edit#gid=0",
          "cachedResultName": "Emails"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1rZk6P7OyIiRX6Z4DuGDy_WDKOmdbhkAr7c4keuDz2cc",
          "cachedResultUrl": "https://docs.google.YOUR_AWS_SECRET_KEY_HERE_WDKOmdbhkAr7c4keuDz2cc/edit?usp=drivesdk",
          "cachedResultName": "Find Emails"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.5,
      "alwaysOutputData": true
    },
    {
      "id": "58350462-bdd6-4e97-abb8-97458b2ad169",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "onError": "continueRegularOutput",
      "position": [
        1340,
        320
      ],
      "parameters": {
        "text": "=You can use the below information to extract email pattern for {{ $('Get Rows').item.json.Domain }}\n\nSnippet1: {{ $('Get Email Pattern').item.json.organic[0].snippet }}\nSnippet2: {{ $('Get Email Pattern').item.json.organic[1].snippet }}\nSnippet3: {{ $('Get Email Pattern').item.json.organic[2].snippet }}\n\nUse the extracted email pattern to build email address for:\nFirst Name: {{ $('Get Rows').item.json['First Name'] }}\nLast Name: {{ $('Get Rows').item.json['Last Name'] }}\nDomain: {{ $('Get Rows').item.json.Domain }}",
        "options": {
          "systemMessage": "=You are an expert email pattern analyzer and constructor. Your task is to:\n\n1. Analyze three website snippets from a domain to identify the common email pattern used at that company.\n2. Based on your analysis, construct a likely email address for a specific person using their first name, last name, and the company domain.\n\n## Rules for pattern identification:\n- Look for any visible email addresses in the snippets (e.g., contact@company.com, j.smith@domain.com)\n- Identify patterns such as:\n  * first.last@domain.com\n  * first_last@domain.com\n  * firstlast@domain.com\n  * first@domain.com\n  * first.initial.last@domain.com\n  * last.first@domain.com\n  * firstinitiallast@domain.com\n  * lastfirst@domain.com\n  * etc.\n\n## If no clear pattern is found:\n- Suggest the most probable pattern based on common business email conventions\n- Rank your confidence level in the suggested pattern (high, medium, low)\n- Propose 1-2 alternative patterns as backups\n\n## Output format:\n1. **Identified Pattern**: [pattern description]\n2. **Confidence**: [high/medium/low]\n3. **Constructed Email**: [email address using the pattern]\n4. **Alternative Formats**: [1-2 backup email formats if confidence is not high]\n\nImportant: Your entire response must be valid JSON only, with no explanatory text before or after. Do not include markdown formatting, backticks, or code blocks around the JSON.\n\n\nBe precise, analytical, and logical in your pattern detection and email construction."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "notesInFlow": false,
      "retryOnFail": false,
      "typeVersion": 1.9
    },
    {
      "id": "bcb79bcf-55f6-406c-9fea-ff6d09f8bcae",
      "name": "OpenRouter Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        1260,
        600
      ],
      "parameters": {
        "model": "openai/o3-mini",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "c5ea7423-66d2-448e-90f2-934f41cc946f",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1600,
        600
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"identifiedPattern\": \"user@example.com\",\n  \"confidence\": \"high\",\n  \"constructedEmail\": \"user@example.com\",\n  \"alternativeFormats\": [\n    \"user@example.com\",\n    \"user@example.com\"\n  ]\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "6d33e7da-b138-4853-a615-4617df2b5736",
      "name": "Verify Email",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1720,
        320
      ],
      "parameters": {
        "url": "=https://api.prospeo.io/email-verifier",
        "method": "POST",
        "options": {
          "redirect": {
            "redirect": {}
          }
        },
        "sendBody": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "email",
              "value": "={{ $json.output.constructedEmail }}"
            }
          ]
        },
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "a96ce029-3c43-408d-bf8f-7d06071d6213",
      "name": "Update Rows",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1940,
        460
      ],
      "parameters": {
        "columns": {
          "value": {
            "ID": "={{ $('Get Rows').item.json.ID }}",
            "Email": "={{ $('AI Agent').item.json.output.constructedEmail }}",
            "Status": "TRUE",
            "Confidence": "={{ $('AI Agent').item.json.output.confidence }}",
            "Email Status": "={{ $json.response.email_status }}",
            "Email Pattern": "={{ $('AI Agent').item.json.output.identifiedPattern }}"
          },
          "schema": [
            {
              "id": "ID",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "First Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "First Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Last Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Last Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Website",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Website",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Domain",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Domain",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email Pattern",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Email Pattern",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Confidence",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Confidence",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Email Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "ID"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.YOUR_AWS_SECRET_KEY_HERE_WDKOmdbhkAr7c4keuDz2cc/edit#gid=0",
          "cachedResultName": "Emails"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1rZk6P7OyIiRX6Z4DuGDy_WDKOmdbhkAr7c4keuDz2cc",
          "cachedResultUrl": "https://docs.google.YOUR_AWS_SECRET_KEY_HERE_WDKOmdbhkAr7c4keuDz2cc/edit?usp=drivesdk",
          "cachedResultName": "Find Emails"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "9c987841-2034-4489-99d4-5d600f816679",
      "name": "Get Email Pattern",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        680,
        460
      ],
      "parameters": {
        "url": "https://google.serper.dev/search",
        "method": "POST",
        "options": {
          "redirect": {
            "redirect": {}
          }
        },
        "sendBody": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "q",
              "value": "=site:rocketreach.co email pattern for {{ $json.Domain }}"
            }
          ]
        },
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "1e0e9523-76bc-4bf3-8061-7980248df3d7",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1140,
        380
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "cf462ecb-1392-4486-b017-73172971a03a",
      "name": "Has\u00a0Snippet\u202fResults?",
      "type": "n8n-nodes-base.if",
      "position": [
        900,
        460
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "857568fd-ee3e-4d86-8853-2db9dd810c55",
              "operator": {
                "type": "array",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.organic }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "80200a67-ca87-4775-bf91-40e9c0b4ad61",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "width": 600,
        "height": 300,
        "content": "## \ud83d\udce8\u202fFind\u202fEmails \u2013 Basic  \nAutomates **Google\u202fSheets \u2192 Serper \u2192 Gemini\u202fFlash \u2192 Prospeo/Sparkle \u2192 Sheets**  \n\n1. Pull rows where `Status = FALSE`  \n2. Scrape 3 RocketReach snippets with **Serper.dev**  \n3. Detect email pattern & build address (Gemini Flash via **OpenRouter**)  \n4. Verify (**Prospeo API** or Sparkle bulk)  \n5. Write back \u279c set `Status = TRUE`\n\n<!-- Ideal users: SDRs, recruiters, growth teams -->"
      },
      "typeVersion": 1
    },
    {
      "id": "55375484-6dcc-4f69-a88a-5aa43432f870",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        820,
        0
      ],
      "parameters": {
        "color": 5,
        "width": 880,
        "height": 300,
        "content": "> ## \ud83d\udd27 Quick\u202fsetup\n>\n> **Google\u202fSheet**  \n> Copy \u2192 https://docs.google.com/spreadsheets/d/1rZk6P7OyIiRX6Z4DuGDy_WDKOmdbhkAr7c4keuDz2cc/edit?usp=sharing  \n\n\n> **API keys**  \n\n> \u2022 Serper \u2192 header **X\u2011API\u2011KEY** in *Get\u202fEmail\u202fPattern*  \n> \u2022 OpenRouter \u2192 creds on *OpenRouter\u202fChat\u202fModel*  \n> \u2022 Prospeo \u2192 header **X\u2011KEY** in *Verify\u202fEmail*\n>\n> Need volume? export the \"Email\" column and bulk\u2011verify free in Sparkle (10\u202fk/day).\n"
      },
      "typeVersion": 1
    },
    {
      "id": "ffc1edd6-14e4-4051-b7ea-82bc219050f5",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1900,
        0
      ],
      "parameters": {
        "color": 4,
        "width": 600,
        "height": 300,
        "content": "### \u27a1\ufe0f Columns updated\n\n* **Email** \u2013 constructed address  \n* **Email Pattern** \u2013 e.g. `first.last@`  \n* **Confidence** \u2013 high / medium / low  \n* **Email Status** \u2013 `deliverable`, `risky`, etc.  \n* **Status** \u2013 flips to `TRUE`\n\n<!-- Feel free to add Phone, LinkedIn URL, etc. in Update Rows mapping -->"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "1c56475c-a2e6-4c84-9082-1e7b729c0e39",
  "connections": {
    "AI Agent": {
      "main": [
        [
          {
            "node": "Verify Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Rows": {
      "main": [
        [
          {
            "node": "Get Email Pattern",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Rows": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Verify Email": {
      "main": [
        [
          {
            "node": "Update Rows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Email Pattern": {
      "main": [
        [
          {
            "node": "Has\u00a0Snippet\u202fResults?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Has\u00a0Snippet\u202fResults?": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Test workflow\u2019": {
      "main": [
        [
          {
            "node": "Get Rows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}