Webhook
The Webhook integration sends each lead your chat and form widgets capture to a URL you choose, as a JSON POST. Use it with Zapier Catch Hooks, Make, n8n, a CRM's inbound webhook or your own endpoint.
When it fires
The webhook fires once per lead, after XAPP AI has analyzed the lead: usually a few seconds after the visitor submits, not at the moment they click submit. That wait is what lets the payload carry the AI analysis (urgency, job type, summary and so on). If you are building a speed-to-lead automation, allow for those few seconds.
Partial leads, where the visitor didn't finish, are not sent.
Every request is:
POSTto your endpoint URLContent-Type: application/json, plus any headers you add when you connect
Set it up
- In Studio, open the app (location) and go to Integrations.
- Click Add Integration and choose Webhook. The Webhook Setup dialog opens.
- Enter the Webhook Endpoint URL. It must start with
http://orhttps://; usehttps://, because the payload carries the customer's contact details and your headers may carry a token. - Optional: pick a Service (Optional). Set this only when the webhook feeds a platform that you also identify the location by, such as a field service platform with an account or location id. When the service matches the one on the app or on the lead's location, that id is sent as
reference_id(referenceIdin the nested payload). - Optional: add HTTP Headers (Optional, JSON format) as a JSON object, for example
{"Authorization": "Bearer your-token"}. Saved headers are never shown again; when you edit the webhook later, leave the box empty to keep them. - Optional: tick Send simplified (flat) payload to receive the flat payload instead of the nested one. The dialog shows a short example when it's ticked.
- Click Connect.
Your plan must include integrations. Contact support if Webhook isn't offered when you add an integration.
To change a webhook later, open its card on the Integrations page, edit it and click Save. Disconnect removes it.
Turning Send simplified (flat) payload on or off changes the shape of everything the webhook sends. If an automation already reads the nested payload, leave it off, or add a second webhook for the new automation.
Missed leads? If your endpoint was down or rejected requests, contact support with the time range. We can resend leads to the webhook.
More than one webhook
An app can send its leads to more than one webhook, for example one to your CRM and one to a reporting sheet.
- Each webhook gets every lead. There is no routing between them; each one receives its own copy of each lead.
- Each webhook has its own endpoint, service, headers and payload shape, so one can send the nested payload and another the flat one.
- Each webhook has its own card on the Integrations page, labelled with its service, or with the endpoint's host name when it has no service. Edit or disconnect a webhook from its own card.
To add another webhook, click Add Integration on the Integrations page, choose Webhook again and connect it as above.
Two payload shapes
| Nested (default) | Flat | |
|---|---|---|
| Depth | Two or three levels, with arrays | One level |
| Key style | camelCase | snake_case |
| Contact fields | As the form captured them | Always first_name, last_name, full_name, email, phone, address, zip, company |
| Missing values | Key left out | Key present, null |
| Transcript | Array of messages | Plain text |
The flat payload is easier to map in most webhook tools, because every key is at the top level and the same keys arrive on every lead. Send one test lead and you'll see the complete key set.
Flat payload
Every key in the tables below is always present and is null when unknown. Keys starting custom_ or extra_ are added on top and vary by app.
Envelope
| Key | What it holds |
|---|---|
lead_id | The lead's id, a UUID |
captured_at | When the lead was captured, ISO 8601 |
environment | production or staging |
app_id | The app (location) id |
organization_id | The organization id |
reference_id | Your platform's id for the location, when the webhook's Service matches the one set on the app or the lead's location |
Contact
These are worked out for you, not copied as-is. See Default field mappings.
| Key | What it holds |
|---|---|
first_name | First name |
last_name | Last name |
full_name | Full name |
email | Email address |
phone | Phone number |
address | Street address |
zip | ZIP or postal code |
company | Company or organization name |
Lead context
| Key | What it holds |
|---|---|
source | The channel the lead came from, such as form-widget or chat-widget |
session_id | The visitor's session id |
user_id | The visitor's user id, when known |
place_id | The Google Place ID of the location, for businesses with several locations |
is_abandoned | true when the visitor left before finishing and the lead was captured from what they had entered |
message | The free-text message or note field |
transcript_text | The chat transcript as plain text, one line per message, each starting Bot: or Visitor:. null for form leads |
AI analysis
| Key | What it holds |
|---|---|
urgency | How urgent the request is, for example HIGH |
contact_type | What kind of contact it is, for example SERVICE_REQUEST |
service_type | The kind of service, for example REPAIR |
job_type | The job, in words, for example AC Repair |
high_value_lead | true when the lead matches your high-value lead description |
summary | A summary of the request |
concise_summary | A few-word summary |
service_address | The address the work is at |
service_zip_code | The ZIP code the work is at |
service_distance | Distance from the business to the service address |
form_message | The message from the form |
form_help_type | Which kind of form request it is: contact_us, schedule_now or get_custom_quote |
preferred_day | The day the customer asked for, as a date (YYYY-MM-DD) |
preferred_day_raw | The day as the customer gave it, for example tomorrow |
preferred_time_raw | The time as the customer saw it, for example morning or 9:30 AM |
preferred_time_start | Start of the preferred time, 24-hour HH:MM |
preferred_time_end | End of the preferred time, 24-hour HH:MM. null for a single time slot |
referring_source | Where the visitor came from, for example google |
Only want one kind of submission? A webhook receives every lead for the app. To route only booking requests somewhere, add a filter in your webhook tool on form_help_type equal to schedule_now (or contact_us, or get_custom_quote).
Lead origin
Where the lead came from and how it was captured. The values are explained on Lead Origin.
| Key | What it holds |
|---|---|
contact_method | How the person got in touch: chat, form, phone, email, sms or other |
agent_type | Who handled it: ai, human, self_serve or unknown |
source_system | The system that captured the lead, for example xapp-ai or partner |
capture_surface | The exact place it was captured, for example form-widget, chat-widget or mcp |
capture_platform | The platform it was captured on, for example xapp-ai |
Attribution
| Key | What it holds |
|---|---|
utm_source, utm_medium, utm_campaign, utm_term, utm_content | The page's UTM tags. utm_source, utm_medium and utm_campaign are also read from the landing page's address when the visitor's browser didn't pass them |
landing_page | The page the visitor arrived on |
referrer | The page the visitor came from |
gclid, gbraid, wbraid | Google Ads click ids |
msclkid | Microsoft Ads click id |
fbclid | Meta click id |
rwg_token | Reserve with Google token, for bookings from your Google Business Profile |
custom_ and extra_ keys
- A form field that isn't one of the contact fields above arrives as
custom_<name>. A field namedGate code,gateCodeorgate-codearrives ascustom_gate_code. - Any other tracking value the widget passed along arrives as
extra_<name>, named the same way.
The prefix also means a form field can never overwrite a standard key: a form field called urgency arrives as custom_urgency, and urgency keeps the AI's value.
Values that are not text, numbers or true/false are sent as a JSON string, so the payload stays one level deep.
Default field mappings
The flat payload fills the contact keys the same way whatever the form asked for, so a mapping you set up once works for every form.
- Names.
first_name,last_nameandfull_nameare always filled when the lead has a name. A form that asks for a full name has it split: the first word is the first name and the rest is the last name, soJane van der BerggivesJaneandvan der Berg. A form that asks for first and last names has them joined intofull_name. - Other fields are read from whichever of these names the form field has (upper or lower case):
| Key | Form field names it reads |
|---|---|
email | email, emailaddress, email_address |
phone | phone, phonenumber, phone_number |
address | address, address1, address2, street_address |
zip | zip, zipcode, zip_code, postalcode, postal_code |
company | company, organization, companyname, company_name, organizationname, organization_name |
message | message, note |
A field read into one of these keys isn't repeated as a custom_ key.
Flat example
{
"lead_id": "3f7c1e88-2b1a-4c55-9d0e-7a6b5c4d3e21",
"captured_at": "2026-08-12T14:03:11.000Z",
"environment": "production",
"app_id": "app-123",
"organization_id": "org-456",
"reference_id": null,
"first_name": "Jane",
"last_name": "Doe",
"full_name": "Jane Doe",
"email": "jane@example.com",
"phone": "5555550123",
"address": "123 Main St",
"zip": "84043",
"company": null,
"source": "form-widget",
"session_id": "sess-789",
"user_id": null,
"place_id": null,
"is_abandoned": false,
"message": "AC is out, need someone today",
"transcript_text": null,
"urgency": "HIGH",
"contact_type": "SERVICE_REQUEST",
"service_type": "REPAIR",
"job_type": "AC Repair",
"high_value_lead": true,
"summary": "Homeowner reports the AC stopped cooling overnight and wants someone out today.",
"concise_summary": "AC not cooling",
"service_address": "123 Main St",
"service_zip_code": "84043",
"service_distance": 4.2,
"form_message": "AC is out, need someone today",
"form_help_type": "schedule_now",
"preferred_day": "2026-08-14",
"preferred_day_raw": "tomorrow",
"preferred_time_raw": "morning",
"preferred_time_start": "08:00",
"preferred_time_end": "12:00",
"referring_source": "google",
"contact_method": "form",
"agent_type": "self_serve",
"source_system": "xapp-ai",
"capture_surface": "form-widget",
"capture_platform": "xapp-ai",
"utm_source": "google",
"utm_medium": "cpc",
"utm_campaign": "summer-ac",
"utm_term": null,
"utm_content": null,
"landing_page": "https://example.com/ac-repair",
"referrer": "https://www.google.com/",
"gclid": null,
"gbraid": null,
"wbraid": null,
"msclkid": null,
"fbclid": null,
"rwg_token": null,
"custom_gate_code": "1234"
}
Nested payload
The nested payload is the default, and what every webhook connected before the flat option existed still receives.
| Key | What it holds |
|---|---|
appId, organizationId | The app (location) and organization ids |
referenceId | Your platform's id for the location, when the webhook's Service matches. Left out otherwise |
advertiserId | The same value as referenceId |
contactType | The AI's contact type, also inside aiAnalysis |
isoDate | When the lead was captured, ISO 8601 |
environment | production or staging |
lead | The lead as captured: source, sessionId, fields (an array of { "name", "value" }), transcript (an array of messages) and more |
lead.__fields | The same fields as one object, keys in camelCase, which is easier to map than the array |
extras | The tracking values the widget passed along, such as UTM tags |
aiAnalysis | The AI analysis, with the same values as the flat AI analysis keys in camelCase (formHelpType, jobType, ...). Left out when the lead wasn't analyzed |
taxonomy | The lead origin fields that have a value: contactMethod, agentType, sourceSystem, captureSurface, capturePlatform, utmSource, utmMedium, utmCampaign. Left out when the lead has none |
Keys without a value are left out rather than sent as null.
Nested example
{
"appId": "app-123",
"organizationId": "org-456",
"referenceId": "ST-123",
"advertiserId": "ST-123",
"contactType": "SERVICE_REQUEST",
"isoDate": "2026-08-12T14:03:11.000Z",
"environment": "production",
"lead": {
"source": "form-widget",
"sessionId": "sess-789",
"fields": [
{ "name": "FULL_NAME", "value": "Jane Doe" },
{ "name": "EMAIL", "value": "jane@example.com" },
{ "name": "PHONE", "value": "5555550123" }
],
"transcript": [],
"__fields": {
"fullName": "Jane Doe",
"email": "jane@example.com",
"phone": "5555550123"
}
},
"extras": {
"utm_source": "google",
"utm_medium": "cpc",
"utm_campaign": "summer-ac",
"landing_page": "https://example.com/ac-repair"
},
"aiAnalysis": {
"urgency": "HIGH",
"contactType": "SERVICE_REQUEST",
"serviceType": "REPAIR",
"jobType": "AC Repair",
"highValueLead": true,
"conciseSummary": "AC not cooling",
"formHelpType": "schedule_now",
"preferredDay": "2026-08-14",
"preferredTimeRaw": "morning",
"preferredTimeStart": "08:00",
"preferredTimeEnd": "12:00",
"referringSource": "google"
},
"taxonomy": {
"contactMethod": "form",
"agentType": "self_serve",
"sourceSystem": "xapp-ai",
"captureSurface": "form-widget",
"capturePlatform": "xapp-ai",
"utmSource": "google",
"utmMedium": "cpc",
"utmCampaign": "summer-ac"
}
}