Registration, tour and contact forms
The tour, contact and registration forms for your listing, agent and sign-up pages, posting to your own server route, which sends each lead to Follow Up Boss, Sierra Interactive or Sure Send.
Three forms from @ruuster/idx-recipes turn visitors into leads in your CRM. TourForm sits on each
listing page, ContactForm on your agent pages, and RegistrationForm on a sign-up page for
new-listing emails. Each one posts the visitor's details as JSON to your own server route, which
checks them and sends them to Follow Up Boss, Sierra Interactive or Sure Send with the listing
attached. Your CRM keys stay on your server.
What the visitor sees
<!--
Contact form (no listing).
From the React component ContactForm. Generated by npm run idx:recipes-static from @ruuster/idx-recipes. Do not edit it by hand.
Fill each value from:
form[action]: your own server route that receives the lead and sends it to your CRM
form[data-rw-success]: the text shown after a successful send (yours, or the default shown here)
[data-rw-consent-text]: your consent wording for being contacted
label with name="consentAlerts": your wording for listing alerts; leave the whole label out when you have none
.rw-button[data-rw-submit] text: your button text, or the default shown here
id and for attributes: any values that are unique on the page; keep each label's for, aria-labelledby and aria-describedby pointing at the same ids
form[data-rw-lead-listing]: optional: the listing JSON as on the tour form, when the form is about a home
Every data-rw-* attribute is a hook for ruuster-idx.js; see ../HOOKS.md.
-->
<form class="rw-recipes rw-form rw-form--contact" method="post" action="/api/leads/contact" data-rw-lead="contact" data-rw-success="Thank you. We received your message and will reply soon.">
<div class="rw-form__row">
<div class="rw-field">
<label class="rw-field__label" for="contact-form-1-first">First name</label>
<input class="rw-input" id="contact-form-1-first" name="firstName" autoComplete="given-name" required="" maxLength="80"/>
</div>
<div class="rw-field">
<label class="rw-field__label" for="contact-form-1-last">Last name</label>
<input class="rw-input" id="contact-form-1-last" name="lastName" autoComplete="family-name" required="" maxLength="80"/>
</div>
</div>
<div class="rw-field">
<label class="rw-field__label" for="contact-form-1-email">Email</label>
<input class="rw-input" id="contact-form-1-email" name="email" type="email" autoComplete="email" required="" maxLength="254"/>
</div>
<div class="rw-field">
<label class="rw-field__label" for="contact-form-1-phone">Phone (optional)</label>
<input class="rw-input" id="contact-form-1-phone" name="phone" type="tel" autoComplete="tel" maxLength="40"/>
</div>
<div class="rw-field">
<label class="rw-field__label" for="contact-form-1-message">Message (optional)</label>
<textarea class="rw-input rw-textarea" id="contact-form-1-message" name="message" rows="4" maxLength="2000"></textarea>
</div>
<div class="rw-hp" aria-hidden="true"><label for="contact-form-1-website">Leave this field empty</label><input id="contact-form-1-website" name="website" type="text" tabindex="-1" autoComplete="off" value=""/></div>
<label class="rw-check rw-consent" for="contact-form-1-consent">
<input id="contact-form-1-consent" type="checkbox" name="consentContact" aria-labelledby="contact-form-1-consent-text" data-rw-consent="" value="yes"/>
<span id="contact-form-1-consent-text" data-rw-consent-text="">I agree that Peach Realty may contact me by phone, text or email about this request.</span>
</label>
<button class="rw-button rw-button--block" type="submit" disabled="" aria-describedby="contact-form-1-needconsent" data-rw-submit="">Send message</button>
<p class="rw-form__hint" id="contact-form-1-needconsent" data-rw-consent-hint="">Check the box above to agree to be contacted, then send your request.</p>
<p class="rw-form__status" role="status" aria-live="polite" data-rw-form-status=""></p>
</form>import { ContactForm } from "@ruuster/idx-recipes";
<ContactForm {...props} /><!--
The bar fixed to the bottom of the listing page under 992px.
From the React component MobileActionBar. Generated by npm run idx:recipes-static from @ruuster/idx-recipes. Do not edit it by hand.
Fill each value from:
.rw-button text: "Contact {name}" as on the agent card, then Choose tour time
Every data-rw-* attribute is a hook for ruuster-idx.js; see ../HOOKS.md.
-->
<div class="rw-mobilebar" data-rw-mobile-bar="">
<button type="button" class="rw-button rw-button--block" data-rw-open="contact">Contact Jordan Lee</button>
<button type="button" class="rw-button rw-button--accent rw-button--block" data-rw-open="tour">Choose tour time</button>
</div>import { MobileActionBar } from "@ruuster/idx-recipes";
<MobileActionBar {...props} />Each form has your consent sentence beside a box that starts unchecked, and the submit button stays
off until the visitor checks it. The registration and tour forms can carry a second, separate box for
listing alerts, also unchecked. Show that box only when your CRM, or AI Nurture on the Ruuster
Platform, sends listing emails. With the Listing Alerts add-on, use the
Email me new matches form instead. Leave alertsConsentText out
and the box is gone. A hidden field catches bots. On success the form shows your thank-you
text and pushes the GA4 generate_lead event.
Each lead also carries where the visitor came from: the visit's UTM values and ad click ids
(gclid, fbclid, msclkid), the first page of the visit and the outside page it came from, the
page the form was sent from, and the first and latest visit this browser remembers. Your route
passes all of it to your CRM. Two optional props add more:
agent: the agent to assign the lead to, as{ id, email, name }(their CRM user id, email or full name). Use it on an agent's own page. Leave it out to let your CRM's routing assign the lead.leadType:"buyer","seller"or"both", for exampleleadType="seller"on a home value form.
<ContactForm action="/api/leads/fub" consentText={CONTACT_CONSENT} agent={{ id: "12", email: "pat@peachrealty.com", name: "Pat Agent" }} />
What the page calls
| When | Request | Where it goes |
|---|---|---|
| The visitor submits a form | POST /api/leads/fub with the form's JSON |
your own route, on your server |
| Your route accepts it | the CRM's own API | Follow Up Boss, Sierra Interactive or Sure Send |
| A tour or listing question | GET /v1/listings/{listingId} with your secret key |
the listing's address, MLS number and price for the CRM |
The forms make no Ruuster API call themselves. LEADS_ACTION in lib/site.ts names the route;
change it to /api/leads/sierra or /api/leads/suresend for those CRMs.
Steps
- Pick your CRM's page and follow it to the end: Follow Up Boss,
Sierra Interactive or Sure Send.
It adds the route, the keys and
lib/crm.ts. - Set
LEADS_ACTIONinlib/site.tsto your CRM's route, and write your own consent sentences inCONSENT_TEXTandALERTS_CONSENT_TEXT(Privacy and consent). - Put
TourFormin the listing page's sidebar (Listing detail page),ContactFormon your agent pages (One agent's listings), andRegistrationFormon a sign-up page as below. - Send a test lead from a listing page and find it in your CRM, as your CRM's page describes.
The code
Your settings, including the consent wording and the route:
lib/site.ts
// Your site's own settings. Every page, form and sitemap reads them from here.
import type { DetailAgent } from "@ruuster/idx-recipes";
/** Your brokerage's name as visitors see it. It is also the lead source your CRM shows. */
export const SITE_NAME = process.env.SITE_NAME || "Your Brokerage";
/** Your site's origin, with no trailing slash, for canonical URLs, sitemaps and pageHref. */
export const SITE_ORIGIN = (process.env.SITE_ORIGIN || "http://localhost:3000").replace(/\/+$/, "");
/** Where every form posts its lead: your own server route, which sends it to your CRM. */
export const LEADS_ACTION = "/api/leads/fub";
/** Your search page. The listing page's Back link and its X return here. */
export const SEARCH_PATH = "/search";
/** Your listing page URL template. The API builds each card's href from it. */
export const DETAIL_HREF = "/homes/{slug}";
/** A collection you curate in Ruuster for the homepage strip. Leave it null to show your own listings. */
export const FEATURED_COLLECTION_ID: string | null = null;
/** The consent sentence beside the contact box on every form. Edit it with your own wording. */
export const CONSENT_TEXT = `I agree that ${SITE_NAME} may contact me by phone, text or email about this request.`;
/** The consent sentence beside the separate listing-alerts box. */
export const ALERTS_CONSENT_TEXT = "Email me new listings like this one. I can unsubscribe at any time.";
/**
* The agent or office your listing pages offer for questions and tours: the contact card, the
* mobile action bar and the contact form are about this person. Use your own agent or your office's
* team inbox, never the listing agent from the MLS. Leave a value unset and the page leaves that
* line out; with no name, the buttons read "Contact an agent".
*/
export const SITE_AGENT: DetailAgent = {
name: process.env.SITE_AGENT_NAME || null,
photoUrl: process.env.SITE_AGENT_PHOTO_URL || null,
phone: process.env.SITE_AGENT_PHONE || null,
email: process.env.SITE_AGENT_EMAIL || null,
license: process.env.SITE_AGENT_LICENSE || null,
brokerage: SITE_NAME,
};
/** An absolute URL on your site for a path such as "/homes/123-main-st-…". */
export function absoluteUrl(path: string): string {
if (/^https?:\/\//i.test(path)) return path;
return `${SITE_ORIGIN}${path.startsWith("/") ? "" : "/"}${path}`;
}
A sign-up page with the registration form:
app/alerts/page.tsx
// /alerts: a sign-up page for new-listing emails. The RegistrationForm posts to your own lead route,
// which creates the person in your CRM; the alerts box is separate from the contact box, and both start unchecked.
import { RegistrationForm } from "@ruuster/idx-recipes";
import { ALERTS_CONSENT_TEXT, CONSENT_TEXT, LEADS_ACTION, SITE_NAME } from "@/lib/site";
export const metadata = {
title: `Get new listings by email · ${SITE_NAME}`,
description: `Sign up with ${SITE_NAME} to hear about new homes for sale.`,
alternates: { canonical: "/alerts" },
};
export default function AlertsPage() {
return (
<main>
<h1>Get new listings by email</h1>
<p>Tell us where you are looking, and we will send you new homes as they come on the market.</p>
<RegistrationForm
action={LEADS_ACTION}
consentText={CONSENT_TEXT}
alertsConsentText={ALERTS_CONSENT_TEXT}
submitLabel="Sign up"
successText="Thank you. Watch your inbox for new listings."
/>
</main>
);
}
The Follow Up Boss route the forms post to:
app/api/leads/fub/route.ts
// POST /api/leads/fub: the registration, tour and contact forms post here. lib/crm.ts does the work.
import { idx } from "@/lib/idx";
import { handleLead } from "@/lib/crm";
export const runtime = "nodejs";
export async function POST(request: Request): Promise<Response> {
return handleLead(request, "fub", {
env: process.env,
getListing: async (listingId) => {
const r = await idx.get(listingId);
return r.ok ? r.data : null;
},
});
}
Forms and your CRM
Your CRM explains the whole loop: your form, your route, your CRM, and what Ruuster picks up from a connected CRM. AI Nurture tags covers the alerts box, and Another CRM shows how to send to any other CRM from the same route.
Rules this page follows
MUST
- Start both consent boxes unchecked, and send
consent.contactandconsent.alertsexactly as the visitor left them. - Post to your own server route, and keep every CRM key on your server.
- Use your site's name as the lead source.
- Leave the street out of the CRM payload for a listing whose address is hidden (the CRM helpers do it).
NEVER
- Call a CRM from the browser.
- Put a form on results, area or sold pages: forms belong on listing pages, agent pages and your own sign-up page.
Test it
Open a listing page, fill in the tour form with your own name and an email address you can check, check the consent box and submit. The form shows your thank-you text. Find the new person in your CRM with the listing attached and your site's name as the source. Then submit once more with the consent box unchecked: the button stays off.
Build it with AI
Read RUUSTER_IDX.md first and follow its MUST and NEVER rules. Ask me if it doesn't cover something.
Send my site's leads to my CRM, following <https://help.ruuster.com/idx/recipe-forms> and the page for my CRM: <https://help.ruuster.com/idx/crm-follow-up-boss>, <https://help.ruuster.com/idx/crm-sierra> or <https://help.ruuster.com/idx/crm-sure-send>. My CRM is: [Follow Up Boss, Sierra Interactive or Sure Send]. Wire the TourForm, ContactForm and RegistrationForm components to my own server route, which validates the submission, drops it when the honeypot is filled, requires the contact consent box, and sends it with the @ruuster/idx/crm helpers. The consent box and the separate alerts box start unchecked. The lead source is SITE_NAME.
Use these environment variables: SITE_NAME, SITE_ORIGIN and my CRM's keys (FUB_API_KEY, FUB_SYSTEM, FUB_SYSTEM_KEY and FUB_COOKIE_SECRET for Follow Up Boss, SIERRA_API_KEY for Sierra Interactive, SURESEND_API_KEY for Sure Send). CRM keys stay on the server. Never paste a secret key or a CRM key into a chat, and never put one in browser code, a URL or a log.
Each route answers the form with a full sentence it can show, as the messages table on <https://help.ruuster.com/idx/crm-overview> does: 200 when sent, 403 from another site, 400 for a body it can't read, 422 for a missing contact or consent, 429 with Retry-After when the CRM asks to wait, 500 when a key or SITE_NAME is missing, and 502 when the CRM refuses. For Follow Up Boss, also build the listing-view route (POST /api/activity/fub with the ReportListingView component on the listing page), which sends one Viewed Property per registered visitor, listing and day. For Sierra Interactive and Sure Send there is no listing-view route.
When you are done, walk me through sending one test lead from a listing page and finding it in my CRM.On a site without React, such as PHP, Python, Ruby on Rails, Go or plain HTML, Build without React: HTML, CSS and JavaScript gives you the same markup, the stylesheet and the script for every widget.