Skip to main content

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:

  • POST to your endpoint URL
  • Content-Type: application/json, plus any headers you add when you connect

Set it up​

  1. In Studio, open the app (location) and go to Integrations.
  2. Click Add Integration and choose Webhook. The Webhook Setup dialog opens.
  3. Enter the Webhook Endpoint URL. It must start with http:// or https://; use https://, because the payload carries the customer's contact details and your headers may carry a token.
  4. 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 (referenceId in the nested payload).
  5. 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.
  6. 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.
  7. 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.

Switching payload shape

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
DepthTwo or three levels, with arraysOne level
Key stylecamelCasesnake_case
Contact fieldsAs the form captured themAlways first_name, last_name, full_name, email, phone, address, zip, company
Missing valuesKey left outKey present, null
TranscriptArray of messagesPlain 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​

KeyWhat it holds
lead_idThe lead's id, a UUID
captured_atWhen the lead was captured, ISO 8601
environmentproduction or staging
app_idThe app (location) id
organization_idThe organization id
reference_idYour 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.

KeyWhat it holds
first_nameFirst name
last_nameLast name
full_nameFull name
emailEmail address
phonePhone number
addressStreet address
zipZIP or postal code
companyCompany or organization name

Lead context​

KeyWhat it holds
sourceThe channel the lead came from, such as form-widget or chat-widget
session_idThe visitor's session id
user_idThe visitor's user id, when known
place_idThe Google Place ID of the location, for businesses with several locations
is_abandonedtrue when the visitor left before finishing and the lead was captured from what they had entered
messageThe free-text message or note field
transcript_textThe chat transcript as plain text, one line per message, each starting Bot: or Visitor:. null for form leads

AI analysis​

KeyWhat it holds
urgencyHow urgent the request is, for example HIGH
contact_typeWhat kind of contact it is, for example SERVICE_REQUEST
service_typeThe kind of service, for example REPAIR
job_typeThe job, in words, for example AC Repair
high_value_leadtrue when the lead matches your high-value lead description
summaryA summary of the request
concise_summaryA few-word summary
service_addressThe address the work is at
service_zip_codeThe ZIP code the work is at
service_distanceDistance from the business to the service address
form_messageThe message from the form
form_help_typeWhich kind of form request it is: contact_us, schedule_now or get_custom_quote
preferred_dayThe day the customer asked for, as a date (YYYY-MM-DD)
preferred_day_rawThe day as the customer gave it, for example tomorrow
preferred_time_rawThe time as the customer saw it, for example morning or 9:30 AM
preferred_time_startStart of the preferred time, 24-hour HH:MM
preferred_time_endEnd of the preferred time, 24-hour HH:MM. null for a single time slot
referring_sourceWhere 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.

KeyWhat it holds
contact_methodHow the person got in touch: chat, form, phone, email, sms or other
agent_typeWho handled it: ai, human, self_serve or unknown
source_systemThe system that captured the lead, for example xapp-ai or partner
capture_surfaceThe exact place it was captured, for example form-widget, chat-widget or mcp
capture_platformThe platform it was captured on, for example xapp-ai

Attribution​

KeyWhat it holds
utm_source, utm_medium, utm_campaign, utm_term, utm_contentThe 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_pageThe page the visitor arrived on
referrerThe page the visitor came from
gclid, gbraid, wbraidGoogle Ads click ids
msclkidMicrosoft Ads click id
fbclidMeta click id
rwg_tokenReserve 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 named Gate code, gateCode or gate-code arrives as custom_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_name and full_name are 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, so Jane van der Berg gives Jane and van der Berg. A form that asks for first and last names has them joined into full_name.
  • Other fields are read from whichever of these names the form field has (upper or lower case):
KeyForm field names it reads
emailemail, emailaddress, email_address
phonephone, phonenumber, phone_number
addressaddress, address1, address2, street_address
zipzip, zipcode, zip_code, postalcode, postal_code
companycompany, organization, companyname, company_name, organizationname, organization_name
messagemessage, 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.

KeyWhat it holds
appId, organizationIdThe app (location) and organization ids
referenceIdYour platform's id for the location, when the webhook's Service matches. Left out otherwise
advertiserIdThe same value as referenceId
contactTypeThe AI's contact type, also inside aiAnalysis
isoDateWhen the lead was captured, ISO 8601
environmentproduction or staging
leadThe lead as captured: source, sessionId, fields (an array of { "name", "value" }), transcript (an array of messages) and more
lead.__fieldsThe same fields as one object, keys in camelCase, which is easier to map than the array
extrasThe tracking values the widget passed along, such as UTM tags
aiAnalysisThe AI analysis, with the same values as the flat AI analysis keys in camelCase (formHelpType, jobType, ...). Left out when the lead wasn't analyzed
taxonomyThe 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"
}
}