This tool automates the creation of hyper-personalized cold emails by scraping LinkedIn profiles and using an LLM (via OpenAI) to generate tailored email content. Simply provide a LinkedIn URL, and the script will open Apple Mail with a pre-composed email (body, subject, and BCC field). All you have to do is hit send!
Note: This script is compatible only with Apple Mail.
- LinkedIn Scraping: Retrieves profile data and company details via the Scrapin API.
- Email Personalization: Uses LLM prompts to create personalized emails.
- Multiple Email Guessing: BCCs a list of possible email addresses based on the scraped profile.
- Customizable Prompts: Configure prompts in the
promptsfolder and select which one to use.
Ensure you have the following before starting:
- Apple Mail configured and open with your desired sending account.
- An OpenAI account and API key (set as the
OPENAIenvironment variable). - A Scrapin account and API key (set as the
SCRAPINenvironment variable).
Set these environment variables in a .env file (see instructions below).
git clone https://github.com/ninaboord/cold-email-automator.git
cd cold-emailerpython3 -m venv venv
source venv/bin/activatepython -m venv venv
venv\Scripts\activatepip install openai python-dotenv requestsPackages Overview:
openai: To interact with the OpenAI API.python-dotenv: To load environment variables from a .env file.requests: For making HTTP requests to the Scrapin API.
Create a .env file in the project root and add your API keys:
OPENAI=sk-your-openai-api-key
SCRAPIN=sk-your-scrapin-api-keyNote: Both services require paid accounts.
At the top of the script, you'll find key configuration variables:
MY_UNIVERSITY: Sets the target university (e.g.,Stanford) to determine alumni status.SUBJECT_LINE: Default subject line for emails (can be customized).MULTIPLE_PROMPTS: Boolean flag to select prompts dynamically or use a default prompt.PROMPT_FILE: Fallback prompt file ifMULTIPLE_PROMPTSis set toFalse.SIMPLE_MODELandLARGER_MODEL: Choose whichever openai models you would like to use.SMALLER_MODELwill handle simpler function tasks, whileLARGER_MODELwill handle the email writing. Up to you which model to use, but make sure you use valid aliases specified on openai's API website if you decide to change them.
prompts/prompt-selection.txt: Contains instructions for the LLM to analyze LinkedIn profiles and select a prompt file.- The response should be the filename of the selected prompt (e.g.,
email_prompt.txt).
- The response should be the filename of the selected prompt (e.g.,
prompts/folder: Contains example prompts used by the LLM to generate emails. You can modify or add new ones.
- Use clear and specific language.
- Include instructions on which LinkedIn details to reference.
- Test different prompts to optimize email output.
The script comes with examples in the prompts folder. You should modify them to suit your cold emailing needs. The reason why this tool uses templates is to ensure the email sounds like it was written like you -- not AI. You can use the following information in your prompt, as the AI is given the following information from the person's LinkedIn profile:
- First name
- Last name
- Headline
- Location
- About
- Education (school, degree, and field)
- Current company
- Current role/title
- Current company mission (note this is GPT generated based on the company, so it may be less accurate for startups)
- Current company description (from the company's page on LinkedIn)
- Past experience (companies and their roles)
- Gender (note that this is GPT generated based on their name, so if they have a nontraditional male/female name this could be incorrect)
- Whether or not they are an alumni (based off of the school you specifiy under
MY_UNIVERSITY:)
- User Input: Enter a LinkedIn URL in the terminal.
- Scraping: The Scrapin API retrieves profile data (personal info, work experience, education, etc.).
- Email Generation: The script summarizes the profile and sends it to OpenAI's API to generate a personalized email.
- Email Sending: The email (with subject and BCC field filled) is opened in Apple Mail, ready for review and sending.
Run the script directly from the terminal:
python entire/path/to/main.pyTo simplify execution, add an alias to your .bashrc or .zshrc:
alias email='/path/to/your/venv/bin/python -W "ignore:::urllib3" /path/to/your/project/main.py'Example for a project located at /Users/yourname/Code/ColdEmailer:
alias email='/Users/yourname/Code/ColdEmailer/venv/bin/python -W "ignore:::urllib3" /Users/yourname/Code/ColdEmailer/main.py'Reload your shell configuration:
source ~/.bashrc # for bash
source ~/.zshrc # for zshNow, simply type email in the terminal to run the tool.
- Email Sending: Ensure you are logged into Apple Mail with your sending account before running the script.
- No Code Changes Needed: Modify only the configuration and prompt files; the script runs as-is.
Note: There may be variability with email accuracy, especially if you are utilizing aspects like gender or company mission in your emails that are not explicit on LinkedIn. The quality of your prompts will greatly reduce errors (so pay attention to the prompt examples) but it is reccomended to always skim your email before hitting send.
Enjoy automating your cold emails!