Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Madisyn's Emma API Email Search

This Node.js script uses Axios to search for specific email addresses across all subaccounts in a MyEmma account. It checks each subaccount's Audience lists and reports any matches found.

Features

  • Read-only: No data is modified or deleted.
  • Fast: Results are displayed in a few minutes.
  • Summary: Shows which subaccounts contain the searched emails and provides a final summary.

Prerequisites

  1. Download and Install Node.js:

    • Visit Node.js Downloads
    • Download Windows 64-bit version
    • Install to C:\Users\<YOUR_USERNAME>\NodeJS\
    • Note: Do not add to PATH during installation
  2. Download and Install Git:

    • Visit Git Downloads
    • Download Windows version
    • Use default installation settings

Setup

  1. Open Command Prompt (CMD)

  2. Add Node.js to temporary PATH: Since Node.js is not added to PATH, you'll need to add it temporarily each time you want to run the script:

    set PATH=C:\Users\<YOUR_USERNAME>\NodeJS\node-v22.17.0-win-x64;%PATH%
  3. Clone the repository:

    git clone https://github.com/madberns/emmaSearch.git
    cd emmaSearch
  4. Install dependencies:

    npm install
  5. Configure environment variables:

    • Rename .env.example to .env
    • Add your Emma API credentials:
      PUBLIC_KEY=your_public_key
      PRIVATE_KEY=your_private_key
      

Running the Script

Since Node.js is not added to PATH, you'll need to add it temporarily each time you want to run the script:

  1. Open Command Prompt (CMD)

  2. Add Node.js to temporary PATH:

    set PATH=C:\Users\<YOUR_USERNAME>\NodeJS\node-v22.17.0-win-x64;%PATH%
  3. Navigate to project directory:

    cd path\to\emmaSearch
  4. Run the script:

    npm start

How It Works

  1. Loads a list of subaccounts from a local JSON file.
    • (Required) subaccounts.json holds a json list of subaccounts, pulled from Emma Admin Console (see below).
    • (Optional) Can fetch subaccounts via the /subaccounts API if authorized.
  2. For each subaccount, sends a GET request to /members/email to check for the specified email addresses.
  3. Displays results:
    • If found: [⚠️ EMAIL FOUND!] SubAccount: <name> | <ID>, <Email>
    • If not found: 404 status is shown.
  4. Prints a summary of subaccounts checked and email matches found.

Updating Subaccounts List

  1. Login to Emma
  2. Load Developer Console in Browser
  3. Look for subaccounts.json and copy to project root directory

Notes

  • This script is for read-only email searches.
  • API access to /subaccounts may require additional authorization.
  • For archiving or deleting emails, use the MyEmma web interface.

Troubleshooting

If you see "'node' is not recognized as an internal or external command":

  1. Verify Node.js installation path
  2. Re-run the PATH command with your correct username and Node.js version
  3. Try running node -v to verify Node.js is accessible

License

MIT


🖥️ Command Prompt Cheat Sheet

A quick reference guide for basic Command Prompt (CMD) commands on a Windows device. Useful for file navigation, file management, and Node.js project setup in a terminal environment.

📁 File & Directory Navigation

Command Description Result / Use Case
cd Show current directory Prints working directory
dir List contents Lists files/folders in current dir
cd foldername Change Directory Move into a subfolder
cd .. Go up one level Move to the parent folder
cd \path\to\folder Change to full path Jump to any folder
cls Clear screen Cleans up your terminal view

🗂️ File & Folder Management

Command Description Result / Use Case
mkdir foldername Make Directory Creates a new folder
type nul > filename.js Create Blank File Creates an empty file
del filename.js Remove File Deletes a file
rmdir /s foldername Remove Folder & Contents Deletes folder and all its contents
move oldname.js newname.js Rename or Move File Renames or moves file
copy file.js copy.js Copy File Duplicates a file

📦 Node.js & Project Setup

Command Description Result / Use Case
npm init -y Init Project Creates package.json with defaults
npm install axios Install Package Installs axios locally
npm install Install Dependencies Installs all listed in package.json
node filename.js Run Node Script Executes a Node.js file
npm uninstall packagename Uninstall Package Removes a dependency
type nul > filename Create an empty .js file Creates an empty .js file in folder

📑 Viewing & Opening Files

Command Description Result / Use Case
type filename.js View File Prints file contents to terminal
code . Open VS Code Opens current folder (requires VS Code in PATH)
start filename.js Open File Opens file in default app

🧠 Pro Tips

Command Description
command /? Show help for a command
mkdir test && cd test Chain commands together

About

A Node.js project for exploring API calls to myEmma’s email marketing platform from the command line. Built for hands-on learning of scripting, authentication, and working with JSON in a real-world API.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages