Stepthrough Start free

How to Write a Lovable Prompt for a Form

Quick answer

A good Lovable prompt for a form names the purpose and look, lists the exact fields, gives the heading and supporting line, says how to send the data (a POST request with exact JSON keys, to a URL kept in a secret), spells out what the visitor sees while sending, after success and on failure, and says which fields are required. This guide is for owners and office staff building a form in Lovable without code, and the free Lovable + n8n lesson uses a prompt like this to build a working contact form.

Last updated

LovablePromptsn8nForms

Watch: the idea in 0:52

A Lovable prompt for a form

Explainer · 0:52 · with captions

A Lovable prompt for a form, section by section: fields, heading, webhook keys, submission states, validation and the secret, and how to adapt it.

Transcript

You can ask ChatGPT to write almost anything. The next step is a real form, built in Lovable. Click Start with a prompt, and say its purpose and look. List each field the visitor will see. Its form asks for Name, Email, Question and Feedback. Add a WEBHOOK section. Send it as a POST request, as JSON, with exact keys like name, email and need. Copy those keys into your n8n prompt template. They must match, capitals too, or the answer is blank. Then spell out what the visitor sees. Sending while it works, a success message after, and a friendly error if it fails. Never hard-code the webhook URL. Use the N8N_WEBHOOK_URL secret instead. Copy the structure, and change only your parts. Practice it free in the Lovable + n8n lesson.

In Lovable you click Start with a prompt, paste the description and click Build. The more you describe, the less Lovable has to guess.

What goes in a Lovable form prompt?

Every form prompt in the Stepthrough lessons has the same eight parts, in the same order. Here they are, with the contact form's wording from the lesson:

  1. Purpose and look: "Build a simple, clean lead/contact form for a marketing business. The page should be modern, minimal, and professional."
  2. Fields: Name, Email, Question, Feedback.
  3. Heading and supporting line: "Have a Question?" and "Send us your question or feedback and we'll get back to you."
  4. WEBHOOK: send the data as a POST request, as JSON, with exact keys.
  5. SUBMISSION STATES: "Sending...", a success message and a friendly error.
  6. VALIDATION: which fields are required, plus email format.
  7. Scope: responsive for desktop and mobile, and "Do not add unnecessary sections, navigation, pricing, testimonials, or other marketing content."
  8. IMPORTANT: don't hard-code the webhook URL; use the N8N_WEBHOOK_URL secret.
Lovable prompt asking for a clean lead and contact form for a marketing business, ready to build
One prompt, eight short sections

Capitalized labels like WEBHOOK aren't required syntax; they just make a long prompt easy to scan.

How do you describe the fields and heading?

List each field on its own line, using the label the visitor will see, and give the heading and supporting line as examples. The lessons write "Use a clear heading such as:" and "Add a short supporting line like:", which leaves Lovable a little room while keeping the meaning.

Field labels can be questions. The AI Demo Request Form lesson uses "What do you need help with?" and the AI Lead Magnet Signup Form lesson uses "How do you brew now?" A question tells the visitor what kind of answer you want. Every lesson form has exactly four fields.

What does the WEBHOOK section do?

The WEBHOOK section tells Lovable where the data goes and in what shape. The lesson's version:

WEBHOOK
When the form is submitted, send the data as a POST request to the n8n webhook URL.
The data should be sent as JSON with keys: name, email, question, feedback.
Do not ask me to paste the webhook URL into the page or source code.

The keys line is the most important sentence in the whole prompt. The labels the visitor sees can be anything, but the keys are what n8n reads. Each lesson picks short keys that match its fields:

FormVisible fieldsJSON keys
Contact (lovable-n8n)Name, Email, Question, Feedbackname, email, question, feedback
Book a Demo (sales)Name, Email, What do you need help with?, Team sizename, email, need, teamSize
Get the Free Guide (marketing)Name, Email, What do you want to improve?, How do you brew now?name, email, interest, brewMethod

If you're new to the idea, What Is a Webhook? explains what the form is sending and why.

Why must the keys match the n8n prompt template?

n8n finds each answer by its key, so a mismatch leaves a blank. The AI Agent's prompt template in n8n reads the same keys from the webhook body. For the demo form:

Name: {{ $json.body.name }}
Email: {{ $json.body.email }}
Need: {{ $json.body.need }}
Team size: {{ $json.body.teamSize }}

The keys must match character for character, including capitals. teamSize in the Lovable prompt means $json.body.teamSize in n8n; teamsize or team_size would come through empty. Decide the keys once, write them in the Lovable prompt, and copy them into the n8n template.

Try it free, step by step

Lovable + n8n: Build a Web App with an AI Backend. Build a contact form in Lovable and connect it to an n8n workflow — webhook trigger, AI Agent, Google Sheets, Gmail, and a Respond node that ties it all together. You do every step yourself in a practice copy of Lovable and n8n, it checks your work as you go, and “Do it for me” finishes any step you get stuck on. Free, and nothing touches your real accounts.

Start the free lesson

Or read the full step-by-step guide

