Loading page
Next.js integration
The App Router gives two sensible integration points. Both keep the form in your own components and use the same endpoint.
In Next.js you can post from a client component with fetch, or forward the submission from a server action or route handler. Use the server path when you need to add a secret or forward to a CRM after storing the lead.
"use server";
export async function submitLead(formData: FormData) {
const response = await fetch(
"https://formivo.faizyab.me/api/f/YOUR_FORM_ID",
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(Object.fromEntries(formData)),
cache: "no-store",
},
);
if (response.status !== 201) {
return { ok: false as const };
}
return { ok: true as const };
}