examples · 06 patterns

Runnable spam-filter examples.

Updated May 12, 2026

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 messages above 0.85 spam probability, queues 0.50–0.85 for moderator review, and delivers anything below 0.50. Tune those numbers after a week of reviewing the queue — they're conservative defaults, not magic constants.

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.