Integrations · CRM

Validate emails of new Givebutter contacts

Check the address of every new Givebutter contact. Givebutter calls a small receiver of yours each time it creates a contact (a new donor, a ticket buyer, a contact added by hand); the receiver checks the contact's addresses with your API key, tells you which ones cannot receive mail and, if you want, tags that contact in Givebutter so you can filter it out of your next email.

Download it: email-validation-givebutter.zip holds email-validation-givebutter.mjs (one JavaScript module) and the MIT licence.

What you need

  • An API key of ours from the API keys page with Validate addresses (on by default). Keep it on your server, never in a page.
  • A server that Givebutter can reach over HTTPS, in anything with fetch (Node 22 or later, Bun, Deno, Cloudflare Workers). Copy email-validation-givebutter.mjs next to its code.
  • A Givebutter account. Webhooks and API keys are under Settings. A Givebutter API key is needed only to tag contacts.

Set up the webhook in Givebutter

  1. In Givebutter, open Settings, then Developers, then Webhooks, and click New webhook.
  2. Give it a name, enter your receiver's HTTPS address as the webhook URL, pick the event contact.created and click Create.
  3. Click the eye icon (View) next to the webhook and copy its signing secret into your server's environment, for example as GIVEBUTTER_WEBHOOK_SECRET. Givebutter sends it in a header named Signature with every delivery; the receiver answers 401 to any request without it.
  4. Only to tag contacts: create a Givebutter API key (Givebutter shows it once) and keep it on your server as well. Givebutter's API reference places API keys under Settings, then Integrations, then API Keys; its help center under Settings, then Developers, then API.

Givebutter fires contact.created for a contact made by a new transaction or created by hand, not for contacts imported from a CSV file.

The receiver

Make the receiver once per process and hand it each request to the webhook URL. A Cloudflare Worker:

import { createGivebutterHook } from './email-validation-givebutter.mjs';

let hook;

export default {
  fetch(request, env, ctx) {
    hook ??= createGivebutterHook({
      apiKey: env.EV_API_KEY,
      signingSecret: env.GIVEBUTTER_WEBHOOK_SECRET,
      givebutterApiKey: env.GIVEBUTTER_API_KEY, // only to tag
      tag: 'email-invalid', // only to tag
      onResult: (r) => {
        // r.contactId, r.emails (each with where, status, reason, blocked), r.blocked, r.tagged
      },
    });
    return hook.handle(request, ctx);
  },
};

With ctx (Cloudflare Workers) the receiver answers Givebutter at once and checks after the answer; on Vercel, pass { waitUntil }, imported from @vercel/functions. Without a second argument it answers when the check is done. On Node, turn your framework's request into a web Request (Node 22 has one built in) and pass the Response back.

What it does

  • It checks the contact's primary email and every address in its list of emails (20 at most), each address once.
  • onResult gets one result per contact: contactId, firstName, lastName, emails (each address with where, status, reason, action, did_you_mean, blocked and, when it got no answer, error), blocked, tagged and tagError.
  • Tags only when you ask. Without tag, nothing in Givebutter changes. With tag and givebutterApiKey, a contact with a blocked address gets that tag through Givebutter's Add tags to a contact call, and its other tags stay. Filter on the tag in Givebutter before your next email.
  • Every other event (transactions, tickets, campaigns, plans, refunds) is answered 200 and ignored.

Try it free first

Check one of our free test addresses with the receiver's own check, without Givebutter:

const result = await hook.check('no_mailbox@sandbox.email-validation.org');
console.log(result.status, result.blocked); // invalid true

Checks of our test addresses are free. Never send an email to them, or to any address you made up: it would bounce.

How it decides

  • What is blocked. invalid by default. block: ['invalid', 'disposable'] also blocks disposable addresses, and catch_all can be added too. valid and unknown are never blocked: act on the action of a valid result if you want to (spam traps and known complainers are valid with the action remove).
  • It fails open. A timeout (6 seconds per check by default, timeoutMs), a network error, a rate limit, no credits or any error answer leaves that address unchecked (error says why), never blocked, and the contact is not tagged. Nothing is retried; after a rate limit the receiver sends nothing until our API's Retry-After has passed. A missing key or secret throws when you make the receiver.
  • Answers are remembered. A verdict is kept for the process's life (10,000 addresses by default, memoMaxEntries); an unknown or a failed check is asked again.
  • Credits. Each check uses one credit (unknown results, malformed and sandbox addresses are free). region: 'eu' checks in the EU, at https://api-eu.email-validation.org.
  • What it answers Givebutter. 401 for a wrong or missing signing secret (the body is not read), 405 for anything but POST, 413 for a body over 64 KB, 400 for a body that is not JSON, else 200. An error thrown by your onResult is caught.
  • Our key goes only to our API and the Givebutter key only to Givebutter's API. Redirects are never followed, and the receiver logs nothing.

Test it first

The receiver reads Givebutter's deliveries by the field names of Givebutter's webhooks article and API reference and has not run against a real Givebutter account. Create one contact by hand with the test address above, watch onResult, and check the webhook's Activity in Givebutter before you rely on it.

More on Givebutter

Updated · Maintained by: Email Validation LLC

Need help? Contact support, or ask the help chat. Something wrong or missing on this page? Tell us