Finds people by job title at the companies you list, confirms a work address for each, records them, then sends a first email.
Uses
Claude
Apollo
Gmail
Google Sheets
Hunter
Find people at the companies you name and send a first email
Run it by hand whenever you want to reach new people and it does the whole first touch: finds people with the job titles you want at the companies you list, works out a work address for each, checks it is real, writes a short first email and sends it from your Gmail. Only people at companies you named yourself are contacted.
Everyone contacted is recorded on a tab in your Google Sheet, created on the first run and read before every run so nobody is emailed twice. No address is guessed: only one confirmed by a mailbox check, with a confident score and at the company's own domain, is written to. The AI writes each email from the person's name, job title and company alone, a draft that implies you have already spoken is discarded, and your sign-off and opt-out line are added to every message. Each send is recorded before it is made, so a failure leaves a recorded row rather than a stranger emailed twice. There is no schedule on purpose: cold outreach should not run unattended.
sheetUrl to blank.Set sheetUrl to blank.sentLogTabName to blank.Set sentLogTabName to blank.companyDomains to blank.Set companyDomains to blank.jobTitles to blank.Set jobTitles to blank.whatYouOffer to blank.Set whatYouOffer to blank.senderSignOff to blank.Set senderSignOff to blank.optOutLine to blank.Set optOutLine to blank.maxEmailsThisRun to 1.Set maxEmailsThisRun to 1.sendLimit to maxEmailsThisRun multiplied by 1.Set sendLimit to maxEmailsThisRun multiplied by 1.sendLimit is less than 1 or sendLimit is greater than 200If sendLimit is less than 1 or sendLimit is greater than 200domainList to an empty list.Set domainList to an empty list.rawDomain in companyDomains split by ,:For each rawDomain in companyDomains split by ,:rawDomain lowercase and save it as cleanedDomain.Make rawDomain lowercase and save it as cleanedDomain.cleanedDomain starts with https:// (ignoring case)If cleanedDomain starts with https:// (ignoring case)cleanedDomain split by https:// and save it as cleanedDomain.Get the last item of cleanedDomain split by https:// and save it as cleanedDomain.cleanedDomain starts with http:// (ignoring case)If cleanedDomain starts with http:// (ignoring case)cleanedDomain split by http:// and save it as cleanedDomain.Get the last item of cleanedDomain split by http:// and save it as cleanedDomain.cleanedDomain starts with www. (ignoring case)If cleanedDomain starts with www. (ignoring case)cleanedDomain split by www. and save it as cleanedDomain.Get the last item of cleanedDomain split by www. and save it as cleanedDomain.cleanedDomain split by / and save it as cleanedDomain.Get the first item of cleanedDomain split by / and save it as cleanedDomain.cleanedDomain contains . (ignoring case) and the length of cleanedDomain is…If cleanedDomain contains . (ignoring case) and the length of cleanedDomain is…cleanedDomain to the end of domainList and save it as domainList.Add cleanedDomain to the end of domainList and save it as domainList.domainList is emptyIf domainList is emptytitleList to an empty list.Set titleList to an empty list.rawTitle in jobTitles split by ,:For each rawTitle in jobTitles split by ,:rawTitle and save it as cleanedTitle.Trim rawTitle and save it as cleanedTitle.cleanedTitle isn't emptyIf cleanedTitle isn't emptycleanedTitle to the end of titleList and save it as titleList.Add cleanedTitle to the end of titleList and save it as titleList.titleList is emptyIf titleList is emptysentLogIsNew to true.Set sentLogIsNew to true.createLogTabErrorIf a step below fails, save the error as createLogTabErrorsentLogTabName in sheetUrl.Create the tab sentLogTabName in sheetUrl.sentLogIsNew to false.Change sentLogIsNew to false.sentLogIsNew is yesIf sentLogIsNew is yessentLogTabName in sheetUrl.Add a row to sentLogTabName in sheetUrl.sentLogTabName in sheetUrl. Save it as sentLog.Read column 'A' of sentLogTabName in sheetUrl. Save it as sentLog.alreadySent to an empty list.Set alreadySent to an empty list.loggedAddress in sentLog.values:For each loggedAddress in sentLog.values:loggedAddressErrorIf a step below fails, save the error as loggedAddressErrorloggedAddress in lowercase to the end of alreadySent and save it as alreadySent.Add loggedAddress in lowercase to the end of alreadySent and save it as alreadySent.titleList. Save it as searchResult.Search people for titleList. Save it as searchResult.sentCount to 0.Set sentCount to 0.skippedRows to 0.Set skippedRows to 0.sendFailures to 0.Set sendFailures to 0.person in searchResult.people:For each person in searchResult.people:sentCount is greater than or equal to sendLimitIf sentCount is greater than or equal to sendLimitfullName to blank.Set fullName to blank.nameReadErrorIf a step below fails, save the error as nameReadErrorperson.name and save it as fullName.Trim person.name and save it as fullName.fullName to blank.Change fullName to blank.fullName is empty or fullName is nullIf fullName is empty or fullName is nullSkipped a search result that had no name on it..Show in the output: Skipped a search result that had no name on it..skippedRows.Add 1 to skippedRows.jobTitle to blank.Set jobTitle to blank.titleReadErrorIf a step below fails, save the error as titleReadErrorperson.title and save it as jobTitle.Trim person.title and save it as jobTitle.jobTitle to blank.Change jobTitle to blank.employer to person.organization.Set employer to person.organization.companyName to blank.Set companyName to blank.companyReadErrorIf a step below fails, save the error as companyReadErroremployer.name and save it as companyName.Trim employer.name and save it as companyName.companyName to blank.Change companyName to blank.companyDomain to blank.Set companyDomain to blank.domainReadErrorIf a step below fails, save the error as domainReadErroremployer.primary_domain lowercase and save it as companyDomain.Make employer.primary_domain lowercase and save it as companyDomain.companyDomain to blank.Change companyDomain to blank.domainList doesn't contain companyDomainIf domainList doesn't contain companyDomainfullName: the search returned them at '@companyDomain', which is not one of the domains you listed.Show in the output: Skipped fullName: the search returned them at '@companyDomain', which is not one of the domains you listed.skippedRows.Add 1 to skippedRows.companyDomain fullNames email at. Save it as finderResult.Find companyDomain fullNames email at. Save it as finderResult.candidateAddress to blank.Set candidateAddress to blank.finderReadErrorIf a step below fails, save the error as finderReadErrorfinderResult.email lowercase and save it as candidateAddress.Make finderResult.email lowercase and save it as candidateAddress.candidateAddress to blank.Change candidateAddress to blank.candidateAddress is empty or candidateAddress is nullIf candidateAddress is empty or candidateAddress is nullfullName at companyDomain, so nothing was sent.Show in the output: No address was found for fullName at companyDomain, so nothing was sent.skippedRows.Add 1 to skippedRows.candidateAddress is a valid email addressIf not candidateAddress is a valid email addressfullName: the address that came back was not a valid email address.Show in the output: Skipped fullName: the address that came back was not a valid email address.skippedRows.Add 1 to skippedRows.candidateAddress doesn't end with @@companyDomain (ignoring case)If candidateAddress doesn't end with @@companyDomain (ignoring case)fullName: the address found (candidateAddress) is not at companyDomain.Show in the output: Skipped fullName: the address found (candidateAddress) is not at companyDomain.skippedRows.Add 1 to skippedRows.candidateAddress. Save it as verification.Verify the email candidateAddress. Save it as verification.verifyStatus to blank.Set verifyStatus to blank.verifyReadErrorIf a step below fails, save the error as verifyReadErrorverification.status lowercase and save it as verifyStatus.Make verification.status lowercase and save it as verifyStatus.verifyStatus to blank.Change verifyStatus to blank.verifyStatus is not validIf verifyStatus is not validcandidateAddress: the mailbox check came back '@verifyStatus' rather than 'valid', so the address is not confirmed.Show in the output: Not sending to candidateAddress: the mailbox check came back '@verifyStatus' rather than 'valid', so the address is not confirmed.skippedRows.Add 1 to skippedRows.verifyScore to verification.score multiplied by 1.Set verifyScore to verification.score multiplied by 1.verifyScore is less than 70 or verifyScore is greater than 100If verifyScore is less than 70 or verifyScore is greater than 100candidateAddress: the deliverability score was not a confident one.Show in the output: Not sending to candidateAddress: the deliverability score was not a confident one.skippedRows.Add 1 to skippedRows.alreadySent contains candidateAddressIf alreadySent contains candidateAddresscandidateAddress: already on your record, so they are not contacted twice.Show in the output: Skipped candidateAddress: already on your record, so they are not contacted twice.skippedRows.Add 1 to skippedRows.promptFacts to THIS PERSONSet promptFacts to THIS PERSON
Name: fullName
Job title: jobTitle
Company: companyName
Company website: companyDomain.promptOffer to WHY I AM WRITING TO THEM, in my own words:Set promptOffer to WHY I AM WRITING TO THEM, in my own words:
whatYouOffer.prompt to You are writing one short first-contact email to a person who has never heard from me before.Set prompt to You are writing one short first-contact email to a person who has never heard from me before.
Rules you must follow exactly:
- Use only the facts listed under THIS PERSON below. Everything there came from a contact database, and nothing else about them is known. Do not add their recent news, their funding, their headcount, their tools or their background. If a detail is not listed below, it does not go in the email.
- Never suggest we have met, spoken, emailed, been introduced, or that they asked to hear from me. There has been no contact of any kind.
- Never mention or imply anyone's age, gender, race, nationality, religion, health, disability, politics or family.
- Write the way one person writes to another: 110 words at most, plain sentences, one clear ask, no bullet points, no marketing language, no flattery you cannot support.
- Do not write a sign-off, a signature or an opt-out line. Those are added afterwards.
Reply in exactly this shape and nothing else:
Subject: <a specific subject line, under 70 characters>
<blank line>
<the body of the email>
promptFacts
promptOffer.prompt. Save it as drafted.Ask Claude: prompt. Save it as drafted.
Maximum response length: 700draftText to blank.Set draftText to blank.draftReadErrorIf a step below fails, save the error as draftReadErrordrafted.response_text and save it as draftText.Trim drafted.response_text and save it as draftText.draftText to blank.Change draftText to blank.draftText is empty or draftText is nullIf draftText is empty or draftText is nullcandidateAddress: the model returned no draft.Show in the output: Skipped candidateAddress: the model returned no draft.skippedRows.Add 1 to skippedRows.draftText by a new line and save it as draftLines.Split draftText by a new line and save it as draftLines.draftLines with Subject: replaced by (ignoring case) and save it as emailSubject.Trim the first item of draftLines with Subject: replaced by (ignoring case) and save it as emailSubject.draftLines joined by a new line and save it as emailBodyText.Trim the items from index 1 onward of draftLines joined by a new line and save it as emailBodyText.emailSubject is empty or the length of emailSubject is greater than 120 or the…If emailSubject is empty or the length of emailSubject is greater than 120 or the…candidateAddress: the draft did not come back as a subject line and a body.Show in the output: Skipped candidateAddress: the draft did not come back as a subject line and a body.skippedRows.Add 1 to skippedRows.wholeDraft to emailSubjectSet wholeDraft to emailSubject
emailBodyText.claimsGroup1 to wholeDraft contains as we discussed (ignoring case) or wholeDraft contains as discussed (ignoring case) or wholeDraft contains following up on our call (ignoring case) or wholeDraft contains as promised (ignoring case) or wholeDraft contains per our conversation (ignoring case).Set claimsGroup1 to wholeDraft contains as we discussed (ignoring case) or wholeDraft contains as discussed (ignoring case) or wholeDraft contains following up on our call (ignoring case) or wholeDraft contains as promised (ignoring case) or wholeDraft contains per our conversation (ignoring case).claimsGroup2 to wholeDraft contains great speaking (ignoring case) or wholeDraft contains we spoke (ignoring case) or wholeDraft contains our meeting (ignoring case) or wholeDraft contains thanks for your time (ignoring case) or wholeDraft contains since we last (ignoring case).Set claimsGroup2 to wholeDraft contains great speaking (ignoring case) or wholeDraft contains we spoke (ignoring case) or wholeDraft contains our meeting (ignoring case) or wholeDraft contains thanks for your time (ignoring case) or wholeDraft contains since we last (ignoring case).claimsGroup3 to wholeDraft contains you asked me to (ignoring case) or wholeDraft contains you requested (ignoring case) or wholeDraft contains circling back (ignoring case) or wholeDraft contains as agreed (ignoring case).Set claimsGroup3 to wholeDraft contains you asked me to (ignoring case) or wholeDraft contains you requested (ignoring case) or wholeDraft contains circling back (ignoring case) or wholeDraft contains as agreed (ignoring case).claimsGroup1 is yes or claimsGroup2 is yes or claimsGroup3 is yesIf claimsGroup1 is yes or claimsGroup2 is yes or claimsGroup3 is yescandidateAddress: the draft implied you had already been in touch, which is not true of a first email, so nothing was sent.Show in the output: Skipped candidateAddress: the draft implied you had already been in touch, which is not true of a first email, so nothing was sent.skippedRows.Add 1 to skippedRows.emailBody to emailBodyTextSet emailBody to emailBodyText
senderSignOff
optOutLine.sentLogTabName in sheetUrl.Add a row to sentLogTabName in sheetUrl.candidateAddress to the end of alreadySent and save it as alreadySent.Add candidateAddress to the end of alreadySent and save it as alreadySent.sendErrorIf a step below fails, save the error as sendErrorcandidateAddress.Send an email to candidateAddress.
Subject: emailSubjectemailBodysendFailures.Add 1 to sendFailures.candidateAddress. They are on the sent log already, so this run will not try them again: sendError as text.Show in the output: Could not send to candidateAddress. They are on the sent log already, so this run will not try them again: sendError as text.sentCount.Add 1 to sentCount.sentCount as text new people. Passed over skippedRows as text search results.Show in the output: Contacted sentCount as text new people. Passed over skippedRows as text search results.sendFailures is greater than 0If sendFailures is greater than 0sendFailures as text email(s) could not be sent. Every one of them is already on your sent log, so they will not be retried - check your Gmail connection and reach them by hand if you still want to.Stop and report a problem: sendFailures as text email(s) could not be sent. Every one of them is already on your sent log, so they will not be retried - check your Gmail connection and reach them by hand if you still want to.