Integrations · Sales outreach
Clean Saleshandy prospects before you send
Check your Saleshandy prospects (all of them, or those with one prospect tag) before you send, and write each prospect's status into four custom fields, so your sequences can leave out the prospects you should not mail. The script reads the prospects, checks them as one bulk list, tells you what it will cost and asks before it spends anything. It never deletes a prospect, never removes one from a sequence, never unsubscribes, blocks or untags one, and never changes any other field. Download it: email-validation-saleshandy.zip holds saleshandy.mjs, one file, and the MIT licence.
What you need
- A computer with Node 22.18 or later. The script has no browser-only option. Nothing to install: it has no dependencies. With only a browser, export the prospects from Saleshandy as a CSV file and upload it as a bulk list on our site instead; you then act on the results file yourself.
- An API key of ours from the API keys page with the permission Bulk lists (off by default: turn it on when you create the key). With Read balance and usage too, the script shows your balance before it asks.
- A Saleshandy API key: in Saleshandy, Settings → API Key → Create API Key, then copy the key (Saleshandy shows it only once). It acts as your Saleshandy user, so keep it like a password. Saleshandy's pricing page lists API limits on its Starter, Pro and Scale plans; if Saleshandy refuses the key's calls (the script says so), check your plan with Saleshandy.
Run it
cd email-validation-saleshandy # the unzipped folder
export EV_API_KEY=… SALESHANDY_API_KEY=…
node saleshandy.mjs --lists # all prospects and your prospect tags with counts, and your sequences
node saleshandy.mjs --all --dry-run # what it would check and the most it would cost; spends nothing
node saleshandy.mjs --all # asks, then checks and writes the statuses back
node saleshandy.mjs --tag <id> --yes # one tag's prospects, without asking (for a scheduled run)Saleshandy's API lists the prospects of the whole account, with their tags; it cannot list the prospects of one sequence. So you pick all prospects or one tag. Before it spends, the script shows the prospects it will check, the distinct addresses, the most credits it will use (one per distinct address; unknown results, duplicates and malformed addresses are free) and your balance, and asks you to confirm. With --yes it goes on without asking; without a terminal and without --yes it stops before spending.
It checks the prospects that have an address and no status for that address yet (or unknown), such as new ones and prospects whose address changed. --revalidate also checks prospects that already have a status for their address. --region eu checks and keeps the list in the EU, with the same key. --rate N sets how many Saleshandy requests it sends a minute (60 by default, at most 600): Saleshandy publishes no number for its limit, and the script waits whenever Saleshandy asks it to slow down. Writing takes one request per prospect, so a large account takes hours; the check itself is not slowed by this.
What it writes
| Prospect field | Value |
|---|---|
email_validation_status | valid, invalid, catch_all, unknown or disposable (statuses) |
email_validation_action | send, send_with_caution, remove or retry_later |
email_validation_checked_at | when the results were written, in UTC |
email_validation_address_hash | a hash of the checked address (the first 32 hex digits of its SHA-256, trimmed and lower-cased), never the address: when it no longer matches the prospect's address, the values are for an older address and the next run checks the new one |
The script makes these four text fields in your account the first time (a dry run makes none). Leave out the prospects whose email_validation_action is remove: that includes spam traps and complainers, which are valid with the action remove. A new check replaces the old values. Every other field of the prospect keeps its value: the script names only these four.
Saleshandy's API has no call that reads one prospect, so the script cannot read a prospect again right before it writes, and while its address stays the same, a prospect with a status other than unknown is not checked again. If you change a prospect's address after it was checked, just run the script again as usual: the address hash no longer matches, so the next run checks the new address (one credit), and the optional pause never acts on the old address's status. You do not need --revalidate for that: it checks, and charges for, every prospect of the source again, so with --all that is the whole account.
Pause the prospects to remove (optional)
node saleshandy.mjs --all --pause-remove-in <sequence id> # after writing, pause the remove prospects there
node saleshandy.mjs --resume-paused <sequence id> # undo: mark exactly those prospects active againOff unless you ask for it. Once every status is written, it pauses, in the one sequence you name, the prospects whose action is remove, one at a time; nothing is unsubscribed, finished or deleted. The script keeps the ids of the prospects Saleshandy says it paused in a file in the folder you run it from, so --resume-paused can undo exactly that (no credits). The undo marks them active whatever their status in the sequence was before: a prospect you had paused yourself is resumed too.
Run it again
Run the same command again after any stop (no credits, a closed laptop, the bulk list still running): it resumes the same bulk list and never pays twice (within the 30 days a list is kept). Run it from the same folder each time (or pass the same --state FILE): the file it keeps there holds the bulk list it is working on, never an address or a key. Prospects already written are skipped. When every prospect is written, that file is removed and the next run checks only prospects without a status (or with unknown), such as new ones, so you can run it on a schedule with --yes.
If Saleshandy keeps refusing one prospect's write, each run resumes the same bulk list and exits 1, and prospects added since wait. Once you have looked at that prospect in Saleshandy, --new-job starts a new bulk list: it checks, and charges, only the prospects that still have no status.
Exit codes: 0 done (or you answered no), 1 a write failed or the run stopped (run it again), 2 wrong arguments, 75 the bulk list was still running when the script stopped waiting (run it again later).
The script prints counts, prospect ids, job ids and the tag's name, never an address or a key.