feat(contact): wire up Send us a message form → Airtable (#41)#50
Merged
Conversation
The contact form's Submit button was inert. Wire it to a new POST /api/contact route handler that validates input, verifies reCAPTCHA v3 (score >= 0.7, env-gated), and forwards submissions to a Slack channel via an Incoming Webhook. - app/api/contact/route.ts: validation + captcha + Slack Block Kit post - ContactMessageForm: client form with reCAPTCHA v3, sonner toasts, pending state; extracted from the static ContactForm - Hide reCAPTCHA badge, show required Google notice by the submit button - Env: SLACK_CONTACT_WEBHOOK_URL, NEXT_PUBLIC_RECAPTCHA_SITE_KEY, RECAPTCHA_SECRET_KEY (documented in .env.example)
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
koechkevin
marked this pull request as ready for review
July 9, 2026 14:29
Per stakeholder feedback on PR #50: Slack alone gives PesaCheck no durable, trackable record of requests (status, contact details, follow-up). Store each submission as a row in an Airtable base (with a Status column) so requests can be tracked over time. Slack pings, if wanted, are configured natively in Airtable rather than in code. - app/api/contact/route.ts: POST to Airtable /v0/{base}/{table} (typecast) in place of the Slack webhook; validation + reCAPTCHA unchanged - Env: swap SLACK_CONTACT_WEBHOOK_URL for AIRTABLE_API_TOKEN, AIRTABLE_BASE_ID, AIRTABLE_TABLE_NAME (default "Contact Us")
maquchizi
reviewed
Jul 10, 2026
RECAPTCHA_SCORE_THRESHOLD overrides the default 0.7 cutoff; invalid or unset values fall back to 0.7.
maquchizi
approved these changes
Jul 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Contact Us "Send us a message" form was fully static — the Submit button was
type="button"with no handler and no backend. This wires it end-to-end: validation → reCAPTCHA v3 → Airtable.Decisions & rationale
lib/data/) is read-only editorial content (swp_*); there's no table or write access for inbound contact requests, and it's the wrong system for it.Statuscolumn (New → In Progress → Responded → Closed), so PC gets a proper request log. Airtable has native Slack notifications, so instant pings are still available — configured in Airtable, not in our code.sonnertoast. Consistent with the newsletter form (PesaCheck UI | Fix | Home Page | Subscribe to receive update #43). Manual validation (no new deps).How it works
POST /api/contactvalidates input → verifies reCAPTCHA (when configured) → creates a record viaPOST https://api.airtable.com/v0/{base}/{table}(typecast: true,Status: "New").Configuration (set in Vercel)
AIRTABLE_API_TOKENdata.records:writeon the baseAIRTABLE_BASE_IDapp…)AIRTABLE_TABLE_NAMEContact Us)NEXT_PUBLIC_RECAPTCHA_SITE_KEY/RECAPTCHA_SECRET_KEYAirtable table columns (exact names):
Name,Email,Subject,Message(text),Status(single-select).UI walkthrough
Verified locally against a live Airtable base — a real row was created and the success toast shown.
1. Empty form

2. Filled in

3. Success toast after submit

Testing
400 "Please fill in all fields."400 "Please enter a valid email address."500 "Messaging is not configured…"502, error logged200 {ok:true}+ row created + success toast ✅tsc --noEmitand biome lint pass.Closes #41