BROSH HOW-TO GUIDE

Create leads and contacts
from your website.

One form. A connected contact.
A clear next step for your team.

Updated · Forms & integrations

Get the form code
Website form → contact → follow-up task
01Collect the contact details
02POST with your Email Settings key
03Create a linked follow-up task
01

Connect your form to the right workspace

Open Email Settings in BROSH and copy the value labelled Key. This is the value of u. Keep the key unchanged and URL-encode it when building the request URL.

POSThttps://www.brosh.io/api/createLead?u=YOUR_KEY

Use the full endpoint URL https://www.brosh.io/api/createLead?u=YOUR_KEY in your form action. The demo also sends a hidden u field; the Node.js example below adds that value on the server instead. Always supply your own workspace key; do not omit it or reuse another organization’s value.

02

Map the fields BROSH actually saves

Use the exact input name values below. Labels can say anything; the names are what the POST request sends. The demo requires phone and company in its UI, while the supplied server handler requires first name, last name and a valid email.

FieldRequirementWhat it does
uRequired for your integrationCopy the Key from BROSH Email Settings. Send it in the URL query; the demo also includes it in the body. The query value takes precedence.
first_name / last_nameRequiredEach must contain at least two characters. Use separate named inputs.
emailRequiredMust pass the server’s email check. Used to find an existing contact. Use a normal valid email address.
phoneOptionalSaved for new contacts after normalization; spaces and punctuation are removed, while letters, digits and + remain.
companyOptionalFor a new contact, names longer than three characters are matched to an account by name or used to create one. The contact is linked to that account.
websiteOptionalUsed when creating a new company account. It does not update an existing account.
countryOptionalSaved for new contacts after character filtering. A short value such as US avoids spaces being removed.
subjectOptionalBecomes the linked task’s name. Defaults to new lead.
descriptionOptionalBecomes the task’s description. Defaults to an empty string.
start_dateOptionalTask start time. Send an ISO 8601 timestamp with a timezone. Missing or invalid dates default to the current time.
03

Build the form and send the POST

The HTML form below posts contact details directly to BROSH using the full endpoint URL. Replace YOUR_KEY with the Key from Email Settings. The example creates a task titled “Website enquiry.” The separate Node.js example shows how to submit from your server, with the key stored in BROSH_KEY. These examples are displayed as text and do not submit visitor data.

HTML · named form fields
<form id="brosh-lead-form" method="post" action="https://www.brosh.io/api/createLead?u=YOUR_KEY">
 <label>First name
 <input name="first_name" minlength="2" maxlength="40" required>
 </label>
 <label>Last name
 <input name="last_name" minlength="2" maxlength="80" required>
 </label>
 <label>Email
 <input name="email" type="email" maxlength="80" required>
 </label>
 <label>Phone <input name="phone" type="tel" maxlength="40"></label>
 <label>Company <input name="company" maxlength="80"></label>
 <input type="hidden" name="subject" value="Website enquiry">
 <label>How can we help?
 <textarea name="description" maxlength="2000"></textarea>
 </label>
 <button type="submit">Send enquiry</button>
 <p id="brosh-form-status" role="status" aria-live="polite"></p>
</form>

The form uses method="post" and action="https://www.brosh.io/api/createLead?u=YOUR_KEY". It sends application/x-www-form-urlencoded data directly to BROSH, with u in the URL. A normal form submission navigates to the endpoint’s JSON response. The Node.js example below is an alternative server-side submission approach; it does not start a web server. No OAuth Authorization header is used.

Node.js · validate and submit from your server
// create-lead.mjs — run on your server with Node.js (built-in fetch).
// Set BROSH_KEY in your server environment to your Email Settings Key.
const key = process.env.BROSH_KEY || "YOUR_KEY";
if (!key || key === "YOUR_KEY") {
 throw new Error("Set BROSH_KEY to your own BROSH Email Settings Key.");
}

// Replace this sample with validated fields from your website form.
const contact = {
 first_name: "Alex",
 last_name: "Morgan",
 email: "alex@example.com",
 phone: "+12025550123",
 company: "Example Studio",
 subject: "Website enquiry",
 description: "Please contact me about a CRM demo."
};

