Turbo IT

"Building something great..."

Manchester-based · Worldwide reach

Drawing Winners

Auto Draw at End Date

Cron-driven draws fire automatically at end_date. The audit log, notification routing, and how to test.

Updated 2 June 20265 min read

Heads up — partially shipped.

The platform supports manual draw today (admin clicks “Draw winner” on the competition page). A cron-driven auto-draw at end_date is on the near-term roadmap. Until it ships, set every competition to type='draw' and run draws from the admin.

What auto-draw will do (planned)

Every five minutes a Cloudflare cron will look for competitions whose end_date has passed, whose type is auto_draw (or one of the auto-draw-like reveal types — flappy_reveal, scratch_reveal), and which have no draw_results row yet. For each, the cron will pick a random paid ticket, record the winner, and email + SMS the customer using your Resend + Twilio integrations.

Why we shipped manual draw first

The drawing logic itself (random pick over the ticket pool, write to draw_results, create a winners row) is identical for manual and auto-draw. The cron just triggers it. Shipping manual draw first proves the logic with a human in the loop; auto-draw is the same code wired to a schedule.

How draws will be auditable

Both manual and auto-draws write to draw_results with a draw_method column (manual or auto). The auto_draw_log table (already in the schema, currently unused) will record cron runs for the audit trail.

Today: how to run a draw manually

See Manual Draw. Until auto-draw lands, every competition needs a manual draw click — set a calendar reminder for each competition’s end date.