Skip to content
Sign inJoin waitlist

Forms reference — Semono Next.js

The three forms of Semono for Next.js (the Contact inquiry, the service consultation and the job application) share one pipeline:

Form Where Server action form in the payload Fields (name → label)
Inquiry Contact page src/lib/actions-contact.ts contact name Full Name, email Business Email, phone Phone Number, company Company Name, service Service Required, budget Project Budget, details Project Details
Consultation Every service page (“Book a free consultation”) src/lib/actions-consultation.ts consultation name Full Name, email Business Email, phone Phone Number, company Company Name, service Service Required (starts with the page’s own service), details Project Details
Application Every career page src/lib/actions-application.ts application name Name, email Email, phone Phone, position Job Position (starts with the job’s title), linkedin LinkedIn URL, letter Cover letter
<Form> (design system) → server action (src/lib/actions-<form>.ts) → deliver() → provider(s) chosen in FORM_PROVIDER

The forms, their states (sending, “Thank you”, “Something went wrong”) and the spam honeypot work out of the box. Where the submissions go is a setting, not code. What the forms ask, and how to edit it, is in Forms.

Copy .env.example to .env.local (or add the variables in your host, e.g. Vercel → Settings → Environment Variables) and set FORM_PROVIDER. Restart npm run dev after changing it.

FORM_PROVIDER What happens Variables
console (default) Printed to the server log. For development. —
webhook Posted as JSON to a URL — Zapier, Make, n8n, Pipedream, Formspree, Slack workflow, your own API. FORM_WEBHOOK_URL, optional FORM_WEBHOOK_SECRET (sent as Authorization: Bearer …)
mailchimp Sender added or updated in an audience, tagged with the form, the rest saved as a note. MAILCHIMP_API_KEY, MAILCHIMP_AUDIENCE_ID, optional MAILCHIMP_STATUS
resend Emailed to you; replying answers the sender. RESEND_API_KEY, FORM_EMAIL_TO, FORM_EMAIL_FROM

Use several at once with a comma: FORM_PROVIDER=resend,mailchimp emails you and adds the contact to Mailchimp. If any of them fails, the visitor sees “Something went wrong” (their input stays in the form) and the reason is logged on the server. The providers run at the same time, so when one fails the others have usually delivered already: sending again can duplicate. The provider applies to all three forms; each submission says which form it came from (form, and the title — “New contact inquiry”, “New consultation request”, “New job application”).

Variable For Needed What it is
FORM_PROVIDER all no (console when missing) console, webhook, mailchimp, resend, or several, separated by commas
FORM_WEBHOOK_URL webhook yes The address that receives the POST
FORM_WEBHOOK_SECRET webhook no Sent as Authorization: Bearer <secret>; leave it empty to send no header
MAILCHIMP_API_KEY mailchimp yes Ends in your data center, e.g. …-us21
MAILCHIMP_AUDIENCE_ID mailchimp yes The audience that receives the contacts
MAILCHIMP_STATUS mailchimp no (transactional) The status of a new contact: transactional, pending or subscribed
RESEND_API_KEY resend yes Your Resend API key
FORM_EMAIL_TO resend yes The recipient, or several separated by commas
FORM_EMAIL_FROM resend yes A sender on a domain verified in Resend, e.g. Semono <forms@yourdomain.com>

A provider that needs a variable and doesn’t find it stops that submission with Missing environment variable <NAME> (see .env.example) in the server log; a name in FORM_PROVIDER that doesn’t exist does the same with Unknown FORM_PROVIDER "<name>". The visitor sees “Something went wrong” in both cases.

  • console: [forms] <title> followed by the submitted values (data) as an object, for example [forms] New contact inquiry { name: 'Jane Smith', email: 'jane@example.com', … }. In development it shows in the terminal that runs npm run dev; on a host, in its logs.
  • webhook: one POST of JSON (Content-Type: application/json) holding the whole submission, as in the payload below. An answer that isn’t a success is an error.
  • mailchimp: three calls. The sender is added or updated in the audience (email, in lower case, and FNAME from name; MAILCHIMP_STATUS is the status of a new contact only), tagged with the form’s title, and a note is added to the profile: the title, then one “Label: value” line for each field that was filled in. The sender is added whichever form they used, job applicants included.
  • resend: one e-mail from FORM_EMAIL_FROM to FORM_EMAIL_TO. The subject is the title followed by the sender’s name (“New contact inquiry — Jane Smith”; the title alone if the name is empty), the reply address is the sender’s e-mail, and the text is one “Label: value” line for each field that was filled in, then the time it was sent.
  • API key: Profile → Extras → API keys. It ends in your data center (…-us21); nothing else to configure.
  • Audience ID: Audience → Settings → Audience name and defaults.
  • Consent: new contacts are added as transactional — they can receive replies, not campaigns. Use pending to send a double opt-in email, or subscribed only if the form asks for marketing consent. Semono’s forms don’t.
  • Merge fields: the name (name) → FNAME (a new audience’s default). Change mergeFields at the top of providers/mailchimp.ts if your audience uses other tags, for example phone: "PHONE".
{
"form": "contact",
"title": "New contact inquiry",
"submittedAt": "2026-10-07T10:48:23.256Z",
"data": {
"name": "Jane Smith", "email": "jane@example.com", "phone": "", "company": "Northwind Ltd",
"service": "Business Strategy", "budget": "$10,000 — $25,000", "details": "We want a growth plan for next year."
},
"labels": {
"name": "Full Name", "email": "Business Email", "phone": "Phone Number", "company": "Company Name",
"service": "Service Required", "budget": "Project Budget", "details": "Project Details"
}
}

