example · webflow

05 / 06

Webflow Worker spam filter.

Updated May 12, 2026

A Cloudflare Worker that accepts Webflow form submissions, classifies the message, and forwards only clean leads.

javascript
export default {
  async fetch(req, env) {
    if (req.method !== "POST") return new Response("method", { status: 405 });

    const form = await req.formData();
    const message = String(form.get("message") ?? "");
    const email = String(form.get("email") ?? "");

    let probability = 0;
    try {
      const resp = await fetch("https://api.siftfy.io/v1/predict", {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          "X-API-Key": env.SIFTFY_KEY,
        },
        body: JSON.stringify({ text: message }),
        signal: AbortSignal.timeout(2000),
      });
      if (resp.ok) probability = (await resp.json()).spam_probability;
    } catch {}

    if (probability < 0.85) {
      await env.DESTINATION.fetch("https://hooks.example.com/lead", {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({ email, message, probability }),
      });
    }
    return new Response("ok", { status: 200 });
  },
};

Production notes

  1. 01Set this Worker as Webflow's Form Submissions URL.
  2. 02Use encrypted Worker variables for SIFTFY_KEY.
  3. 03Read the full Webflow guide for form-name branching and CRM forwarding.

Common questions

How do I add spam filtering to Webflow without a plugin?

Deploy a Cloudflare Worker (free tier) that accepts the Webflow form POST, scores the message via Siftfy, and only forwards clean submissions to your CRM or notification webhook. Point Webflow's Form Submissions URL at the Worker. The full Worker is shown above.

Where do I configure the Worker URL in Webflow?

In Webflow's Project Settings under Forms, set `Form Submissions URL` to your deployed Worker. Each form POSTs there with `multipart/form-data`. Different forms can branch in the Worker using `form.get('form-name')`.

How do I keep the Siftfy API key secret in a Cloudflare Worker?

Use Wrangler secrets (`wrangler secret put SIFTFY_KEY`) so the key is encrypted at rest and never appears in your Worker source or bindings list. Reference it as `env.SIFTFY_KEY` inside the fetch handler.

Will Webflow notifications still fire if I use this Worker?

Webflow's built-in email notifications only fire when posting through the standard Webflow form action. To preserve them, have the Worker proxy clean submissions back to Webflow's webhook, or replicate the notification yourself by emailing from the Worker on clean leads.

Get a free API key

More patterns: all examples, contact forms, API reference.