Integrations · Forms
Validate emails in your ConvertFlow forms
Check the email address typed into your ConvertFlow pop-ups, sticky bars, inline forms, quizzes and surveys. There are two pieces; use either or both:
- In the visitor's browser, before the form is sent. A small script registers a validator for the email field with ConvertFlow's JavaScript API, so an address that cannot receive mail gets a message under the field and the visitor can correct it. By default only a definite
invalidis refused. It uses a browser key, never your secret key. - On your server, after the submission. A receiver for ConvertFlow's custom webhooks checks each submission's address and tells your code the result, so you can remove, tag or skip it in your mail tool.
Both files have no dependencies and are under the MIT licence (the text is at the top of each file). Download them: email-validation-convertflow-browser.js (plain JavaScript, no build step) and email-validation-convertflow.ts (TypeScript, for Node 22.18 or later, Bun, Deno and Cloudflare Workers; older Node needs a TypeScript build step). If the API is slow or down, the form is sent and the submission stays as it is.
How it works, and its limits
- The browser script calls
convertflow.validations({ email: … })once ConvertFlow's API is ready, and again after ConvertFlow reloads its campaigns. It waits 400 ms with no newer value before it sends a check, so typing costs nothing, and checks each distinct address once per page. The validator's answer replaces ConvertFlow's own check of the field, so the script refuses an empty field itself, unless you setrequired: false. - The receiver answers ConvertFlow at once, then checks the submission's email field with one call to our API and hands the result to your
onResultfunction. A webhook is sent once the submission is saved, so the receiver cannot stop a sign-up. ConvertFlow documents no signature for its webhooks, so the receiver asks for a token of your own in the webhook URL (?token=…); a request without the right token is answered401and its body is not read.
What you need
- A ConvertFlow plan with what you use. ConvertFlow's pricing page lists custom webhooks from the Prime plan up, and its Free plan has no integrations; ConvertFlow offers a free trial of its Pro plan.
- For the browser script, a browser key (below).
- For the receiver, an API key from the API keys page with the permission Validate addresses, a daily credit cap and no allowed origins (a server sends none). Put it in your server's environment as
EV_API_KEY, never in a page. And a token you make, at least 24 characters, for exampleopenssl rand -hex 24, or on Windows your password manager's generator, asCONVERTFLOW_BRIDGE_TOKEN.
In the browser
The script runs in your visitors' browsers, so its key is public: anyone can read it in your page. Never use your main key. On the API keys page, click Create API key and pick On a public web page (browser key) under Where will you use this key?: such a key can only validate addresses. Then:
- Allowed origins: every address your campaigns show on, such as
https://example.comandhttps://www.example.com, and the host of any ConvertFlow-hosted landing page that loads the script. From any other origin every check is refused and the form is sent unchecked. - Daily credit cap: a little above your forms' busiest day. The allowed origins stop other websites, but a script outside a browser can send any origin: the daily cap is what limits the cost.
Add the file to the pages that show your ConvertFlow campaigns, before or after ConvertFlow's own script:
<script>
window.emailValidationConvertFlow = { browserKey: 'YOUR_BROWSER_KEY' };
</script>
<script src="/js/email-validation-convertflow-browser.js" defer></script>Host the file yourself, or paste its contents into the second <script> tag. For an optional email field (a phone-first form), add required: false, or the form cannot be sent with the field empty.
Already registering validators of your own? Call ours from yours instead of setting the page variable:
const ev = EmailValidationConvertFlow.create({ browserKey: 'YOUR_BROWSER_KEY' });
convertflow.validations({
email: ev.validate,
vat_number: (value) => /^[A-Z]{2}\d{8,12}$/.test(value) || 'Enter a valid VAT number',
});To test it, open your browser's developer console on a page with the script and run await EmailValidationConvertFlow.create({ browserKey: 'YOUR_BROWSER_KEY' }).check('no_mailbox@sandbox.email-validation.org'): it is free and answers block: true with the message the field would show. Submit the form itself only with an address of yours that receives mail: never with a test address that cannot receive mail, a sandbox address included, because the integrations connected to your campaign may send it a welcome email, which would bounce and hurt your sender.
| Option | Default | What it does |
|---|---|---|
browserKey | required | Your browser key; any other key is never sent |
region | us | eu validates addresses in the EU and stores their results there, with the same key |
block | ['invalid'] | Statuses refused, from invalid, disposable, catch_all |
messages | ours | { invalid, disposable, catch_all }: your sentence for each refused status |
timeoutMs | 8000 | How long to wait for our answer before the address is allowed |
waitMs | 400 | How long a check waits with no newer value before it is sent |
required | true | Whether an empty field is refused; false for an optional email field |
field | email | The slug of the email field, if yours is another |
On your server
Copy
email-validation-convertflow.tsinto your server code and run the receiver. As a Cloudflare Worker:import { createConvertFlowWebhook } from './email-validation-convertflow.ts'; // Once per isolate, so the receiver's memory (one check per address) lasts across requests. let receive: ReturnType<typeof createConvertFlowWebhook> | undefined; export default { fetch(request: Request, env: Record<string, string>, ctx: ExecutionContext) { receive ??= createConvertFlowWebhook({ apiKey: env.EV_API_KEY, bridgeToken: env.CONVERTFLOW_BRIDGE_TOKEN, onResult: async (r) => { if (r.outcome === 'flagged') await removeFromList(r.email); // your code: your mail tool }, }); return receive(request, ctx); // ctx.waitUntil keeps the check running after the answer }, };In a Next.js route handler:
const receive = createConvertFlowWebhook({ ...the same options, waitUntil: after })withafterfromnext/server, thenexport const POST = receive. In Express or any long-running server, createcreateConvertFlowWebhookHandler(options)once and call it with{ method, body, url }:req.method, the raw body (express.raw({ type: '*/*', limit: '64kb' })) andreq.originalUrl. Answer with itsstatusandbody; the check runs on in itsdone.In ConvertFlow, open Settings → Webhooks and create a webhook with the URL
https://your-server.example/convertflow?token=<your token>and the topic Contact created or updated or Fields submitted by visitors (pick one: with both, each submission arrives twice), for all campaigns or the one you choose. The token is part of the URL: keep the webhook's settings to people you trust with it.Test it. Submit a campaign with an address of yours that receives mail and watch
onResult(outcome: 'clean'). To see the flagged path, callcreateEmailCheck(options)('no_mailbox@sandbox.email-validation.org')from your server: it is free and always answersinvalid.
The receiver reads only ConvertFlow's built-in email field (fields.email), never the contact's stored address, which can be an older one. A submission without it (a quiz or survey step) is answered 200 and costs nothing. Make your onResult action safe to run twice: a repeated delivery calls it again, answered from memory.
| Option | Default | What it does |
|---|---|---|
apiKey | required | Our API key. Missing: nothing is checked. |
bridgeToken | required | Your token, at least 24 letters, digits, -, _, . or ~; in the webhook URL as ?token= |
region | us | eu validates addresses in the EU and stores their results there, with the same key |
flag | ['invalid'] | Statuses that flag an address, from invalid, disposable, catch_all, unknown |
timeoutMs | 6000 | How long to wait for our answer before the submission stays unchecked |
store | none | { get(key), set(key, value) } (Workers KV, Redis, a table) to remember answers across restarts |
waitUntil | none | Keeps the check running after the answer on serverless hosts (Next.js after) |
onResult | none | Called once per submission with an email field, with the address judged, the outcome and the submission |
createEmailCheck(options) is the check alone, for your own code.
When something fails
Both pieces fail open. In the browser, a timeout, a network failure or an error answer lets the form be sent; a refused key, no credits, an origin not on the key's list or the key's daily cap stop the checks for the rest of the page, and a rate limit pauses them for the time our API asks. On the server, the same failures leave the submission unchecked (outcome: 'unchecked' with the reason) and ConvertFlow gets 200 either way; a refused key, no credits, a key limited to allowed origins or the daily cap pause the checks for 5 minutes. A request without the right token is answered 401. createConvertFlowWebhook refuses bodies over 64 KiB; with createConvertFlowWebhookHandler, your framework's body limit applies.
What it costs
Each checked address uses one credit. unknown results, malformed addresses and test addresses are free. The browser script checks each distinct address once per page; the receiver remembers each answer for a day (up to 1,000 addresses on one running server), so a repeated delivery or the same address on another campaign is answered without a new check. To keep answers across restarts or several instances, pass a store.
Privacy
Neither file writes a log line with an address, and neither puts a key or an address in an error or an answer. The browser request carries no cookies and at most the page's origin as the referrer, never the page's URL. Answers are remembered under the address's SHA-256, never the address. What onResult gets holds the visitor's details: keep them out of your logs. The address goes only in the body of a request to our API, never in a URL.