Skip to content

Contact form on the site's own Worker (Turnstile, D1, Slack) - #1

Merged
jsenecal merged 14 commits into
mainfrom
contact-forms
Oct 28, 2026
Merged

jsenecal merged 14 commits into
mainfrom
contact-forms

Conversation

@jsenecal

Copy link
Copy Markdown
Contributor

What

Replaces Formspree + hCaptcha with a /api/contact handler on the site's own Cloudflare Worker.

  • One home page form, five topics: Slack invite, sponsorship, speaking, venue hosting, general question, with topic-specific fields (FR/EN).
  • Turnstile verified server-side, submissions stored in D1, posted to a private Slack channel via incoming webhook.
  • Cron every 5 minutes retries failed Slack posts; after 24 h a submission is flagged and a warning (id + topic only) is posted. Delivered rows are purged after 30 days.
  • "Offer a space" (Sponsorship) and "Propose a talk" (Events) links pre-select their topic.

Design: docs/superpowers/specs/2026-10-28-contact-form-worker-design.md
Plan: docs/superpowers/plans/2026-10-28-contact-form-worker.md

Before merging

The deploy fails until these are done (README, "First deploy of the contact form"):

  • Slack channel + incoming webhook
  • npx wrangler d1 create mtlnog-contact, real database_id committed in wrangler.jsonc
  • npx wrangler d1 migrations apply DB --remote
  • wrangler secret put TURNSTILE_SECRET and SLACK_WEBHOOK_URL
  • PUBLIC_TURNSTILE_SITEKEY set in Workers Builds; Turnstile widget hostnames include mtlnog.org
  • Browser check with mise run dev-worker (not yet exercised in a real browser)

After merge: smoke test each topic on production, then remove PUBLIC_FORMSPREE_ID / PUBLIC_HCAPTCHA_SITEKEY build vars and delete the turnstile branch.

Testing

  • npm test: 86 tests (validation, Slack escaping and Block Kit limits, Turnstile, store, handler, cron)
  • npm run typecheck:worker, npm run build
  • Local wrangler dev + local D1: API posts for FR/venue payloads stored correctly

@jsenecal
jsenecal merged commit 108731a into main Oct 28, 2026
2 checks passed
@jsenecal
jsenecal deleted the contact-forms branch October 28, 2026 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant