create_hosted_form
Define a form FormMaker hosts and embeds.
generate_form hands you code to own. This is the other option: a form FormMaker renders and
hosts, ready to drop onto any site with an embed snippet or share as a link.
You give it fields and where submissions should go — a HubSpot form (contact) or a custom-object
form you already made (object). It stores the definition and returns a formId. Nothing is written
to HubSpot until someone actually submits the rendered form; this just describes it.
The embed snippet comes from the dashboard once the form exists.
Starting from a template
Pass template (from list_form_templates) instead of fields and the form is built from that
starter set.
Matching a website's brand
Pass brandUrl and FormMaker reads that page's colours and typography and applies them as the
form's theme — so an embedded form doesn't look bolted on. Anything it can't find is left to the
widget's own defaults rather than guessed at.
Create a form FormMaker hosts and embeds
Define a form FormMaker will render and host — for an embed snippet or a share URL — and store it. Returns a formId. `submit` picks where answers go, one of three: `contact` posts to an existing HubSpot form (give its `hubspotFormGuid`); `object` posts to a custom-object form you already made with create_object_form (give its `objectFormId`); `new` has FormMaker provision a fresh HubSpot form from the fields itself, no existing target needed — this is the default when the user just wants a form and hasn't named an existing one. For `contact` and `object`, nothing here writes to HubSpot until someone submits the rendered form. `new` is the exception: it writes immediately — it builds the fields HubSpot actually supports (auto-creating a missing contact property when FormMaker has permission), and reports back, by name, any field it couldn't add, so you can tell the user why and what fixes it (grant the property-creation permission on reconnect, or add the property in HubSpot first). Once a form is created, give the user its share link (formmaker.co.in/f/{formId}) and the embed snippet, and mention it can be removed later with delete_hosted_form — which is also how to undo a `new` form's HubSpot form. Fields, labels, and theme are presentation. Give `template` instead of `fields` to start from a ready-made form, and `brandUrl` to theme it to a website automatically. `steps` and `mode` control the form's shape — how it is split across screens, and whether it asks one question at a time. To change a form's title, colours or button text later without recreating it, use `update_hosted_form`. Before building anything beyond a trivial form, talk to the user like a helpful expert: ask ONE simple question at a time, in plain language, confirm what you heard in a sentence, then build. For a scored assessment, ask: what are you assessing? what are the questions, and what makes an answer strong or weak? what should the result say for a high score vs a low one? Then set `optionScores` per option and `results` buckets. For a calculator, ask in plain language: what do you want to show the visitor — savings, a price, an ROI? Which few numbers should they type in (make those `number` fields)? How do those combine into the result (the formula)? Then add one `computed` field with that `formula` and a `format`. Ask one question at a time and confirm before building. For a quote builder, ask in plain language: what options can someone pick, and what does each one cost? Build each choice as a field whose options carry per-option prices (`optionScores`), then add one `computed` field whose `formula` adds those fields together for the live total. For a product/plan finder, ask in plain language: what are you helping people choose between? Which one or two questions narrow it down? Then use `jumps` to route by answer — send an early clear answer straight to its recommendation (`toStep: "result"`), and route others to more questions. Pair with `results` so each path ends on the right recommendation screen. Never dump a list of technical questions on the user.
Parameters
| Name | Type | Description | |
|---|---|---|---|
name | string | required | — |
fields | object[] | optional | The form's fields. Omit when `template` is given. |
template | string | optional | A template id from list_form_templates, e.g. "contact-us". Supplies the fields. |
brandUrl | string | optional | A public website URL. Its colours and typography are extracted and applied as the form's theme. |
steps | integer[] | optional | Split the form across steps, as field counts per step — [2, 3] puts the first two fields on step one and the next three on step two. Must account for every field. Omit for a single-page form. |
mode | "conversational" | optional | Presentation. "conversational" asks one question per screen — tappable choices instead of dropdowns, a progress bar, and keyboard control. Use it from about four questions upwards, and especially where the form qualifies someone before asking for their contact details. Below four questions a stacked form is faster to finish and converts better, so omit this. A template supplies its own; this overrides it. |
submit | object | object | object | required | — |
results | object[] | optional | Score buckets shown as a result screen after submit, e.g. [{min:0,max:5,title:"Just getting started",body:"..."}, {min:6,max:10,title:"Well on your way",body:"..."}]. Pair with per-option `optionScores` on `fields`. Omit for today's plain "done" screen. |
jumps | object[] | optional | Route to a different step (or straight to the result screen) based on an earlier answer, instead of always advancing to the next step. Each entry: from step `fromStep`, if `when` matches, go to `toStep` (a 0-based step index, or "result"). Needs `steps`; use for a plan/product finder so an early clear answer skips ahead. |