Skip to main content
Cookbook Content Ninja Forms

Build a Form from a Description with Ninja Forms and AI

Describe the form; the AI builds it with an email to you and puts it on a draft page or a share link for you to check.

Difficulty Beginner
Time ~10 min

Prerequisites

A site connected to WPVibe running Ninja Forms 3.15.6 or newer (tested on the free 3.15.6) on WordPress 6.9 or newer, with an administrator account.

The prompt
My site runs Ninja Forms. Build a form called [form name] for [what it is for, for example airport transfer requests] that asks for [the questions, with the choices for any multiple-choice question, for example name, email, mobile number, flight number, arrival date, passengers, and which villa: Casa Coral or Casa Marea]. Required: [which ones]. Button text: [text]. Thank-you message: [message]. Email each submission to [my email address]. Put it [on a new draft page called (page title), or behind a share link].

From my request take FORM_NAME, BUTTON_TEXT, THANK_YOU_MESSAGE, MY_EMAIL and, for a page, PAGE_TITLE.

1. Run run_wp_cli with plugin get ninja-forms; if its version is below 3.15.6, tell me to update Ninja Forms and stop. Then run get_ability_info for each Ninja Forms ability this uses: ninjaforms/list-forms, ninjaforms/list-field-types, ninjaforms/create-form, ninjaforms/get-form, ninjaforms/update-field, ninjaforms/update-action, ninjaforms/embed-form, ninjaforms/get-public-link. If one is not found, tell me and stop.
2. Run ninjaforms/list-forms. If a form called FORM_NAME exists, stop and ask whether to change that one or make a new one.
3. Run ninjaforms/list-field-types and pick a type from that list for each question: email for email addresses, phone for phone numbers, date for dates (it shows a date picker; a time of day goes in a textbox with an example such as 14:30), number for counts, listselect for a dropdown, listradio for one choice, listcheckbox for several, textarea for long answers, textbox for the rest. Tell me any question you could not match, and ask me for the choices of any list question I gave none for.
4. Run ninjaforms/create-form once with title FORM_NAME, the fields in my order (each with type, label, required, a key made of a short name, an underscore and 13 digits, and for list fields options with label and value; a list field sent without options gets Ninja Forms' placeholder choices One, Two and Three), personally_identifiable true on email, phone and address fields, submit_label BUTTON_TEXT, success_message THANK_YOU_MESSAGE, admin_email_to MY_EMAIL and admin_email_subject naming the form. Send no actions list: Ninja Forms then adds the thank-you message, the email to MY_EMAIL and saving of submissions itself.
5. Run ninjaforms/get-form and show me the fields in order with the required ones marked and each list field's choices, the button text, the thank-you message and where the email goes. Fix what I correct: a field or the button (the submit field) with ninjaforms/update-field (for a list field, send its full options list from get-form with the change: options replace the whole list); the thank-you message (success_msg) or the email's recipient and subject with ninjaforms/update-action (keys to and subject), sending form_id and the action_id from get-form. The email goes only to addresses I give, never to a form field; a reply to the visitor is a separate recipe. Run ninjaforms/get-form again after any fix and show me the change.
6. Draft page: run ninjaforms/embed-form with form_id and post_title PAGE_TITLE only. If it finds a page (page_found), call the post_id it returns POST_ID and stop: run run_wp_cli with post get POST_ID and tell me that page's title and status, and ask whether to add the form there (on a published page the form goes live at once) or pick another title. On my yes for that page, run ninjaforms/embed-form with form_id, post_id POST_ID, embed_method block and placement at_end. If no page is found, ask me to confirm a new page, then run ninjaforms/embed-form with form_id, post_title PAGE_TITLE, confirm_create true, embed_method block, placement at_end and post_status draft. Never send post_status publish. Give me the page link to preview; I publish it myself.
   Share link: run ninjaforms/get-public-link with form_id and enable true, give me the link, and tell me anyone with it can fill in the form now. To take it down later, run it again with enable false.
7. Tell me: Ninja Forms has no draft forms, so the form accepts submissions once it exists; the draft page only keeps it out of sight. Fill it in once yourself and check the email arrives.
Already connected?

Skip pasting the full prompt. Drop this into your AI on a site that already has WPVibe:

Run the “Build a Form from a Description with Ninja Forms and AI” recipe from the WPVibe cookbook on my connected site.

You know what the form should ask. Building it still means dragging in fields one at a time, marking the required ones, renaming the button, writing the thank-you message and pointing the notification email at the right inbox.

Describe the form and the AI builds it in Ninja Forms in one go: the fields with the right types and your own choices, the required marks, the button, the thank-you message, an email of each submission to you, and saving of every submission. It shows you the result, then puts the form on a draft page for you to preview or gives you a link to share.

Say who the form is for and what it must ask. Ninja Forms has no draft forms: a form accepts submissions once it exists, so the AI only ever adds it to a draft page, which keeps it out of sight until you publish the page yourself. A share link is live the moment it is on; the AI turns one on only when you ask for it.

Outcome

A Ninja Forms form that emails you each submission and saves it, on a draft page or behind a share link.