Integrations · CRM
Check customer emails on new Gorgias tickets
Check the customer's email address on each new Gorgias ticket, and tag the ticket when the address cannot receive mail, so your rules and views can route it before an agent replies. A small receiver you host answers a Gorgias HTTP integration on Ticket created: it reads the ticket through Gorgias's REST API, checks its customer's address with our API and adds the tag invalid email when the answer is a status you flag (by default only invalid). It answers Gorgias with the result, which a sidebar widget can show to agents.
It is TypeScript with no dependencies, under the MIT licence. Download email-validation-gorgias.zip: it holds email-validation-gorgias.ts (the receiver), worker.ts (the same receiver as a Cloudflare Worker) and LICENSE. It is not in the Gorgias App Store.
What you need
- A Gorgias account (HTTP integrations and the REST API are on all Helpdesk plans), and its owner or an admin: only they can create HTTP integrations and API keys.
- 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
Gorgias REST API. In Gorgias, click the Settings icon (bottom left), then Account → REST API. Under API Access & Credentials you find the Base API URL (
https://acme.gorgias.com/api/: itsacmeis your domain), the Username (your email address) and the Password (API Key); click Create API Key if there is none yet. The key belongs to your Gorgias user and opens your account's data: keep it only in the receiver's secrets.A relay token. Gorgias does not sign its requests, so the HTTP integration sends a token you make up, and the receiver refuses every request without it. Make one of at least 24 characters, for example with
openssl rand -hex 24.Deploy the receiver from the unzipped folder:
cd email-validation-gorgias npx wrangler deploy worker.ts --name ev-gorgias --compatibility-date 2026-10-01 npx wrangler secret put EV_API_KEY --name ev-gorgias # our API key npx wrangler secret put GORGIAS_DOMAIN --name ev-gorgias # acme, for acme.gorgias.com npx wrangler secret put GORGIAS_EMAIL --name ev-gorgias # the REST API page's Username npx wrangler secret put GORGIAS_API_KEY --name ev-gorgias # the REST API page's API key npx wrangler secret put GORGIAS_RELAY_TOKEN --name ev-gorgias # the relay tokenwrangler deployprints the Worker's address, such ashttps://ev-gorgias.<your subdomain>.workers.dev. On your own server, putemail-validation-gorgias.tsnext to your code and create the receiver once, at module level, with our key and the Gorgias key as two separate settings:export const POST = createGorgiasHook({ apiKey: process.env.EV_API_KEY, // our API key gorgias: { domain: process.env.GORGIAS_DOMAIN, email: process.env.GORGIAS_EMAIL, apiKey: process.env.GORGIAS_API_KEY, // the Gorgias REST API key, never ours }, relayToken: process.env.GORGIAS_RELAY_TOKEN, });That is a Next.js route handler: add
waitUntil: after(afterfromnext/server), so a check still running at the answer finishes. In Express, createcreateGorgiasWebhookHandler(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 HTTP integration. In Gorgias, open Settings → Account → HTTP integration, the Manage tab, and click Add HTTP integration:
- Integration name:
email-validation.org - URL: the receiver's address
- Triggers: Ticket created only
- HTTP method:
POST, request content typeapplication/json - Request body:
{"ticket_id": "{{ticket.id}}"}(only the ticket id: the receiver reads the rest from Gorgias) - Headers:
Authorizationwith the valueBearer <your relay token>
Save it. Each new ticket now sends one request.
- Integration name:
The widget (optional). Open a ticket, click the nut icon in the sidebar and choose Custom integrations, then drag the integration's section by its six-dots icon into the sidebar. Its
email_checkshowsstatus,reasonandflagged; hover over a field to remove or rename it.
Settings
| Variable | Value |
|---|---|
EV_API_KEY | Required. Our API key with Validate addresses. |
GORGIAS_DOMAIN | Required. Your Gorgias domain: acme for https://acme.gorgias.com. |
GORGIAS_EMAIL | Required. The email address of the Gorgias user the REST API key belongs to. |
GORGIAS_API_KEY | Required. That user's REST API key. |
GORGIAS_RELAY_TOKEN | Required. The relay token, at least 24 characters, sent by the HTTP integration as Bearer <token>. |
EV_REGION | eu to check addresses in the EU (EU data residency), with the same key. |
EV_FLAG | The statuses that tag a ticket, separated by commas: invalid, disposable, catch_all, unknown. Default invalid. |
GORGIAS_TAG | The tag added to a flagged ticket, instead of invalid email. |
A missing Gorgias setting or relay token, or a wrong GORGIAS_DOMAIN, relay token, EV_REGION or EV_FLAG, fails every request (HTTP 500; the Worker's logs name the setting, never a key or a token), so set the secrets before you add the HTTP integration. Gorgias credentials that are set but wrong fail on each ticket instead: the ticket stays unchecked, and the widget shows gorgias_call_refused (Gorgias refused the email address or the key) or gorgias_call_failed (no answer from that Gorgias domain, or Gorgias was rate limited or down). A missing or wrong EV_API_KEY leaves every ticket unchecked.
What it does on a ticket
- A flagged status adds the tag
invalid email(or yourGORGIAS_TAG). A rule or a view on that tag can then route or hold the ticket. Avalidanswer marked disposable counts asdisposable. - Only Ticket created sends a request, so each ticket is checked once, when it is created.
- No other tag, field or message of the ticket is touched, and nothing is ever sent to the customer.
- The same customer on a new ticket 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 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 tag a ticket, 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 is left as it is, and the widget shows the check as not done. Every failure fails open.
- Gorgias waits 5 seconds for each request, so the receiver answers within 4 seconds. A check still running then is answered as pending and finishes after the answer: the tag still lands. That ticket's widget keeps showing
pendingwith the note "Still checking: the ticket tags show the result.", because Gorgias asks again only on a later ticket event: the tag is the lasting record. - Gorgias allows a REST API key 40 requests in 20 seconds, and each ticket takes one or two. A burst of new tickets can go over it, and those tickets stay unchecked.
- Gorgias does not resend a request that took too long or was answered with an error; it disables the HTTP integration after 500 failed requests in a row. A request without the right token is answered 401 and nothing is read or checked.
Try it free
Use a test address: it costs nothing and returns a fixed result. A test address receives no mail, so the test ticket must never be answered.
Create a test ticket through Gorgias's REST API. Its message channel is
api, and Gorgias runs no auto-reply rules on those tickets:curl -u "$GORGIAS_EMAIL:$GORGIAS_API_KEY" https://acme.gorgias.com/api/tickets \ -H 'content-type: application/json' -d '{ "channel": "api", "via": "api", "from_agent": false, "customer": { "email": "no_mailbox@sandbox.email-validation.org" }, "messages": [{ "channel": "api", "via": "api", "from_agent": false, "sender": { "email": "no_mailbox@sandbox.email-validation.org" }, "subject": "Test ticket", "body_text": "A test of the address check." }] }'Within a few seconds the ticket should have the tag
invalid email, and the widget should showinvalidandno_mailbox. We have not yet tried this on a real Gorgias account, and Gorgias's docs do not say whether a ticket created through the REST API sends Ticket created to an HTTP integration.If no tag comes within a minute, open the HTTP integration's Events tab. If it shows no request for the test ticket, the REST API ticket did not send one: test with a real new ticket instead. Send a mail from your own mailbox to your Gorgias support address. Its ticket is checked with your own address, which costs 1 credit and gets no tag when your address is valid: the widget should show
valid. If the Events tab shows a failed request, the widget's code says why (see Settings).Delete the test tickets and the test customer, without replying to them.
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 ticket id from Gorgias's request, never an address, and reads the ticket from https://<your domain>.gorgias.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 ticket. Its answer to Gorgias holds the status, the reason and the request id, never the address. Our key goes only to our API and the Gorgias credentials only to your Gorgias account; redirects are never followed, and nothing is logged with an address, a key or a token.
End access
The receiver holds your Gorgias REST API key, which opens your account's data. To end its access:
Delete the HTTP integration in Gorgias: Settings → Account → HTTP integration, the Manage tab. No more tickets are sent.
Delete the Worker and its secrets. On the computer you deployed from, run:
npx wrangler delete --name ev-gorgiasOn your own server, remove the receiver and its settings.
If the Gorgias key may have leaked, reset it: Settings → Account → REST API, Reset next to Password (API Key). Gorgias invalidates the old key at once, and every other script or integration that uses it stops until it gets the new one.
Revoke our key on the API keys page.