Most waitlists are an email field and a promise. I wanted the people joining mine to prove they are reachable on Telegram, because the product lives there. That one requirement turned a form into a small distributed system: a static page, Cloudflare Turnstile, a Workers backend, two bots and a queue.
The flow
- The visitor types the phone number tied to their Telegram account. Turnstile runs before the form submits, so the number never reaches the backend from a script.
- The backend stores the number, returns a one-time token, and the page sends the visitor to the bot with that token as a start parameter.
- In the bot, pressing Start and sharing the contact sends the number Telegram itself knows. If it does not match the one typed on the page, the join is refused.
- The bot sends a six digit code. The visitor pastes it back into the page. Only then does the row become a member with a position in the queue.
- Every member gets a referral link. Each person who joins through it moves them up ten places.
What I got wrong first
I built the code step before the contact check and ended up with rows that had a code but no verified number. Nothing in the UI showed it; the queue just looked slightly wrong. Now a row only exists after both halves match.
Turnstile is invisible until it is not. It passes in a normal browser and fails in headless ones, which is what I wanted, but it also means the join page cannot be tested end to end from a script. I test that part by hand.
Releasing the queue
Releases are a cron job, not a queue drain: a small number of members are released each hour and the bot messages them the link to the product bot. Someone who leaves the queue early does not block the next person, because the release reads the table instead of a fixed order.
What I would change
I would put the phone check behind the code rather than in front of it, so the first thing a visitor sees is the bot and not a form. And I would add a plain text fallback for people who do not want to share a number at all.
The page is here if you want to see the flow: https://kode-hq.github.io/kode/join.html. It is the waitlist for Kode, an assistant that runs inside Telegram.

