Skip to content

Integrations

Validate phone numbers and emails in Typeform

Check the email and phone answers of each Typeform response with a signed webhook receiver and the SDK, then flag or clean the contact in your own system.

Updated 2026-11-23

This recipe receives the Typeform response webhook, checks the email and phone answers and hands the verdict to your own code to flag or clean the contact. Typeform has no native Qelka integration, so a small receiver sits in between.

What you need

  • A Typeform account with webhooks for your form: check your plan.
  • A Qelka API key in the API_KEY environment variable. A sk_test_ key returns simulated results and never spends credits: see Test mode.
  • A small server that Typeform can reach over HTTPS, such as the one below, with the webhook secret in TYPEFORM_SECRET: see Authentication for keeping keys server-side.

Steps

1. The receiver

javascript
import crypto from 'node:crypto'
import express from 'express'
import { ApiConnectionError, ApiError, Client } from '@qelka/sdk'

const client = new Client({ apiKey: process.env.API_KEY, timeoutMs: 8000 })
const app = express()

function signatureIsValid(rawBody, header) {
  if (!header) return false
  const expected = 'sha256=' + crypto.createHmac('sha256', process.env.TYPEFORM_SECRET).update(rawBody).digest('base64')
  const received = Buffer.from(header)
  const wanted = Buffer.from(expected)
  return received.length === wanted.length && crypto.timingSafeEqual(received, wanted)
}

app.post('/typeform', express.raw({ type: '*/*' }), async (req, res) => {
  if (!signatureIsValid(req.body, req.get('Typeform-Signature'))) return res.sendStatus(401)

  const response = JSON.parse(req.body.toString('utf8')).form_response
  const answers = response?.answers ?? []
  const email = answers.find((answer) => answer.type === 'email')?.email
  const phone = answers.find((answer) => answer.type === 'phone_number')?.phone_number
  const verdict = { token: response?.token, emailStatus: 'unchecked', suggestion: null, e164: null }

  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 })
        verdict.emailStatus = result.status
        verdict.suggestion = result.did_you_mean
      }),
    phone &&
      settle(async () => {
        const result = await client.phone.validate({ phone })
        if (result.status === 'valid') verdict.e164 = result.e164
      }),
  ])

  await saveVerdict(verdict)
  res.sendStatus(200)
})

app.listen(3000)

saveVerdict is your own function: it updates your database or CRM, keyed on the response token. The route answers 200 even when the API was unreachable, so Typeform does not retry a response you already handled, and the verdict simply says unchecked. Typeform phone answers usually include the country code. If yours do not, pass a country to the phone check.

2. Add the webhook

In the form, open Connect, then Webhooks, and add the public HTTPS URL of the receiver, for example https://example.com/typeform. Set a secret, put the same value in TYPEFORM_SECRET, and turn the webhook on. Submit a test response and check that your function is called.

3. Use the verdict

Verdict Suggested action
Email undeliverable Flag the contact, do not send confirmation emails, show suggestion to the team
Email risky Send nothing automatic, review by hand
Email deliverable Send the confirmation as usual
Email unknown or unchecked Continue, and re-check later
Phone e164 present Store it and use it for calling and messaging

See the email reference and the phone reference for every field.

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.

Frequently asked questions

Can I block a Typeform submission with a bad email?
Not through a webhook, because a webhook fires after the response is submitted. Typeform has its own email and phone field formats that catch typos while the person types. This recipe checks the answers after submission and flags the contact, so you decide what to do with it.
How do I trust the webhook request?
Typeform signs each webhook with an HMAC-SHA256 of the raw body, using a secret you set on the webhook, and sends it in the Typeform-Signature header as sha256= followed by the base64 digest. Compare it in constant time against your own computation over the raw bytes before you read the body.
Does the person get an error message?
No. The check runs after submission, so the person is not told anything. Use the result to flag the response, send a confirmation email only to deliverable addresses, or ask the person to correct the address through a follow-up message.

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