Integrations
Validate phone numbers and emails in Webflow
Check Webflow form submissions: a form webhook receiver that flags bad emails and phones, plus an optional pre-submit check through your own endpoint.
Updated 2026-11-23
This recipe puts a small endpoint between Webflow and the API. Webflow form submissions reach it through a webhook so you can flag bad emails and phones, and the same endpoint can answer a pre-submit check from the page.
What you need
- A Webflow site on a plan that allows form webhooks or custom code: check yours.
- A Qelka API key in the
API_KEYenvironment variable. Ask_test_key returns simulated results and never spends credits: see Test mode. - A server or edge function that you control, such as a Cloudflare Worker, with the key stored as a secret on it: see Authentication.
Steps
1. The endpoint
This Cloudflare Worker reads the key from a secret and a shared token from WEBHOOK_TOKEN. Any server that can run the same logic works the same way.
import { ApiConnectionError, ApiError, Client } from '@qelka/sdk'
async function check(env, { email, phone, country }) {
const client = new Client({ apiKey: env.API_KEY, timeoutMs: 8000 })
const verdict = { emailStatus: 'unchecked', suggestion: null, e164: null, phoneStatus: 'unchecked' }
const settle = async (task) => {
try {
await task()
} catch (error) {
if (!(error instanceof ApiError) && !(error instanceof ApiConnectionError)) throw error
console.error('validation skipped', error instanceof ApiError ? `${error.type} ${error.requestId}` : 'unreachable')
}
}
await Promise.all([
email &&
settle(async () => {
const result = await client.email.verify({ email, mode: 'fast' })
verdict.emailStatus = result.status
verdict.suggestion = result.did_you_mean
}),
phone &&
settle(async () => {
const result = await client.phone.validate({ phone, country })
verdict.phoneStatus = result.status
if (result.status === 'valid') verdict.e164 = result.e164
}),
])
return verdict
}
export default {
async fetch(request, env) {
const url = new URL(request.url)
if (request.method === 'OPTIONS') {
return new Response(null, { headers: { 'Access-Control-Allow-Origin': env.SITE_ORIGIN, 'Access-Control-Allow-Methods': 'POST', 'Access-Control-Allow-Headers': 'Content-Type' } })
}
if (request.method !== 'POST') return new Response('Method not allowed', { status: 405 })
const body = await request.json().catch(() => null)
if (!body) return new Response('Bad request', { status: 400 })
if (url.pathname === '/webflow') {
if (url.searchParams.get('token') !== env.WEBHOOK_TOKEN) return new Response('Unauthorized', { status: 401 })
const data = body.payload?.data ?? {}
const verdict = await check(env, { email: data.Email ?? data.email, phone: data.Phone ?? data.phone, country: data.Country ?? data.country })
console.log('webflow submission checked', JSON.stringify({ form: body.payload?.name, ...verdict }))
return new Response('ok')
}
if (url.pathname === '/check') {
const verdict = await check(env, body)
return Response.json(
{ block: verdict.emailStatus === 'undeliverable' || verdict.phoneStatus === 'invalid', suggestion: verdict.suggestion },
{ headers: { 'Access-Control-Allow-Origin': env.SITE_ORIGIN } },
)
}
return new Response('Not found', { status: 404 })
},
}
Set API_KEY, WEBHOOK_TOKEN and SITE_ORIGIN (your site origin, for example https://example.com) as secrets or variables. The webhook route stores nothing: replace the console.log with a call that writes the verdict to your CRM or database, keyed on the submission. The check route answers only whether to block, never the raw API result. The Webflow field names above (Email, Phone, Country) must match the field names of your form.
2. Flag submissions after the fact
In the site settings, open Integrations, then Webhooks, add a webhook for Form submission, and use the URL https://your-endpoint.example.com/webflow?token=YOUR_TOKEN. The token is a long random value you generate: it is what keeps strangers from posting to the route. Submit a test form and check your logs.
3. Optionally check before submit
Add this in the page custom code, before the closing body tag. It calls your endpoint, never the API:
document.querySelectorAll('form').forEach((form) => {
form.addEventListener('submit', async (event) => {
if (form.dataset.checked) return
const email = form.querySelector('input[type=email]')?.value
if (!email) return
event.preventDefault()
event.stopPropagation()
let block = false
try {
const response = await fetch('https://your-endpoint.example.com/check', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email }),
signal: AbortSignal.timeout(6000),
})
block = (await response.json()).block === true
} catch (error) {
block = false
}
if (block) {
alert('This email address cannot receive mail. Please check it.')
return
}
form.dataset.checked = '1'
form.requestSubmit()
}, true)
})
If the endpoint is slow or down, the form goes through. Webflow's own form handler can behave differently between plans and form types, so test on the published site, not only in the designer. Add your own rate limit to the endpoint so a bot cannot spend your credits through it.
4. Use the verdict
| Verdict | Suggested action |
|---|---|
Email undeliverable |
Flag the entry, do not send confirmation emails, show suggestion to the team |
Email risky |
Review by hand |
Email deliverable |
Use normally |
Email unknown or unchecked |
Use, and re-check later |
Phone e164 present |
Store it and use it for calling and messaging |
See the email reference and the phone reference.
Handle errors and rate limits
No error is billed. The SDK retries 429, 502 and 503 responses, waiting Retry-After when present. After 200 requests per 10 seconds on one key you get 429 rate_limited. 401 invalid_api_key and 403 forbidden mean a wrong or restricted key. 402 insufficient_credits means an empty balance: alert yourself and keep failing open. Each email check costs 1 credit. See Errors and Rate limits.
Related
Frequently asked questions
Can I put the API key in Webflow custom code?
Can I block a submission with a bad email?
Does Webflow have a native integration?
Put this check in your product
Get an API key in under a minute. 100 free credits every month, no card required.
- 100 free credits a month
- No card
- Test keys spend nothing
- Cancel any time