Skip to content

Marketing & email

Verify emails in Customer.io and store the result as an attribute

Verify each person's email from a Customer.io webhook action or your backend, and write email_status as a person attribute to branch and segment on.

Updated 2026-11-26

This recipe stores the result of an email check on each person in Customer.io as an email_status attribute, so campaigns, segments and branches can use it. There are two documented ways to get it there, and you pick one: a Send and receive data action in a campaign, which calls the API itself and maps the answer onto the person with no server of yours, or your backend, which verifies at signup and sends the attribute with Customer.io's Track API. There is no native Qelka app for Customer.io.

Why it matters: every person with an email is a recipient of your next message. Addresses with typos or dead mailboxes bounce, and mailbox providers rate your sending domain on how often that happens; a poor rate moves your mail toward spam for everyone. See Email bounces explained.

What you need

  • A Customer.io workspace with campaigns, and for option B a private Track API key (sk_), created on the API Credentials page.
  • A Qelka API key. A sk_test_ key returns simulated results and never spends credits: see Test mode. For option A, create a restricted key limited to email, because the key is stored in Customer.io.

Option A: a webhook action in a campaign

1. Add the action

In a campaign that people with an email enter, for example one triggered by signup, drag a Send and receive data block into the workflow, then Add Request. Configure it:

  • Method POST, request URL https://api.qelka.com/v1/email.
  • Headers: Authorization with the value Bearer followed by a space and your restricted key. Keep Content-Type at its default, application/json.
  • Body:
json
{ "email": "{{customer.email | strip}}", "mode": "fast" }

The Liquid tag inserts the person's email, and strip removes stray spaces. Filter the campaign's audience on people whose email exists: an empty value returns 400 invalid_request.

2. Map the answer onto the person

On the Response tab, click Add attribute twice and choose Customer attributes, so the values are stored on the person rather than only in the journey:

Attribute Dynamic value
email_status response.status
email_reason response.reason

When an action sets attributes, Customer.io keeps the person at that step until the update succeeds or all retries fail; its Wait before continuing journey setting is on by default in that case. The next step can read email_status straight away.

3. Why fast mode

mode: "fast" runs the syntax, DNS and list checks and skips the mailbox check. Customer.io's docs give the request a 16-second timeout and retry a request that times out, and a full check waits for a mail server you do not control. Fast mode catches typos, domains that take no mail and disposable inboxes. An address that passes those comes back unknown with the reason smtp_not_checked: in this option, unknown mostly means "nothing wrong found". For mailbox-level answers, use option B.

Option B: your backend and the Track API

Verify where the address arrives, at signup, and send the attribute with the person's other data. This uses the full check, with the time a mail server needs.

javascript
import { ApiConnectionError, ApiError, Client } from '@qelka/sdk'

const verifier = new Client({ apiKey: process.env.QELKA_API_KEY, timeoutMs: 15000 })
const trackBase = 'https://track.customer.io'

async function checkAddress(email) {
  try {
    return await verifier.email.verify({ email })
  } catch (error) {
    if (error instanceof ApiError) {
      console.warn(`email check skipped: ${error.type} request ${error.requestId}`)
    } else if (error instanceof ApiConnectionError) {
      console.warn(`email check skipped: ${error.message}`)
    } else {
      throw error
    }
    return { status: 'unchecked', reason: '' }
  }
}

export async function identifyWithEmailStatus(userId, email) {
  const result = await checkAddress(email)
  const response = await fetch(`${trackBase}/api/v1/customers/${encodeURIComponent(userId)}`, {
    method: 'PUT',
    headers: {
      Authorization: `Bearer ${process.env.CUSTOMERIO_PRIVATE_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      email,
      email_status: result.status,
      email_reason: result.reason ?? '',
      email_checked_at: Math.floor(Date.now() / 1000),
    }),
    signal: AbortSignal.timeout(10000),
  })
  if (!response.ok) throw new Error(`Customer.io answered ${response.status}: ${await response.text()}`)
  return result.status
}
  • Call it from a background job right after signup, since the full check can take several seconds. If your signup form must refuse a typo on the spot, add a fast check in the form handler first.
  • The Track API takes attributes as top-level keys of the body, with string, integer or boolean values; the identifier in the path can be your user id or the email, depending on how your workspace identifies people.
  • Use https://track-eu.customer.io if your workspace is in the EU region. Older integrations can keep using a Site ID and Track API key with Basic authentication, as Customer.io's reference notes.
  • An API failure stores unchecked, so the person is still identified; a Customer.io failure throws, so your job can retry it.

Act on the attribute

Branch or segment on email_status:

email_status Meaning Suggested action
undeliverable Bad syntax, a domain that takes no mail, or a mailbox the server refused Stop marketing sends; send transactional mail only after the person fixes the address
risky A disposable inbox, a catch-all domain or a full mailbox Branch on email_reason: exclude disposable from campaigns, send catch_all with care, re-check mailbox_full later
deliverable The mail server accepted the mailbox (option B only) Continue
unknown Not conclusive, or fast mode found nothing wrong Continue. Never delete or suppress on this result
unchecked or not set The API was not reached Continue, and re-check

The email reference explains each reason. Test both options with a sk_test_ key and people whose emails are undeliverable@example.com, disposable@example.com and any other address: the part before the @ picks the outcome.

Handle errors and rate limits

Nothing is billed on errors. 401 and 403 mean a wrong or restricted key, 402 an empty balance. In option A, Customer.io's docs list retries only for timeouts, 408, 409, 429 and 5xx; when a request fails for good, the attribute update is skipped and the person moves on. In option B they end as unchecked, and the Qelka SDK retries 429 after Retry-After. A key allows 200 requests per 10 seconds; Customer.io adjusts its webhook rate on 429 answers by its documentation, but a large campaign start still sends many requests at once, so start big audiences in waves. Each check costs 1 credit. See Errors and Rate limits.

Frequently asked questions

Can Customer.io call the API without a server of mine?
Yes. A Send and receive data action can call the email endpoint directly, and its Response tab maps fields of the answer to customer attributes. The API key then sits in the action's headers inside Customer.io, so use a restricted key that can only call the email endpoint, and roll it if someone who had access leaves.
Why fast mode in the webhook action?
Customer.io's documentation gives webhook actions a 16-second timeout, and retries a request that times out. A full check waits for the recipient's mail server, and every retry is a new request that can be billed again. Fast mode answers without the mailbox check; run full checks from your backend, as in option B, when you need them.
What happens to the person when the check fails?
Customer.io retries timeouts and 408, 409, 429 and 5xx answers, up to 11 times over about an hour by its documentation. Its docs list no retry for other errors, such as 401 or 402. When a request fails for good, the attribute update does not run and the person moves to the next step. A person without email_status was not checked: treat them as unknown, never as bad.

More in Marketing & email

All integrations

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