# Inquiry forms

`ListingInquiryForm` puts an "Ask about this home" form on a listing page. It's a Sonor managed form with the listing filled in, so every lead lands in the CRM attached to the property that brought it in, and your analytics record a `listing_inquiry` conversion.

```tsx
import { ListingInquiryForm } from '@sonordev/re-site-kit/client'
```

It's built on site-kit's `ManagedForm`, so submissions get the same spam protection, routing and CRM attribution as every other form on the site. Always submit through it: a hand-written POST to Sonor's forms endpoint, or a proxy through your own API route, isn't supported and loses leads. See [site-kit's Forms docs](https://sonor.dev/site-kit/forms) for everything `ManagedForm` does.

## Set up the form in Sonor

Once per project, in the Sonor dashboard:

1. **Create a managed form** with the type `prospect`, which routes submissions into the CRM. Its slug is what you'll pass as `formId`, for example `listing-inquiry`.
2. **Add the fields people fill in**, such as first name, last name, email, phone and a message.
3. **Add three hidden fields** with these exact slugs:

| Hidden field slug | Filled with                                    |
| ----------------- | ---------------------------------------------- |
| `listing_slug`    | The listing's `slug`                           |
| `listing_key`     | The listing's MLS number (`source_listing_id`) |
| `listing_address` | The listing's street `address`                 |

The component fills the hidden fields on every render. A form without them still submits; the lead just arrives without the listing attached.

## Put it on the page

```tsx
<ListingInquiryForm
  formId="listing-inquiry"
  listing={{
    slug: listing.slug,
    source_listing_id: listing.source_listing_id,
    address: listing.address,
    price: listing.price,
  }}
/>
```

| Prop         | Type                                                                                                          | What it does                                                                                                                                               |
| ------------ | ------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `formId`     | `string`                                                                                                      | The managed form's slug in Sonor. Required.                                                                                                                |
| `listing`    | `Pick<RealEstateListing, 'slug' \| 'source_listing_id' \| 'address' \| 'price'> & Partial<RealEstateListing>` | The listing being asked about. `slug`, `source_listing_id`, `address` and `price` are required; any other listing fields are allowed but unused. Required. |
| `experience` | `'classic' \| 'stage' \| 'spotlight'`                                                                         | The form's layout, passed to `ManagedForm`. Leave it out for site-kit's default.                                                                           |
| `className`  | `string`                                                                                                      | Added next to `re-inquiry-form` on the wrapping `<div>`.                                                                                                   |
| `onSuccess`  | `() => void`                                                                                                  | Called after a successful submission, right after the conversion event is sent.                                                                            |

**Pass only the fields it needs.** `ListingInquiryForm` is a client component, so whatever you pass as `listing` is sent to the browser with the page. Passing the whole listing ships its description, photos and every other field a second time. The four fields above are all it reads.

## What happens on submit

1. `ManagedForm` submits the visitor's answers plus the three hidden fields.
2. Sonor files the lead in the CRM with the listing attached.
3. On success, the component records a `listing_inquiry` conversion through site-kit analytics, with the listing's price as its `value` (when there's one) and `listing_slug`, `listing_key` and `listing_address` as metadata. If recording the conversion fails, it's skipped quietly; the lead has already been submitted.
4. Your `onSuccess` runs.

Conversions need site-kit analytics on the page, which `SiteKitLayout` provides. If analytics loads later than the form, the conversion waits for it.

## Showing requests from AI assistants

A buyer's AI assistant can also ask for a showing through the kit's MCP tools. Those requests land on a managed form too: the one with **Showing Requests** turned on. If you already have a listing inquiry form, that's usually the right one to turn it on for. See [MCP tools](https://sonor.dev/re-site-kit/mcp#request_showing).
