{
  "name": "SimpleVerifier: verify an Apollo or Clay export, write a first line with AI, add to Smartlead",
  "nodes": [
    {
      "id": "n2000001-0000-4000-8000-000000000001",
      "name": "Run manually",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        240,
        300
      ],
      "parameters": {}
    },
    {
      "id": "n2000001-0000-4000-8000-000000000002",
      "name": "Read leads",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        460,
        300
      ],
      "parameters": {
        "operation": "getAll",
        "documentId": {
          "__rl": true,
          "value": "YOUR_GOOGLE_SHEET_ID",
          "mode": "id"
        },
        "sheetName": {
          "__rl": true,
          "value": "Leads",
          "mode": "name"
        },
        "options": {}
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "REPLACE_ME",
          "name": "Google Sheets account"
        }
      }
    },
    {
      "id": "n2000001-0000-4000-8000-000000000003",
      "name": "SimpleVerifier verify",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        680,
        300
      ],
      "retryOnFail": true,
      "maxTries": 3,
      "waitBetweenTries": 5000,
      "parameters": {
        "method": "POST",
        "url": "https://simpleverifier.com/api/v1/verify",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ email: $json.email }) }}",
        "options": {
          "timeout": 40000,
          "batching": {
            "batch": {
              "batchSize": 1,
              "batchInterval": 600
            }
          },
          "response": {
            "response": {
              "neverError": true
            }
          }
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "REPLACE_ME",
          "name": "SimpleVerifier API key"
        }
      }
    },
    {
      "id": "n2000001-0000-4000-8000-000000000004",
      "name": "Keep action = send",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        900,
        300
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "c1a2b3c4-0001-4000-8000-000000000001",
              "leftValue": "={{ $json.action }}",
              "rightValue": "send",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "id": "n2000001-0000-4000-8000-000000000005",
      "name": "Write first line (Anthropic API)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1120,
        200
      ],
      "retryOnFail": true,
      "maxTries": 3,
      "waitBetweenTries": 5000,
      "parameters": {
        "method": "POST",
        "url": "https://api.anthropic.com/v1/messages",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "anthropic-version",
              "value": "2023-06-01"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({\n  model: \"claude-haiku-5-5\",\n  max_tokens: 1024,\n  system: \"You write the first line of a cold email. One sentence, under 25 words, plain words. Use only the facts given. Never invent news, funding, awards or a recent event. If the facts are thin, write a short neutral line about the role. No exclamation marks.\",\n  messages: [{ role: \"user\", content: \"Name: \" + $('Read leads').item.json.first_name + \"\\nTitle: \" + $('Read leads').item.json.title + \"\\nCompany: \" + $('Read leads').item.json.company + \"\\nWebsite: \" + $('Read leads').item.json.website }]\n}) }}",
        "options": {
          "timeout": 60000,
          "batching": {
            "batch": {
              "batchSize": 1,
              "batchInterval": 500
            }
          }
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "REPLACE_ME",
          "name": "Anthropic API key (x-api-key)"
        }
      }
    },
    {
      "id": "n2000001-0000-4000-8000-000000000006",
      "name": "Build Smartlead lead",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1340,
        200
      ],
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "a1",
              "name": "first_line",
              "value": "={{ $json.content.find(b => b.type === \"text\").text.trim() }}",
              "type": "string"
            },
            {
              "id": "a2",
              "name": "email",
              "value": "={{ $('Read leads').item.json.email }}",
              "type": "string"
            }
          ]
        },
        "includeOtherFields": false,
        "options": {}
      }
    },
    {
      "id": "n2000001-0000-4000-8000-000000000007",
      "name": "Add lead to Smartlead",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1560,
        200
      ],
      "parameters": {
        "method": "POST",
        "url": "https://server.smartlead.ai/api/v1/campaigns/YOUR_SMARTLEAD_CAMPAIGN_ID/leads",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpQueryAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({\n  lead_list: [{\n    email: $json.email,\n    first_name: $('Read leads').item.json.first_name,\n    last_name: $('Read leads').item.json.last_name,\n    company_name: $('Read leads').item.json.company,\n    custom_fields: { first_line: $json.first_line }\n  }],\n  settings: { ignore_global_block_list: false, ignore_unsubscribe_list: false, ignore_duplicate_leads_in_other_campaign: false }\n}) }}",
        "options": {
          "batching": {
            "batch": {
              "batchSize": 1,
              "batchInterval": 500
            }
          }
        }
      },
      "credentials": {
        "httpQueryAuth": {
          "id": "REPLACE_ME",
          "name": "Smartlead API key (api_key)"
        }
      }
    },
    {
      "id": "n2000001-0000-4000-8000-000000000008",
      "name": "Skip the rest",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        1120,
        440
      ],
      "parameters": {}
    },
    {
      "id": "n2000001-0000-4000-8000-000000000009",
      "name": "Read me",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        240,
        20
      ],
      "parameters": {
        "content": "## Apollo or Clay export, verified, with an AI first line\nSheet columns needed: email, first_name, last_name, title, company, website.\n1. Header Auth credentials: SimpleVerifier (Name Authorization, Value Bearer + your key) and Anthropic (Name x-api-key, Value your own Anthropic key).\n2. Query Auth credential for Smartlead: Name api_key, Value your Smartlead key.\n3. Replace claude-haiku-5-5 with another Anthropic model ID if you prefer. Set your campaign id.\n4. Read the first lines for 10 rows before you run the rest. The AI only sees the fields above and can still get a line wrong. If every row skips, open the verify node output: a 401 or 402 body says why.",
        "height": 240,
        "width": 360
      }
    }
  ],
  "connections": {
    "Run manually": {
      "main": [
        [
          {
            "node": "Read leads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read leads": {
      "main": [
        [
          {
            "node": "SimpleVerifier verify",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SimpleVerifier verify": {
      "main": [
        [
          {
            "node": "Keep action = send",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Keep action = send": {
      "main": [
        [
          {
            "node": "Write first line (Anthropic API)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Skip the rest",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Write first line (Anthropic API)": {
      "main": [
        [
          {
            "node": "Build Smartlead lead",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Smartlead lead": {
      "main": [
        [
          {
            "node": "Add lead to Smartlead",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": false
  }
}
