Integrations · Email platforms

Validate your AWeber subscribers

Check the addresses of an AWeber list and write each subscriber's result into four custom fields of that list, so your segments and broadcasts can leave out the addresses you should not mail. A sync script you run on your own computer checks the list as one bulk list and writes the results back. It never unsubscribes, moves or deletes anyone. Download it: email-validation-aweber.zip holds aweber.mjs (the sync script) and the MIT licence.

What you need

  • A computer with Node 22.18 or later. Nothing to install: the script has no dependencies.
  • 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).
  • An AWeber account, and an AWeber app of your own to connect it (AWeber has no API keys: every program connects through an app you allow). Make the app once.
  • Room for four custom fields on each list you check: AWeber lists hold up to 25 custom fields besides name and email. If a list has no room, the script stops before anything is uploaded or charged; delete custom fields the list no longer uses (List Options → Custom Fields) and run it again.

Make your AWeber app

  1. Create a free developer account at labs.aweber.com. It is separate from your AWeber account.
  2. Create an app there and set its redirect URL to urn:ietf:wg:oauth:2.0:oob. With that address AWeber shows you a code to paste into the script instead of sending your browser elsewhere. Make it a public app if AWeber offers the choice: a public app has no client secret to keep.
  3. Copy the app's client ID from AWeber's My Apps page. If your app has a client secret, keep it secret and set it as AWEBER_CLIENT_SECRET for every run of the script, scheduled runs included, not only --authorize: any run may renew the tokens, and that needs the secret.

Connect and run

cd email-validation-aweber                              # the unzipped folder
AWEBER_CLIENT_ID=… node aweber.mjs --authorize          # once: open the address it prints, allow, paste the code
node aweber.mjs --lists                                 # every list: id, subscribed count, name
export EV_API_KEY=…
node aweber.mjs --list <list id> --dry-run              # what it would check; spends nothing, writes nothing
node aweber.mjs --list <list id>                        # checks and writes the fields
node aweber.mjs --list <list id> --tag-remove           # also tags the remove ones ev:remove
node aweber.mjs --revoke                                # ends the access at AWeber, then deletes the token file

On AWeber's consent page, sign in with your AWeber account, not the developer account. The script asks for AWeber's permissions account.read, list.read, list.write (to create its four fields), subscriber.read and subscriber.write; nothing for broadcasts. It saves the tokens in .ev-aweber-token.json in the current folder, readable by you only on macOS and Linux (on Windows, keep the folder inside your own user folder), and renews them itself. Keep that file secret and never copy it: it opens your AWeber account. To end the access, run node aweber.mjs --revoke: it revokes the connection at AWeber, so its tokens can no longer be renewed (an access token already issued lasts at most two hours), then deletes the file. Deleting the file alone does not end it at AWeber.

Only subscribed subscribers are checked: AWeber mails no one else. Subscribers that already have a result (other than unknown) are skipped; --revalidate checks them again. --region eu checks and keeps the list in the EU, with the same key.

The sync does not ask before it spends: run it with --dry-run first to see how many subscribers it would check. Each distinct address uses one credit; unknown results, duplicates and malformed addresses are free.

What it writes

Custom fieldValue
ev_statusvalid, invalid, catch_all, unknown or disposable (statuses)
ev_reasonwhy, for example accepted, no_mailbox, spamtrap
ev_actionsend, send_with_caution, remove or retry_later
ev_checked_atwhen the check ran, in UTC

In AWeber a custom field belongs to one list, so the script creates the four fields on each list it checks, the first time (node aweber.mjs --setup --list <list id> creates only the fields). Subscribers never see them unless a message uses them. Trust ev_action, not ev_status: spam traps and complainers are valid with the action remove.

--tag-remove also adds the tag ev:remove to the subscribers whose action is remove. They stay subscribed: you decide what to do. To leave them out, open the list's Subscribers page, pick Tag in the filter menu, then Is not any of these, enter ev:remove, select Save and name the segment; then pick that segment in a broadcast's Send to Segment box. Saving and sending to segments is not on AWeber's Free plan. The script only adds the tag: a subscriber checked again later with another result keeps it, so ev_action is the field to trust. Before a --revalidate --tag-remove run, filter on Tag, Is any of these, ev:remove, choose Tag All from the arrow next to the Tag button and remove ev:remove: the run tags again only the subscribers whose action is still remove. An AWeber campaign that starts when a tag is applied would start for these subscribers: look at your campaigns before each --tag-remove run that adds the tag.

AWeber empties every custom field a write leaves out, so each write sends the subscriber's other fields exactly as they were read a moment before, and checks AWeber's answer. If the answer to the first write shows that any other field changed, the run stops before a second subscriber is written; such an answer to a later write stops it at once. A subscriber whose address changed since the check is not written (the next run checks the new address).

How long it takes

AWeber allows 120 requests a minute per AWeber account, so your other connected apps count toward it too: run one list at a time. Each written subscriber takes two, and the script sends 90 a minute by default (--rate N, at most 120), so it writes back about 45 subscribers a minute: a list of 10,000 takes about 3 hours 45 minutes. The check itself runs on our side and is not slowed by AWeber. When AWeber answers its rate limit, the script waits the 60 seconds AWeber asks for and goes on.

Try it free first

Make a test list in AWeber. Turn off its confirmation message (List Options → List Settings → Confirmation Message: the toggle for AWeber sign up forms, which also covers subscribers you add by hand), and add one custom field of your own to it (List Options → Custom Fields, for example Company), as your real lists have. Then add one subscriber by hand (Subscribers → Add Subscribers → Add one at a time) with the address no_mailbox@sandbox.email-validation.org and leave its Company empty. Test addresses cost nothing, and that domain receives no mail, so send it nothing. Run node aweber.mjs --list <the test list's id>: it should exit 0, the subscriber gets ev_status invalid and ev_action remove, and its Company stays empty. That shows your own fields come back as they were, empty ones included, before you run it on a real list. A subscriber AWeber holds as unconfirmed is not checked (the run counts 0 to check). Then delete the test list.

Run it again

Run the same command again after any stop (no credits, a closed laptop, AWeber's rate limit, 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 token. When every subscriber is written, the file is removed and the next run checks only subscribers without a result (or with unknown), such as new ones, so you can run it on a schedule, for example daily with cron (with EV_API_KEY, and AWEBER_CLIENT_SECRET if your app has one, set for that job). There is no instant check of each new subscriber: a daily run gives every new subscriber a result within a day.

Exit codes: 0 done, 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 subscriber ids, job ids and counts, never an address or a token.

More on AWeber

Updated · Maintained by: Email Validation LLC

Need help? Contact support, or ask the help chat. Something wrong or missing on this page? Tell us