Skip to content

HTML quickstart

A static .html page, one copied widget file and a redirect page – no bundler, no framework, no build step – and you have a waitlist.

This waitlist’s challenge is on by default, so the form loads a self-served copy of the ALTCHA widget:

quickstarts/html/install.txt
npm install altcha@3
cp node_modules/altcha/dist/main/altcha.min.js altcha.min.js

Serve the copied altcha.min.js from wherever this page’s own folder is served – the site’s root for a plain static host, public/ in a bundler.

Save this as index.html:

quickstarts/html/index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Join the waitlist</title>
</head>
<body>
<h1>Join the waitlist</h1>
<!-- Paste the form from "Add the form" here -->
</body>
</html>

The form is a plain <form method="post">. No JavaScript submits it – only this waitlist’s own challenge needs a browser that can run one. Paste it into the shell above, in place of the comment:

waitlist-form.html
<form id="waitlist-form" action="https://api.waitlo.com/v1/waitlists/wl_…/entries" method="post">
<input type="hidden" name="publishable_key" value="pk_test_…" />
<input type="hidden" name="redirect" value="https://example.com/thanks" />
<input type="text" name="waitlo_website" value="" tabindex="-1" autocomplete="off" aria-hidden="true" style="position:absolute;left:-9999px" />
<label for="email">Email</label>
<input id="email" name="email" type="email" required />
<altcha-widget challenge="https://api.waitlo.com/v1/waitlists/wl_…/challenge"></altcha-widget>
<script type="module" src="/altcha.min.js"></script>
<script type="module">
document.querySelector("altcha-widget").configure({
fetch: (url, options) =>
fetch(url, { ...options, headers: { ...options?.headers, Authorization: "Bearer pk_test_…" } }),
});
</script>
<button type="submit">Join the waitlist</button>
</form>

The form’s hidden redirect field points here. Save this next to index.html, as thanks.html:

quickstarts/html/thanks.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Thanks</title>
</head>
<body>
<p id="status">Thanks for visiting.</p>
<script type="module">
// One outcome table (ADR 0180): the same copy
// `@waitlo/mcp/snippets`' `SUBMIT_OUTCOME_COPY` exports, kept here as
// plain strings since this page has no bundler to import it through.
// `quickstart-html.test.ts` checks these two tables stay equal.
const OUTCOME_COPY = {
joined: "You're on the list.",
pending_confirmation: "Almost done: check your inbox to confirm your email address.",
duplicate: "You're already on the list.",
invalid_email: "That doesn't look like a valid email address.",
rate_limited: "Too many attempts. Please try again in a moment.",
challenge_failed: "We couldn't verify your submission. Please try again.",
submission_limit_reached: "This isn't accepting submissions right now. Try again later.",
generic_error: "Something went wrong. Please try again.",
};
// Maps the redirect's `waitlo_status` (and, for a join, whether it's
// still `waitlo_pending_confirmation`) to one of the lines above --
// the same codes `mapError` in the JS targets reads off a thrown
// error, read here off the query string instead.
function outcomeText(params) {
const status = params.get("waitlo_status");
if (status === null) {
return null;
}
const pendingConfirmation = params.get("waitlo_pending_confirmation") === "true";
if (status === "ok") {
return pendingConfirmation ? OUTCOME_COPY.pending_confirmation : OUTCOME_COPY.joined;
}
if (status === "duplicate_entry") {
return pendingConfirmation ? OUTCOME_COPY.pending_confirmation : OUTCOME_COPY.duplicate;
}
if (status === "parameter_invalid" && params.get("waitlo_param") === "email") {
return OUTCOME_COPY.invalid_email;
}
if (status === "rate_limited") {
return OUTCOME_COPY.rate_limited;
}
if (status === "challenge_missing" || status === "challenge_invalid" || status === "challenge_expired") {
return OUTCOME_COPY.challenge_failed;
}
if (status === "submission_limit_reached") {
return OUTCOME_COPY.submission_limit_reached;
}
return OUTCOME_COPY.generic_error;
}
const text = outcomeText(new URLSearchParams(location.search));
if (text !== null) {
document.getElementById("status").textContent = text;
}
</script>
</body>
</html>

The API redirects back to redirect with its own query added on top of whatever redirect already carried:

  • waitlo_status – ok for a join, duplicate_entry for one already on the list, or an error code
  • waitlo_pending_confirmation – true only when the entry still needs to confirm its email (double opt-in); otherwise absent
  • waitlo_position – the entry’s position on a fresh join, if this waitlist shows one; otherwise absent
  • waitlo_request_id – this request’s id, for support

thanks.html above only reads waitlo_status and waitlo_pending_confirmation; build your own result page from the rest.

With this waitlist’s challenge off, the same form works with no script at all – there’s no widget to load, so nothing needs JavaScript to run:

waitlist-form.html (no challenge)
<form id="waitlist-form" action="https://api.waitlo.com/v1/waitlists/wl_…/entries" method="post">
<input type="hidden" name="publishable_key" value="pk_test_…" />
<input type="hidden" name="redirect" value="https://example.com/thanks" />
<input type="text" name="waitlo_website" value="" tabindex="-1" autocomplete="off" aria-hidden="true" style="position:absolute;left:-9999px" />
<label for="email">Email</label>
<input id="email" name="email" type="email" required />
<button type="submit">Join the waitlist</button>
</form>

A challenge-on waitlist can’t fall back this way: without JavaScript, the widget never renders, so its hidden field is never there, and the API refuses the post. Turn the challenge off first if you want this variant.

Serve the folder with any static server and open it. Test mode accepts requests from localhost on any port, so this runs with nothing else configured: tick the challenge, then join – the browser posts straight to the API and lands on thanks.html reading “You’re on the list.” Submit the same address again and it reads “You’re already on the list.” instead, and anything the server refuses shows one plain line there too.

Swap the pk_test_ key for this waitlist’s pk_live_ key, point redirect at your own thanks.html’s real address, and add that page’s origin to the project’s allowed origins – live mode has no loopback exception. There’s no baseUrl to drop here: unlike the SDK-based quickstarts, this form’s action already points straight at the production API.

This form joins with no consent wording, so none of its entries can ever receive an Update. Read Consent and Updates under CASL before you turn that on.