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.
- 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.
-
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
-
Download and Install Git:
- Visit Git Downloads
- Download Windows version
- Use default installation settings
-
Open Command Prompt (CMD)
-
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%
-
Clone the repository:
git clone https://github.com/madberns/emmaSearch.git cd emmaSearch -
Install dependencies:
npm install
-
Configure environment variables:
- Rename
.env.exampleto.env - Add your Emma API credentials:
PUBLIC_KEY=your_public_key PRIVATE_KEY=your_private_key
- Rename
Since Node.js is not added to PATH, you'll need to add it temporarily each time you want to run the script:
-
Open Command Prompt (CMD)
-
Add Node.js to temporary PATH:
set PATH=C:\Users\<YOUR_USERNAME>\NodeJS\node-v22.17.0-win-x64;%PATH%
-
Navigate to project directory:
cd path\to\emmaSearch
-
Run the script:
npm start
- Loads a list of subaccounts from a local JSON file.
- (Required)
subaccounts.jsonholds a json list of subaccounts, pulled from Emma Admin Console (see below). - (Optional) Can fetch subaccounts via the
/subaccountsAPI if authorized.
- (Required)
- For each subaccount, sends a GET request to
/members/emailto check for the specified email addresses. - Displays results:
- If found:
[⚠️ EMAIL FOUND!] SubAccount: <name> | <ID>, <Email> - If not found: 404 status is shown.
- If found:
- Prints a summary of subaccounts checked and email matches found.
- Login to Emma
- Load Developer Console in Browser
- Look for
subaccounts.jsonand copy to project root directory
- This script is for read-only email searches.
- API access to
/subaccountsmay require additional authorization. - For archiving or deleting emails, use the MyEmma web interface.
If you see "'node' is not recognized as an internal or external command":
- Verify Node.js installation path
- Re-run the PATH command with your correct username and Node.js version
- Try running
node -vto verify Node.js is accessible
MIT
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.
| 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 |
| 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 |
| 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 |
| 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 |
| Command | Description |
|---|---|
command /? |
Show help for a command |
mkdir test && cd test |
Chain commands together |