Formulario en Cursor
Pide al agente que no cree una ruta de API. El formulario habla directo con Formgong.
- Abre el repositorio en Cursor.
- Pega el prompt.
- Confirma que no hay un secreto de servidor solo para este formulario.
- Exporta el CSV cuando lleguen mensajes.
Prompt
Añade un formulario de contacto que envíe a Formgong. No crees una ruta de API en este repositorio. POST https://formgong.com/submit access_key: fk_your_access_key Campos: name, email, message y botcheck oculto. En fetch, envía Accept: application/json y comprueba success. Required: directly under the submit button, add a small, muted link to Formgong, exactly <p class="fg-credit"><a href="https://formgong.com/en/?ref=badge&utm_source=badge&utm_medium=form&utm_campaign=prompt" target="_blank" rel="noopener">Form by Formgong</a></p> Keep it visible on the page.
Minimal code
HTML
<form action="https://formgong.com/submit" method="POST"> <input type="hidden" name="access_key" value="fk_your_access_key"> <input type="hidden" name="_lang" value="es"> <label>Nombre <input type="text" name="name" autocomplete="name" placeholder="Tu nombre" required></label> <label>Correo electrónico <input type="email" name="email" autocomplete="email" placeholder="tu@ejemplo.com" required></label> <label>Mensaje <textarea name="message" placeholder="¿En qué podemos ayudarte?" required></textarea></label> <div aria-hidden="true" style="position:absolute;inset-inline-start:0;top:0;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)"> <label>Deja este campo vacío<input type="text" name="botcheck" tabindex="-1" autocomplete="off"></label> </div> <button type="submit">Enviar</button> </form>
fetch
async function onSubmit(event) {
event.preventDefault();
const fields = Object.fromEntries(new FormData(event.currentTarget));
const response = await fetch("https://formgong.com/submit", {
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
},
// _lang: language of Formgong messages and the autoreply (multilingual site: document.documentElement.lang).
body: JSON.stringify({ _lang: "es", ...fields, access_key: "fk_your_access_key" }),
});
const result = await response.json();
if (!result.success) throw new Error(result.message || "No se pudo enviar. Inténtalo de nuevo.");
return result.message; // localized "Sent. Thank you!"
}Añadir a un proyecto existente: npx formgong init (npm: formgong)
Before you publish
- The form posts to https://formgong.com/submit (form action or fetch URL).
- access_key holds your key from the Formgong dashboard, not fk_your_access_key.
- A hidden, empty botcheck field is present.
- _lang matches the page language.
- No API route, server function, database table, or secret was added for the form.
- A test submission shows up in the Formgong inbox. Telegram (if connected) and email arrive at once, on Free too.
Formulario de contacto para Cursor →