What are submission states, and why spell them out?

Submission states are what the visitor sees after clicking the button: a "Sending..." label while it works, a success message when it's done, and a friendly error if it fails. Spelling them out means the form tells the truth about what happened.

Each lesson writes its own messages to fit the form:

  • Contact: "Thanks! Your message has been received." / "Something went wrong. Please try again."
  • Book a Demo: "Request received! Check your email for your next step."
  • Free guide: "Check your inbox! Your free guide is on its way."

Success should say what happens next; the error should give the visitor something to do. On the n8n side, setting the webhook's Respond option to Using 'Respond to Webhook' Node makes the form wait for the real result before choosing which message to show.

How should validation be written?

Say which fields are required, which are optional, and ask for email format checking. Short, explicit lines work best:

  • Contact: "Require Name, Email, and Question. Feedback is optional. Validate the email format."
  • Book a Demo: "All four fields are required. Validate the email format."
  • Free guide: "Require Name, Email, and What do you want to improve. How do you brew now is optional."

Make a field optional when a good lead might not know the answer. A coffee beginner may not know what to call their brewing setup, and you'd rather have the signup.

Why tell Lovable what not to add?

The lessons' line "Do not add unnecessary sections, navigation, pricing, testimonials, or other marketing content" keeps the page to one job, and keeps Lovable from inventing testimonials or prices you'd have to delete. A one-sentence purpose, such as "The main purpose of this project is to send demo requests from Lovable to an n8n webhook," settles anything you didn't specify.

Where does the webhook URL go?

In a Lovable secret named N8N_WEBHOOK_URL, never in the page code. The lessons' IMPORTANT section says:

IMPORTANT
Do not hard-code any webhook URL.
Reference the N8N_WEBHOOK_URL secret/config value when sending the form submission.
The actual secret will be added manually later through Lovable Settings.

After building and publishing the n8n workflow, you copy its Production URL, click More in the Lovable toolbar, add the secret with that exact name and click Save. Connect a Lovable Form to n8n with a Webhook walks through the wiring.

How do you adapt the prompt for your own form?

Copy the structure and change only the parts that are about your business. A checklist:

  1. Rewrite the purpose line: what kind of form, for what kind of business.
  2. Pick three to five fields, with the labels visitors will see.
  3. Choose short, lowercase-first keys for each field and write them in the WEBHOOK line.
  4. Write a heading, a supporting line, and success and error messages in your own voice.
  5. Mark required and optional fields.
  6. Keep the "do not add" line and the IMPORTANT section exactly as they are.
  7. Copy the keys into the n8n prompt template as {{ $json.body.yourKey }}.

Then click Build, open Preview and submit a test entry with your own email. The lessons are free and run in practice copies. A real build needs Lovable (free and paid plans), n8n (n8n Cloud is paid after a free trial, or self-host it) and, for an AI agent, an OpenAI API key, which is pay-as-you-go and billed separately from ChatGPT plans. More lessons are on the Lovable tool page.

Key takeaways

  • A Lovable form prompt works best with eight parts: purpose and look, fields, heading, WEBHOOK, SUBMISSION STATES, VALIDATION, scope limits and the IMPORTANT secret rule.
  • The JSON keys in the WEBHOOK line, such as name, email, need and teamSize, must match the n8n prompt template exactly, including capitals.
  • Spelled-out submission states make the form show "Sending...", a success message that says what's next, and a friendly error.
  • The line "Do not add unnecessary sections, navigation, pricing, testimonials, or other marketing content" keeps the page to one job.
  • The webhook URL belongs in a Lovable secret named N8N_WEBHOOK_URL, not in the page code.

Frequently asked questions

Do I need to know code to write a Lovable form prompt?

No. The prompt is plain English. The only technical parts are the JSON keys and the secret name, and you can copy those patterns from the lessons.

Can I change the form after Lovable builds it?

Yes. You can describe changes to Lovable in more prompts. If you change a key, change it in the n8n prompt template too.

Why don't I paste the webhook URL into the prompt?

So it's not hard-coded into the page. Storing it as the N8N_WEBHOOK_URL secret keeps it out of the code and lets you change it without rebuilding.

How many fields should a form have?

Only what you need. Each lesson form has four, and some are optional.

Free lessons in this post

Plain-English definitions, each with an example from a free lesson.

The full AI glossary

  • A/B test plan prompt: Plan one clean A/B test for an email, form or page: a single change, a stated guess, the number that decides the winner and when…
  • Buyer persona prompt: Write a buyer persona from real customer words, such as signup answers and reviews: their goal, worries, words they use and what…
  • Data cleanup plan prompt: Turn messy spreadsheet columns into clean, consistent ones: a column-by-column plan with standard values, rules for odd entries…
  • Demo no-show follow-up prompt: Follow up after a prospect misses a booked demo: no blame, real times to rebook, a text version for the same day and an easy out…

All free prompt templates

Visual guides

The same ideas as quick visual guides: swipe through the slides, or read each one as text.

All visual guides

Keep reading

All blog posts · All free tutorials