if (contact.first_name.trim().length < 2 ||
 contact.last_name.trim().length < 2 ||
 !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(contact.email)) {
 throw new Error("Provide first name, last name and a valid email.");
}

// If you enable CAPTCHA, verify its token on your server BEFORE this POST.
const body = new URLSearchParams({ ...contact, u: key });
const response = await fetch(
 "https://www.brosh.io/api/createLead?u=" + encodeURIComponent(key),
 {
 method: "POST",
 headers: { "Content-Type": "application/x-www-form-urlencoded" },
 body
 }
);
const result = await response.json();
if (!response.ok || result.message !== "ok") {
 throw new Error("BROSH did not acknowledge the submission.");
}
console.log("Request acknowledged:", result);
// Verify the contact and linked task in BROSH during setup.
// Do not automatically retry: a repeated POST may create another task.

Save the script as create-lead.mjs, set the BROSH_KEY environment variable to your own key, and run node create-lead.mjs. It uses Node.js built-in fetch and needs no extra packages. Running it with a valid key creates real CRM data; replace the sample contact first.

For a server-side integration or an approved test, the same fields can be posted with cURL. This example is for a POSIX shell and creates real CRM data when run with a valid key.

cURL · example request
curl --request POST \
 'https://www.brosh.io/api/createLead?u=YOUR_KEY' \
 --data-urlencode 'u=YOUR_KEY' \
 --data-urlencode 'first_name=Alex' \
 --data-urlencode 'last_name=Morgan' \
 --data-urlencode 'email=alex@example.com' \
 --data-urlencode 'phone=+12025550123' \
 --data-urlencode 'company=Example Studio' \
 --data-urlencode 'subject=Website enquiry' \
 --data-urlencode 'description=Please contact me about a CRM demo.'
04

Turn every enquiry into a follow-up task

The endpoint handles the person and the follow-up together. Send a useful subject such as “Call about a product demo” and put the visitor’s request in description. The task is linked to the contact automatically.

Submission or behaviorResult
New emailCreates a record in contacts with type="lead", then creates its linked Task.
Existing emailReuses the existing contact and creates a new linked Task. Submitted contact details are not used to update the existing contact.
Company suppliedFor new contacts only, reuses the account matched by company name or creates a new account when the name is longer than three characters.
Task linkThe server sets activity.person to the contact ID and copies the account relationship when available.
Task defaultstype="Task", status="Not Started"; title defaults to new lead.
Repeated submissionMay reuse the same contact but create another task. Disable duplicate clicks and verify the CRM before retrying an uncertain request.

For existing contacts, new phone, company or country values in this form do not overwrite their CRM details. Use the CRM or the authenticated records API when your workflow needs an explicit update.

05

Collect a meeting time and schedule the follow-up

Let a visitor select a time, convert it to an ISO timestamp, and submit it as start_date. Include a timezone offset or use toISOString() so the intended instant is clear. Validate the selection before sending it: an invalid date falls back to now, and this handler does not reject past dates.

Node.js · scheduled task fields
// Insert before `const body = ...` in create-lead.mjs.
// Replace the example with the visitor's selected time and timezone.
const selectedStart = new Date("2030-06-15T10:00:00-04:00");
if (Number.isNaN(selectedStart.getTime())) {
 throw new Error("Choose a valid meeting time.");
}
contact.subject = "Demo meeting — Alex Morgan";
contact.description = "20-minute demo. Join using our meeting link.";
contact.start_date = selectedStart.toISOString();
// start_date is 2030-06-15T14:00:00.000Z.
// The endpoint creates a scheduled Task, not a Meeting record.
What the Book a Demo form does

Its Webinar dropdown stores four values separated by ~: local start, local end, UTC start and UTC end. On selection, it copies the third value into the hidden start_date input. It submits subject="Webinar" with the contact fields.

This creates a Task, even if the subject says “meeting.” The wrapper fixes type to Task and does not map a submitted end_date or type. A scheduled task does not itself reserve availability, generate a conferencing link or send calendar invitations.

The demo separately offers Add to Google Calendar and an .ics download after acknowledgement. Use the chosen start and end times for those calendar actions. Keep their duration aligned with the session you advertise.

