Integrations · CRM
Validate your Freshdesk contacts
Check the addresses of your Freshdesk contacts and write each contact's result into four contact fields, so your agents and your filters can see which addresses cannot receive mail. A bulk script you run on your own computer reads every contact, checks the addresses that have no result yet and writes the results back. It never deletes, blocks, merges or mails anyone, and it touches no ticket. Download it: email-validation-freshdesk.zip holds freshdesk.mjs (the bulk script) and the MIT licence. Nothing is installed in Freshdesk, and no Freshdesk Marketplace app is needed.
This guide is for Freshdesk, the help desk. Freshsales (Freshworks CRM) is a different product with its own API.
What you need
- A computer with Node 22.18 or later. Nothing to install: the script has no dependencies.
- Freshdesk Growth or above. Freshdesk has custom contact fields from the Growth plan on, and the script writes its results into them.
- A Freshdesk admin's API key. In Freshdesk, click your profile picture (top right), choose Profile settings, then View API key in the right pane. The script acts with that agent's rights: the agent views and edits contacts and, for the first run, is an admin, because that run creates the four contact fields. Keep the key secret: it opens your help desk.
- Your Freshdesk domain:
acmeforhttps://acme.freshdesk.com. Freshdesk's API works only on that address, never on a custom domain of your own. - An API key of ours from the API keys page with Validate addresses, and also Bulk lists (off by default: turn it on when you create the key) to check more than 50 contacts in one run.
Run it
cd email-validation-freshdesk # the unzipped folder
export FRESHDESK_DOMAIN=acme FRESHDESK_API_KEY=… EV_API_KEY=…
node freshdesk.mjs --dry-run # what it would check; creates, spends and writes nothing
node freshdesk.mjs # creates the fields if needed, checks and writes the resultsDo the free try on one test contact before the first full run. The script does not ask before it spends: run it with --dry-run first to see how many contacts it would check. Up to 50 addresses are checked one by one; more go to one bulk list. Each check uses one credit; unknown results are free, and in a bulk list duplicates and malformed addresses are free too.
Freshdesk lists the contacts that are neither blocked nor deleted, and only those are checked. Each contact is checked by its primary address; its other addresses are not. A contact whose address already has a result (other than unknown) is skipped; --revalidate checks it again. --region eu checks the addresses in the EU (EU data residency), with the same key. --contact ID checks one contact only (see the free try below).
What it writes
| Contact field | Value |
|---|---|
ev_status | valid, invalid, catch_all, unknown or disposable (statuses) |
ev_reason | why, for example accepted, no_mailbox, spamtrap |
ev_checked_at | when the check ran, in UTC |
ev_address_hash | a fingerprint of the address that was checked, so a contact whose address changes is checked again |
The first run creates the four fields as Single-line Text contact fields, named as above, when they are missing. You find them in Admin → Support Operations → Contact Fields; Freshdesk does not show a new field in the customer portal unless you choose to. If a field with one of these labels exists but is not single-line text, or two fields have the same label, the run stops before anything is created or paid for.
Read ev_reason too, not only ev_status: spam traps and frequent complainers are valid with the reason spamtrap or complainer, and you should not mail them either.
Each result is written by contact id, only while the contact still holds the address that was checked: a contact whose address changed since the check is not written (the next run checks the new address), and a contact deleted or blocked since then is left alone. The write sends only the contact's custom fields: our four, and every other custom field the contact has, sent back exactly as Freshdesk gave them a moment before. No other part of the contact is changed.
How long it takes
Freshdesk limits API calls per minute for each account, shared with your other apps and agents: Growth 100, Pro 400 and Enterprise 700 (a trial 50). The script sends one call a second by default, and each written contact takes two (a read right before the write, and the write), so it writes back about 30 contacts a minute: 10,000 contacts take about 5 hours 30 minutes. On a larger plan, --rate N sends up to N calls a second (at most 10); keep N × 60 well under your plan's limit to leave room for your other apps. When Freshdesk answers its rate limit, the script waits as long as Freshdesk asks and goes on. The check itself runs on our side and is not slowed by Freshdesk.
Try it free first
The script has not yet run against a real Freshdesk account: this try, and its stop rules, show that it works on yours before it touches your other contacts.
- In Freshdesk, open Admin → Workflows → Email Notifications, tab Requester Notifications, and make sure User activation email is off (Freshdesk's default). If it is on, turn it off for the test and back on afterwards, so Freshdesk mails no one.
- Add one contact by hand with the address
no_mailbox@sandbox.email-validation.org, and fill in one of your own custom contact fields on it. Test addresses cost nothing, and that domain receives no mail, so open no ticket for it. Its id is the number at the end of the contact page's address in your browser. - Run
node freshdesk.mjs --contact ID --dry-run, with that id forID:--contactreads, checks and writes that one contact only, never your other contacts, and keeps its own file,.ev-freshdesk-contact-ID.json, apart from a full run's. It must reportwould check: 1. Then runnode freshdesk.mjs --contact ID. It should exit0, and the contact getsev_statusinvalidandev_reasonno_mailbox, while your own field keeps its value. That shows your own fields come back as they were before you run it on all your contacts. - Run
node freshdesk.mjs --contact IDagain: it must reportto check: 0. If it reports anything butto check: 0, stop and do not run it on all your contacts: the result was not read back, so every run would pay again. Contact us. Then delete the test contact.
If your account has a custom contact field that is required for agents, a date field, or a dropdown whose value was since removed from its choices, add one such value to the test contact too: if Freshdesk refuses the write, the script reports the contact as failed and keeps its result, and after 10 failed writes in a row it stops.
Run it again
Run the same command again after any stop (no credits, a closed laptop, Freshdesk'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, .ev-freshdesk-<domain>.json, holds the bulk list it is working on, never an address or a key. A result that was paid for but could not be written is kept in a second file there (ids, statuses and fingerprints only) and written by the next run without a new check. When every contact is written, the next run checks only contacts without a result (or with unknown), such as new ones, so you can run it on a schedule, for example daily with cron. There is no instant check of each new contact: a daily run gives every new contact 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; --wait-minutes N waits longer).
The script prints contact ids, job ids and counts, never an address or a key. It sends the Freshdesk key only to https://<your domain>.freshdesk.com and our key only to https://api.email-validation.org (or https://api-eu.email-validation.org).
End access
The script runs only when you start it and keeps nothing in Freshdesk but the four contact fields. To end its access:
- Stop any scheduled run (for example remove its cron line), and delete the unzipped folder with its
.ev-freshdesk-<domain>.jsonfiles and the free try's.ev-freshdesk-contact-IDfiles. - If the Freshdesk key may have leaked, reset it in Freshdesk where you viewed it (Profile settings). Freshdesk disconnects every other app that uses that key until you give it the new one.
- Revoke our key on the API keys page.
The four contact fields and their values stay. To remove them, delete them in Admin → Support Operations → Contact Fields.