examples · 06 patterns

Runnable spam-filter examples.

Updated May 12, 2026

Siftfy publishes six runnable spam-filter examples covering FastAPI, Next.js, Django, Laravel, Cloudflare Workers for Webflow, and Ghost webhooks. Each one POSTs message text to a single API endpoint and branches on the returned probability — drop above the response's own max_confidence, queue from 0.50 up to that ceiling for review, deliver below. Copy whichever matches your stack, set SIFTFY_KEY, and you're done.

Copy the pattern closest to your stack, set SIFTFY_KEY, and classify text before it reaches your inbox, database, or moderation queue.

Common questions

Which framework should I start from for a spam filter?

Match your existing stack. Next.js and Laravel cover most product backends; FastAPI and Django suit Python services; the Cloudflare Worker variants are right when you're protecting Webflow or a static site. The classification call itself is the same shape in every example.

Do I need to install an SDK to call Siftfy?

No. Every example uses plain HTTPS to `https://api.siftfy.io/v1/predict`. The Python SDK is provided for type safety and retries, but a single `fetch` or `requests.post` call works from any language with HTTP support.

What thresholds do the examples use?

Each example drops only what scores above the `max_confidence` the response reports, queues everything from 0.50 up to that ceiling for moderator review, and delivers anything below 0.50. The ceiling is read from the response rather than hard-coded, because the model alone is capped below the block band and a fixed constant like 0.85 would never fire. Tune the 0.50 review floor after a week of reviewing the queue.

Should I show users when their submission is flagged as spam?

No. Return the same success response for clean and spam submissions. A spam-specific error only helps adversaries iterate against your filter while doing nothing for legitimate visitors.