Node.js · generate an optional Google Calendar link
// Generate on your Node.js server after the request is acknowledged.
// Calendar start/end values are independent of the CRM Task.
function calendarStamp(iso) {
 return new Date(iso).toISOString()
 .replace(/[-:]/g, "").replace(/\.\d{3}Z$/, "Z");
}
const params = new URLSearchParams({
 action: "TEMPLATE",
 text: "BROSH demo",
 dates: calendarStamp("2030-06-15T14:00:00Z") + "/" +
 calendarStamp("2030-06-15T14:20:00Z"),
 details: "Your meeting link and instructions",
 location: "Online"
});
const calendarUrl = "https://calendar.google.com/calendar/render?" + params;
// Render calendarUrl in your response as an <a> href labelled
// "Add to Google Calendar", escaping the value for HTML.
// A visitor must open it and save the event.

To create an actual CRM Meeting record, use the authenticated activity creation API with name, type="Meeting", person, start_date and end_date. A Task already created by this form remains a separate activity. Calendar invitations require their own configured workflow.

06

Verify the result before going live

  1. Use your workspace key. Submit one clearly labelled test enquiry through your configured form.
  2. Find the person in Contacts. Check the email, lead type, phone and account relationship. The handler normalizes some contact strings, so verify the stored values.
  3. Open the linked activity. Confirm the title, notes, Not Started status and start time. Check the displayed timezone.
  4. Test your confirmation and error UI. Keep entered details available on failure. Avoid automatic retries, which can create extra tasks.
  5. Verify scheduling separately. Check the selected slot, calendar event duration and meeting link. Confirm any invitation workflow you configure.

The wrapper responds with message: "ok" and an afx reference. Treat this as an acknowledgement, not a detailed report of every database write. The provided implementation logs some internal errors, so an HTTP success alone does not prove both records were saved.

SymptomWhat to check
400 / “Content /object can not be empty - 5!”Check the key, first and last names, email, named form controls and allowed referring domain.
Contact exists, but details did not changeExisting contacts are reused without an update.
Task is scheduled for nowCheck that start_date is present and parses as a valid date.
Several tasks for one personLook for repeated submits or retries. Contact matching does not deduplicate tasks.
Request acknowledged, record not visibleVerify the intended workspace, search for an existing email match, and ask your administrator to review the server result.
Browser blocks an external form requestConfirm domain/referrer support and CORS setup. Do not try to fix this by dropping u.

Questions and answers

Where do I find the u parameter?

Open Email Settings in your BROSH CRM and copy the Key. Use that value unchanged as the u query parameter and, to match the demo form, as a hidden u field. Do not substitute an OAuth access token.

Does this create a lead or a contact?

A new person is stored in the contacts table with type set to lead. An existing contact found by email is reused; its existing type and details are not changed by this handler.

Does submitting the form create a task?

Yes. The createLeadX wrapper builds a Task with status Not Started and links it to the contact. Subject, description and start_date control its title, notes and start time.

Can I schedule a meeting with this form?

You can collect a meeting time and create a scheduled follow-up Task by sending start_date. This endpoint still creates type Task. Calendar links or .ics downloads let the visitor save an event separately. For an actual CRM Meeting record, use the authenticated activity API.

Can I add any contact field to the HTML form?

An input name makes a field available in the request, but this handler saves only its explicitly mapped fields. Arbitrary custom fields, city and lead_source are not persisted by the supplied implementation. Use a supported integration or extend the mapping for additional fields.

Does an ok response prove that everything was saved?

Treat it as an acknowledgement. The provided implementation can log internal creation errors without returning a detailed failure, so verify the contact and linked task in the CRM during setup and after an uncertain submission.

From a form submission to a useful next step

Send the exact field names, include your Email Settings key, and give the linked task a clear title and start time. Check the contact and task together, then add the calendar experience your visitors need.

Examples follow BROSH’s Book a Demo form and the supplied createLeadX / createLead implementation. For authenticated updates, custom fields and Meeting records, see the API & OAuth2 documentation. Browse all guides.

Connect your website to your next customer.

Get help setting up your lead form and follow-up workflow.

Talk to a CRM Expert

We use cookies to personalize content, ads and to analyze our traffic. Our Cookie Policy Accept