form is contact, consultation or application. data has a key for every field of that form (the names in the table above), as "" when left empty, and labels the label of each, in the order of the form.

Every form carries a hidden text field named fax (honeypotField in src/design-system/components/forms/form-state.ts): it is out of sight and out of the tab order, a person never fills it, and bots usually do. deliver() looks at it first: when it holds anything, the visitor is shown “Thank you” and nothing is sent, so the bot moves on. Keep it as it is, and don’t give a real field the name fax.

submitContact, submitConsultation and submitApplication do the same thing. Each lists the fields of its form (the copy: contactForm, consultationForm, careerForm) and calls deliver(data, { form, title, fields, required }) from src/lib/forms/deliver.ts, which:

  1. drops the submission if the honeypot is filled;
  2. reads each listed field from the submitted data (trimmed);
  3. returns the error state when a required field is empty;
  4. builds the submission (form, title, submittedAt, data, labels) and gives it to every provider named in FORM_PROVIDER;
  5. returns the success state, or the error state with the reason logged ([forms] <title> could not be delivered).

4. Add your own provider (HubSpot, Brevo, Airtable, a database…)

Section titled “4. Add your own provider (HubSpot, Brevo, Airtable, a database…)”
  1. Create src/lib/forms/providers/<name>.ts:

    import { env, valueOf, type FormProvider } from "../types";
    export const brevoProvider: FormProvider = {
    name: "brevo",
    async send(submission) {
    const response = await fetch("https://api.brevo.com/v3/contacts", {
    method: "POST",
    headers: { "api-key": env("BREVO_API_KEY"), "Content-Type": "application/json" },
    body: JSON.stringify({
    email: valueOf(submission, "email"),
    attributes: { FIRSTNAME: valueOf(submission, "name") },
    updateEnabled: true,
    }),
    });
    if (!response.ok) throw new Error(`Brevo responded ${response.status}: ${await response.text()}`);
    },
    };
  2. Register it in providers/index.ts (brevo: brevoProvider).

  3. Set FORM_PROVIDER=brevo and its variables in .env.example / your host.

Helpers from types.ts: valueOf(submission, name) returns one field as text, toLines(submission) returns "Label: value" lines for every filled field, and env(name) reads a required variable with a clear error. Every form has the fields name and email, so a provider that needs a person can rely on them.

  • Fields and labels live in the copy: contactForm in src/content/pages/contact.ts, consultationForm in src/content/pages/service.ts, careerForm in src/content/pages/career.ts. name is the key providers receive, label is what people read, required adds the red asterisk and the browser’s check, options are the choices of a select, defaultValue is what a field starts with. The button’s three texts and the title of the notification are there too.
  • Required fields come from the same required flags: the server action checks them again before it sends anything. Name and e-mail are required on all three forms, and so are the two selects of the inquiry (service and budget).
  • A new field: add it to the list in the copy. The career form lays out every field of its list by itself; the inquiry and the consultation form place their fields by hand, so also add <FormField {...fields.<name>} /> to src/components/sections/ContactSection.tsx or src/components/sections/ServiceActionSection.tsx.
  • A new form: lay it out with <Form> and <FormField>, add a server action next to the others (src/lib/actions-<form>.ts, “use server”) that calls deliver(data, { form, title, fields, required }), and add the form name to FormKind in types.ts.