How to Add a Contact Form with Cursor

Use Cursor's AI to add the Helpdesky Contact Form to your project. Includes a ready to paste prompt for Cursor Composer.

Adding a Contact Form to your project with Cursor takes about a minute when you let Cursor's agent do the wiring for you. The Helpdesky Contact Form drops in as one container div and one script tag, handles its own validation, and lands every submission in your Helpdesky inbox where you can reply by email.

This guide is for anonymous visitors. There is no login, no HMAC, no backend wiring. If you need a portal for signed in users instead, see the Ticket Center Setup Guide.

Why this is the cleanest contact form for a Cursor project: the Free plan covers 15 conversations a month, you do not stand up SMTP or a custom backend route, and the embed is one snippet Cursor can drop into whichever framework you are working in. Replies you send from Helpdesky go straight to the visitor's email.

Set Up Your Helpdesk

Open the Helpdesky dashboard and go to Contact Form in the sidebar. Copy the embed snippet at the top of the page. It already has your Helpdesk ID filled in:

<div id="hdh-contact-form"></div>
<script src="https://helpdesky.io/contact-form.js"
  data-helpdesk-id="YOUR_HELPDESK_ID"></script>

While you are there, also enable messaging from the Messages sidebar item if you have not already. The toggle is at the top of the Messages page.

Add the Embed Code

Cursor works on whatever project you have open: Next.js, Astro, Vite, plain HTML, anything. The Contact Form is one container div and one script tag, so the actual paste location depends on your stack:

  • Plain HTML: paste the snippet inside <body> of index.html
  • React / Vite: render <div id="hdh-contact-form" /> and inject the script via useEffect
  • Next.js: use <Script src="https://helpdesky.io/contact-form.js" data-helpdesk-id="..." strategy="afterInteractive" /> from next/script

The next section gives Cursor's Composer a prompt that handles all of these automatically.

Copy This Prompt for Your AI Builder

Paste the prompt below into the chat. It tells the agent exactly what to add and where to read the canonical instructions, so the agent fetches the real embed format instead of guessing.

we need to add the helpdesky contact form to the public site.
read the contact form section of the helpdesky skill file first: https://helpdesky.io/docs/skill.md
if you can use mcp, connect to https://helpdesky.io/mcp/x/settings,embeds before you touch any code (that url pins the setup tools and stays under cursor's 40 tool cap). use it to enable messaging, add this site's domain to allowed embed domains, and fetch the contact form snippet with the helpdesk id already filled in.
if you cannot use mcp, ask me for the helpdesk id from the contact form page in the dashboard and i will enable messaging and add the domain myself.
inspect the project to figure out the framework, then add the embed in the idiomatic way for that stack (next/script for next.js, useEffect for plain react/vite, raw script tag for plain html, etc).
then drop the embed snippet into the contact page.
the form does not need any secret env vars since it is for anonymous visitors.
when you are done, confirm the form renders and submits successfully.

The skill file is the document the Helpdesky AI agent skill installs, so Cursor follows the real embed format instead of guessing. With MCP connected it also does the dashboard part: it enables messaging, adds your domain to Allowed Embed Domains and fetches the snippet with your Helpdesk ID already filled in. Cursor caps a server at 40 tools, which is why the prompt uses https://helpdesky.io/mcp/x/settings,embeds for this setup; for everyday inbox and article work the Cursor endpoint is https://helpdesky.io/mcp/x/lite, which also stays under the cap. Both go in .cursor/mcp.json with a personal token, as shown on the MCP docs.

Test It

Run your dev server, open the contact page, and submit a test message. The conversation should appear in your Helpdesky Messages inbox within seconds. If the form does not render, ask Cursor to "open the browser console and fix the error" — it is usually a missing container div or a stray quote in the script attributes.

Next Steps

Route inbound support email into the same helpdesk by following the Email Forwarding Setup Guide. If you start getting bot submissions, layer on bot protection with the Cloudflare Turnstile Setup Guide. When you ship a signed in dashboard, swap the public form for a Ticket Center so users can see their full conversation history.

Let an AI Agent Answer the Form

Cursor wired the form in; a Helpdesky AI agent can answer what comes through it. Create one under Inbox → AI Agents (beta). The Mode section sets its autonomy: Review drafts a reply and waits for one click approval in the inbox, Autopilot sends on its own within the pacing and guardrails you set.

Open Behaviour → Channels and switch on Contact form, otherwise the agent ignores conversations that arrive through the form. The visitor gets the reply by email, like any other reply from your inbox.

Agents run on your own AI provider key, saved under Settings → AI Settings. Set Up Your First AI Agent covers the setup and the Playground, and the guardrails and pacing guide explains reply delays, daily caps and hand off.

Cool Features

A couple of small things you can turn on once the basic form is live.

  1. Hide outer border: drop the form into any section without a background or border so it blends straight into your branding. From the Contact Form page, open the Layout section and toggle Hide outer border.
  1. Cloudflare Turnstile spam protection: if your domain is on Cloudflare, you can protect the form from bots in a few clicks. Open your Cloudflare account, go to Turnstile, add your domain, generate the keys, and paste them into the Helpdesky Contact Form settings. Full walkthrough in the Cloudflare Turnstile Setup Guide.
  1. Allowed Embed Domains: stop other sites from loading the form with your Helpdesk ID. Under Settings → Messages → Allowed Embed Domains, add your production domain and any preview domains; subdomains are included automatically, and an empty list allows every domain. Details in Restrict Embeds to Specific Domains.

  2. Make the form yours: the Custom Fields section adds Text, Text Area, Dropdown, Checkbox or Number fields between Email and Message, each of them optionally required. Labels, placeholders, the button text and the success text are all editable, so the form can be in your site's language. Accent Style paints the button with your Branding colours, Use Branding Background and the colour pickers cover the rest, and the Custom CSS section has a View example snippets library (Brand Colors, Dark Mode / Dark Background, Rounded / Pill Style, Flat / Minimal, Custom Fonts, Full-Width Bold Button, Compact Form). Every setting is described in the Contact Form Setup Guide; with MCP connected, Cursor can change them for you.

Last updated on October 13, 2026