Integrations · CRM
Check contact emails on new LiveAgent tickets
Check the contact's email address on each new LiveAgent ticket, and add an internal note to the ticket when the address cannot receive mail, so agents see it before they reply. A small receiver you host answers a LiveAgent rule on Ticket created (tickets from mail, chat, contact forms and more): the rule's HTTP request action sends it the contact's addresses and the ticket's id, the receiver checks each address with our API and, when the answer is a status you flag (by default only invalid), writes a note through LiveAgent's API. The note names the status and the address's domain, never the address.
It is TypeScript with no dependencies, under the MIT licence. Download email-validation-liveagent.zip: it holds email-validation-liveagent.ts (the receiver), worker.ts (the same receiver as a Cloudflare Worker) and LICENSE. It is not in LiveAgent's marketplace.
What you need
- A LiveAgent account with access to Configuration: rules and API keys are on every plan, and on LiveAgent's free trial.
- A place to run the receiver on a public HTTPS address: a Cloudflare account and Cloudflare's
wranglercommand (npx wrangler, on a computer with Node), or your own server with Node 22 or later, Bun or Deno. - An API key of ours from the API keys page with the permission Validate addresses, and a daily credit cap that limits what a busy day can spend.
Set it up
A LiveAgent API v1 key. In LiveAgent, open Configuration → System → API and switch to Settings for API v1 (top right). Copy its API key: the note is written through API v1, and an API v3 key does not work there. The key opens your account's data: keep it only in the receiver's secrets. Note your LiveAgent address too, such as
https://acme.ladesk.com.A rule token. LiveAgent does not sign its requests, so the rule sends a token you make up, and the receiver refuses every request without it. Make one of at least 32 characters, for example with
openssl rand -hex 32(on Windows, your password manager's generator).Deploy the receiver from the unzipped folder:
cd email-validation-liveagent npx wrangler deploy worker.ts --name ev-liveagent --compatibility-date 2026-10-01 npx wrangler secret put EV_API_KEY --name ev-liveagent # our API key npx wrangler secret put LIVEAGENT_RULE_TOKEN --name ev-liveagent # the rule token npx wrangler secret put LIVEAGENT_URL --name ev-liveagent # https://acme.ladesk.com npx wrangler secret put LIVEAGENT_API_KEY --name ev-liveagent # the API v1 keywrangler deployprints the Worker's address, such ashttps://ev-liveagent.<your subdomain>.workers.dev. On your own server, putemail-validation-liveagent.tsnext to your code and create the receiver once, at module level, with our key and the LiveAgent key as two separate settings:export const POST = createLiveAgentWebhook({ apiKey: process.env.EV_API_KEY, // our API key token: process.env.LIVEAGENT_RULE_TOKEN, note: { url: process.env.LIVEAGENT_URL, // https://acme.ladesk.com apiKey: process.env.LIVEAGENT_API_KEY, // the LiveAgent API v1 key, never ours }, });That is a Next.js route handler: add
waitUntil: after(afterfromnext/server), so the checks still running at the answer finish. In Express, createcreateLiveAgentWebhookHandler(options)with the same options and call it with the raw body and the headers. Node 22.18 or later imports the.tsfile as it is; with an older Node or a build step, compile it with your app.The rule. In LiveAgent, open Configuration → Automation → Rules and click Create:
Trigger: Ticket created
Action: HTTP request
URL: the receiver's address, with SSL check on
HTTP Method:
POSTHTTP Headers:
content-type: application/jsonandX-Webhook-Token: <your rule token>HTTP Body, with the variables written without quotes around them:
{"emails":{$contact_emails},"conversation":{$conv_conversationid},"ticket":{$conv_code},"contact":{$contact_contactid},"event":"ticket_created"}Encoding: JSON Encoded (LiveAgent then writes each variable as a JSON string)
Save it. Each new ticket now sends one request.
Settings
| Variable | Value |
|---|---|
EV_API_KEY | Required. Our API key with Validate addresses. |
LIVEAGENT_RULE_TOKEN | Required. The rule token, at least 32 characters, sent by the rule as X-Webhook-Token. |
LIVEAGENT_URL | Required. Your LiveAgent address, such as https://acme.ladesk.com (https only). |
LIVEAGENT_API_KEY | Required. Your LiveAgent API v1 key, for the notes. |
EV_REGION | eu to check addresses in the EU (EU data residency), with the same key. |
EV_FLAG | The statuses that get a note, separated by commas: invalid, disposable, catch_all, unknown. Default invalid. |
LIVEAGENT_NOTE_ON | flagged,clean to write a note for every definite answer, not only flagged ones. Default flagged. |
A missing LiveAgent setting or rule token, or a wrong LIVEAGENT_URL, rule token, EV_REGION, EV_FLAG or LIVEAGENT_NOTE_ON, fails every request (HTTP 500; the Worker's logs name the setting, never a key or a token), so set the secrets before you save the rule. A LiveAgent key that is set but wrong writes no note, and a missing or wrong EV_API_KEY leaves every address unchecked: nothing shows on the ticket either way, so try it as below.
What it does on a ticket
- The rule sends every address of the contact. The receiver checks up to five of them, each once, and a flagged status adds one internal note, for example: "email-validation.org: the contact's address at example.com is invalid (no_mailbox). Request req_…." A
validanswer marked disposable counts asdisposable. - A note is never mailed to the contact, and no other field, tag or message of the ticket is touched.
- A contact with no address yet (a chat without one, for example) is not checked.
- The same address on a new ticket is not checked again while the receiver remembers it (a day, up to 1,000 addresses, kept in memory as a fingerprint, never the address): the note is still written on each ticket. Cloudflare runs and restarts Workers on its own, so an address can now and then be checked again.
unknown answers that mean our check ran out of time or failed (timeout, internal_error) never get a note, even with unknown in EV_FLAG. What each status means.
When something fails
- Our API is slow, down, rate limited or out of credits, or our key is missing or wrong: the ticket gets no note. Every failure fails open. Our key refused, no credits or the key's daily cap pause the checks for five minutes.
- The receiver answers LiveAgent at once and checks after the answer, so the rule never waits for our API.
- LiveAgent refusing the API v1 key pauses the notes for five minutes; a note that fails is not written later.
- The token is the only guard. LiveAgent signs nothing, so anyone who has the token can send the receiver any body: up to five checks per request, and a note on any ticket. Keep the token secret and make a new one if it may have leaked. The same body twice within a day starts nothing, and a request without the right token is answered 401 with nothing checked.
Try it free
Use a test address: it costs nothing and returns a fixed result. A test address receives no mail, so never send mail to it from LiveAgent. For the test, have the receiver note clean answers too:
Run
npx wrangler secret put LIVEAGENT_NOTE_ON --name ev-liveagentand enterflagged,clean.Send a mail from your own mailbox to your LiveAgent support address. Within a few seconds its new ticket should get a note saying your address's domain is
valid. That check costs 1 credit. We have not yet tried this on a real LiveAgent account. If no note comes, check the rule's header and body against step 4.Send the receiver the test address, with that ticket's ID (shown on the ticket) as the conversation. It is free:
curl https://ev-liveagent.<your subdomain>.workers.dev \ -H 'content-type: application/json' -H "X-Webhook-Token: $LIVEAGENT_RULE_TOKEN" \ -d '{"emails":"no_mailbox@sandbox.email-validation.org","conversation":"<ticket ID>","event":"test"}'The ticket should get a second note: the address at
sandbox.email-validation.orgisinvalid(no_mailbox).Run
npx wrangler secret delete LIVEAGENT_NOTE_ON --name ev-liveagent, and resolve the test ticket.
What it costs
Each check costs at most 1 credit, like any validation request, and a ticket's contact can have up to five addresses checked. unknown results, errors, malformed addresses and test addresses are free, and an address the receiver remembers is not checked again. Credits come in one-time packs, from $0.15 per 1,000 with the 50,000,000-credit pack (smaller packs cost more per credit), and new accounts get 500 free credits (100 when you sign up with a free email provider such as Gmail, Outlook or Yahoo, another personal mailbox such as a paid one like Fastmail or one from your internet provider, or an address from a relay or alias service).
Privacy
The rule sends the receiver the contact's addresses and the ticket's ids. The receiver sends each address only in the body of a POST to https://api.email-validation.org (or https://api-eu.email-validation.org), never in a URL, and nothing else from the ticket. The note it writes to your LiveAgent names the status, the reason, the request id and the address's domain, never the address. Our key goes only to our API and the LiveAgent key only to your LiveAgent address; redirects are never followed, and nothing is logged with an address, a key or a token.
End access
The receiver holds your LiveAgent API v1 key, which opens your account's data. To end its access:
Delete the rule in LiveAgent: Configuration → Automation → Rules. No more tickets are sent.
Delete the Worker and its secrets. On the computer you deployed from, run:
npx wrangler delete --name ev-liveagentOn your own server, remove the receiver and its settings.
If the LiveAgent key may have leaked, replace it under Configuration → System → API, Settings for API v1. Every other script that uses that key stops until it gets the new one.
Revoke our key on the API keys page.