Blog

Make your AI-built website's contact form work

Connect your AI-built contact form to SiteBackend with a copy-paste prompt, receive email notifications, and test that messages actually arrive.

Yash··6 min read· Updated TutorialsContact FormsAi Websites

To make your AI-built website's contact form work, connect it to a form endpoint that receives and stores submissions. With SiteBackend, you can give your AI coding assistant the endpoint and the prompt below, then check the first message in your dashboard. You don't need to build a server or move your website to a different host.

This guide is for websites where you or your AI tool can edit the form's HTML or JavaScript. You can use the prompt with a coding assistant such as Cursor, Claude or ChatGPT, or a website builder that lets you edit custom code.

If you're editing the HTML yourself, follow how to add a contact form to a static website for the manual setup.

Why does my form say “sent” when I get no message?

A contact form needs more than fields and a button. It needs somewhere to send the data.

An AI-generated form may have a placeholder handler that displays a success message, resets the inputs or logs the values to the console. That can make the interface look finished before delivery is connected.

The complete flow is:

Visitor submits → your website sends a request → SiteBackend saves the message → your configured email channel gets a notification.

Saving the message and sending an email are separate steps. You'll test both.

1. Create a form and copy its endpoint

  1. Create a SiteBackend account.
  2. Click Add site to create a site for your website.
  3. Open that site and click New form. Give it a name such as “Website contact”.
  4. Copy the endpoint from the form's page using Copy.

Your endpoint will look like this:

https://api.sitebackend.com/forms/YOUR_FORM_ID

Use the full URL from your dashboard. YOUR_FORM_ID is a placeholder, so it won't work until you replace it.

The form endpoint is designed to appear in your website's code. You don't need to give your AI tool your account password or email provider credentials.

2. Give your AI tool this prompt

Open the project in your AI coding tool, or return to the conversation where you built your website. Replace the endpoint in this prompt with your actual URL, then paste it:

Prompt for your AI coding assistant
Connect my existing contact form to SiteBackend.
 
My form endpoint is:
https://api.sitebackend.com/forms/YOUR_FORM_ID
 
Inspect the existing form and use the project's current framework.
Keep the design, labels, layout and existing fields.
 
Requirements:
1. Submit the form's actual values to this endpoint with POST.
2. Give every submitted field a name. Use email for the email field
   and message for the message field. Preserve other field names.
3. Add an empty, hidden honeypot input named _gotcha. Keep it out of
   keyboard navigation and disable autocomplete for that input.
4. If using JavaScript, send FormData and set Accept: application/json.
   Do not manually set Content-Type when sending FormData.
5. Check both the HTTP response and the JSON body. Show success only
   when response.ok and result.ok are true. SiteBackend returns
   { "ok": true, "id": "..." } on acceptance, or
   { "ok": false, "error": "..." } on an error.
6. Show a sending state and prevent duplicate submits while sending.
   On failure, show an accessible error, keep the user's input and
   let them retry. Clear the form only after an accepted submission.
7. Remove any placeholder handler that fakes success or only logs data.
8. Keep browser validation for required fields and valid email addresses.
9. Do not add a backend, email API, secret key or new dependency.
10. If this is a plain HTML form without JavaScript, use action and
    method="POST" instead. Let the endpoint redirect after submission.
 
Explain which file you changed and how I can test it. Do not claim an
email was delivered just because the submission API accepted a request.

If your form already uses CAPTCHA, tell the assistant which provider it uses. When CAPTCHA is enabled in SiteBackend, the request must include a valid token. See spam protection for the supported fields.

Review the changes, then run or preview your website. If your tool can't edit the form code, you'll need access to the builder's custom-code feature or the exported project.

3. Turn on email notifications

Open your form in SiteBackend and go to Notifications → Add channel. Choose Email, enter the address that should receive messages, and save it. Check that the channel is enabled and that its test message arrives.

Use your business inbox here, such as [email protected]. The visitor's email belongs in the form's email field; it isn't the notification destination.

You can check notification delivery status and errors in the same tab. The notifications guide covers testing channels and retrying failed deliveries.

4. Test the whole flow

Send one submission from your website with an email address you control and a distinctive message, such as “Contact form test — October 6”. Then check:

  • On the website: you see a success state or reach the thank-you page.
  • In SiteBackend: the message appears in the correct form's inbox with the email and message fields.
  • In your email inbox: the notification arrives at the destination you configured. Check spam or junk too.

Test again from the deployed website before sharing it with customers. A local preview and your live domain can behave differently, especially when you restrict allowed origins.

For a JavaScript form, you can also open your browser's developer tools and look in Network. Submitting should create a POST request to your copied endpoint. A JSON response with ok: true means the API accepted the request; check the dashboard and notification log to confirm the rest of the flow.

If you see “sent” but no request leaves the browser, the form still has a placeholder handler.

Prefer to connect it yourself? Use this HTML form

This complete example works without JavaScript. Replace the endpoint with yours and add it to an HTML page:

contact.html
<form action="https://api.sitebackend.com/forms/YOUR_FORM_ID" method="POST">
  <label>
    Your name
    <input type="text" name="name" autocomplete="name" required />
  </label>
 
  <label>
    Your email
    <input type="email" name="email" autocomplete="email" required />
  </label>
 
  <label>
    Message
    <textarea name="message" rows="5" required></textarea>
  </label>
 
  <input
    type="text"
    name="_gotcha"
    tabindex="-1"
    autocomplete="off"
    style="display:none"
  />
 
  <button type="submit">Send message</button>
</form>

After submission, SiteBackend redirects the visitor to a thank-you page. You can configure your own redirect URL in the form's settings.

If you're editing JSX rather than HTML, let your assistant adapt the example to your framework. The Next.js guide shows a React integration.

What if it still doesn't work?

What you seeWhat to check
“Sent” appears, but there is no network requestAsk your AI tool to replace the mock submit handler with a real POST request.
The request goes to the wrong addressCopy the full endpoint again. Remove YOUR_FORM_ID and any URL from an earlier integration.
Fields are missing from the saved messageEvery field needs a name. For custom JavaScript payloads, check that the handler includes all field values.
The request is rejected on your live siteCheck that the form is active and that any allowed-origin restrictions include the live origin, including https:// and the correct www or non-www host.
You get a CAPTCHA errorInclude the correct CAPTCHA token if protection is enabled for the form.
You get a 429 response while testingWait before trying again. The rate limit is 5 submissions per minute per visitor, per form.
The message appears in SpamMake sure _gotcha stays empty. Other spam checks can also flag a message.
The message is saved, but no email arrivesCheck the enabled Email channel, recipient address, delivery log and your spam folder.
You reached the Free plan's monthly limitAdditional submissions are saved but hidden, and don't trigger notifications until you upgrade.

For response details and supported fields, see the form endpoint reference.

Does this work with my current website host?

Yes, if your website can submit a form or make a browser request to an external endpoint. Your website stays on its current host; SiteBackend handles the form submissions. You don't need to move hosting or create a serverless function for this integration.

Once your test message appears in the dashboard and the notification reaches your inbox, your contact form is ready to receive enquiries.

Create your form, copy its endpoint, and give your AI assistant the prompt above.