Integrations · CRM
Check customer emails on new LiveChat chats
Check the customer's email address on each new LiveChat chat, and tag the chat when the address cannot receive mail, so agents see it and your reports and archives can filter on it. A small receiver you host answers a LiveChat webhook on incoming_chat: it reads the chat's customer through LiveChat's Agent Chat API, checks the customer's address with our API and adds the tag invalid email to the chat's thread when the answer is a status you flag (by default only invalid).
It is TypeScript with no dependencies, under the MIT licence. Download email-validation-livechat.zip: it holds email-validation-livechat.ts (the receiver), worker.ts (the same receiver as a Cloudflare Worker) and LICENSE. It is not in the LiveChat Marketplace.
What you need
- A LiveChat account (the API comes with every plan, and LiveChat's free trial is the full Growth plan), and its owner or an admin: only they can create tags. You build the webhook in LiveChat's Developer Console, with the same login.
- 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 LiveChat Personal Access Token. In the Developer Console, open Settings → Authorization → Personal Access Tokens, choose the scopes
customers:roandchats--all:rw, and click Create token. Copy the token and your Account ID. The scopes cannot be changed later. The token acts as you on your LiveChat account: keep it only in the receiver's secrets.A secret key. LiveChat puts the webhook's secret key in each delivery, and the receiver refuses every delivery without it. Make one of at least 24 characters, for example with
openssl rand -hex 24(on Windows, your password manager's generator).The tag. In LiveChat, open Settings → Tags and add the tag
invalid email. LiveChat tags a chat only with a tag that exists.Deploy the receiver from the unzipped folder:
cd email-validation-livechat npx wrangler deploy worker.ts --name ev-livechat --compatibility-date 2026-10-01 npx wrangler secret put EV_API_KEY --name ev-livechat # our API key npx wrangler secret put LIVECHAT_ACCOUNT_ID --name ev-livechat # the Account ID npx wrangler secret put LIVECHAT_TOKEN --name ev-livechat # the Personal Access Token npx wrangler secret put LIVECHAT_SECRET_KEY --name ev-livechat # the secret keywrangler deployprints the Worker's address, such ashttps://ev-livechat.<your subdomain>.workers.dev. On your own server, putemail-validation-livechat.tsnext to your code and create the receiver once, at module level, with our key and the LiveChat token as two separate settings:export const POST = createLiveChatHook({ apiKey: process.env.EV_API_KEY, // our API key livechat: { accountId: process.env.LIVECHAT_ACCOUNT_ID, token: process.env.LIVECHAT_TOKEN, // the LiveChat Personal Access Token, never ours }, secretKey: process.env.LIVECHAT_SECRET_KEY, });That is a Next.js route handler: add
waitUntil: after(afterfromnext/server), so a check still running at the answer finishes. In Express, createcreateLiveChatWebhookHandler(options)with the same options and call it with the raw body. 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 webhook. In the Developer Console, open Apps, click Create new app, name it (for example
email-validation.org) and choose LiveChat. Then, under Building blocks:- App Authorization: choose Server-side app.
- Chat webhooks: add a webhook with the receiver's address as Webhook URL, your secret key as Secret key, the type
licenseand the triggerincoming_chat. A webhook cannot be edited once added: to change it, add a new one.
Then open the Private installation tab and click Install app. It installs only on your own LiveChat account, and each new chat now sends one delivery.
Settings
| Variable | Value |
|---|---|
EV_API_KEY | Required. Our API key with Validate addresses. |
LIVECHAT_ACCOUNT_ID | Required. Your Account ID, shown with the Personal Access Token. |
LIVECHAT_TOKEN | Required. The Personal Access Token, with customers:ro and chats--all:rw. |
LIVECHAT_SECRET_KEY | Required. The webhook's secret key, at least 24 characters. |
EV_REGION | eu to check addresses in the EU (EU data residency), with the same key. |
EV_FLAG | The statuses that tag a chat, separated by commas: invalid, disposable, catch_all, unknown. Default invalid. |
LIVECHAT_TAG | The tag added to a flagged chat, instead of invalid email. It must exist in LiveChat. |
A missing LiveChat setting or secret key, or a wrong secret key, EV_REGION, EV_FLAG or LIVECHAT_TAG, fails every delivery (HTTP 500; the Worker's logs name the setting, never a key or a token), so set the secrets before you install the app. A token that is set but wrong, lacks a scope, or a tag that does not exist in LiveChat leaves every chat untagged. A missing or wrong EV_API_KEY leaves every chat unchecked.
What it does on a chat
- A flagged status adds the tag
invalid email(or yourLIVECHAT_TAG) to the chat's thread. Agents see it on the chat, and Archives can filter on it. Avalidanswer marked disposable counts asdisposable. - The address checked is the one saved on the customer, such as the email of your pre-chat form. A customer with no saved address is not checked.
- A tag is only ever added, never taken away: a later answer, an
unknownor a timeout never clears it. - No other tag, field or message of the chat is touched, and nothing is ever sent to the customer.
- The same customer on a new chat, or coming back to one, is not checked again while the receiver remembers the address (up to 1,000 addresses, kept in memory as a fingerprint, never the address): the tag is still written on each new thread. 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 tag a chat, 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 chat is left as it is. Every failure fails open.
- LiveChat waits about 10 seconds for each delivery, so the receiver answers within 3 seconds. A check still running then finishes after the answer: the tag still lands.
- LiveChat sends a delivery again (up to 3 times within about a minute) when it gets no
200answer. A delivery without the right secret key is answered 401 and nothing is read or checked; the same delivery again is not checked twice.
Try it free
Use a test address: it costs nothing and returns a fixed result. A test address receives no mail, so never send the chat's transcript or a ticket to it.
- In a private window, open a page of your site with the LiveChat chat widget, enter
no_mailbox@sandbox.email-validation.orgas the email in the pre-chat form and start a chat. If your widget asks for no email, turn on an email field in LiveChat's pre-chat form settings for the test. - Within a few seconds the chat should have the tag
invalid email. We have not yet tried this on a real LiveChat account. - If no tag comes, run
npx wrangler tail ev-livechatand start another chat. No request means the webhook is not installed (check step 5); an answer of 500 means a setting is missing or wrong (the log names it); a 200 with no tag means the token, its scopes or the tag (see Settings), or a customer with no saved address. - End the test chat without replying to the test address.
What it costs
Each check costs at most 1 credit, like any validation request. 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 receiver takes only the chat, thread and customer ids from LiveChat's delivery, never an address, and reads the customer from https://api.livechatinc.com. It sends only the customer's address, 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 chat. Its answer to LiveChat holds the outcome, never the address. Our key goes only to our API and the LiveChat token only to LiveChat's API; redirects are never followed, and nothing is logged with an address, a key or a token.
End access
The receiver holds your Personal Access Token, which acts as you on your LiveChat account. To end its access:
Uninstall the app from your LiveChat account, or delete it in the Developer Console under Apps. No more chats are sent.
Delete the Worker and its secrets. On the computer you deployed from, run:
npx wrangler delete --name ev-livechatOn your own server, remove the receiver and its settings.
Delete the Personal Access Token in the Developer Console: Settings → Authorization → Personal Access Tokens.
Revoke our key on the API keys page.