Skip to main content
TrailsparkDocs

Webhook Payload Format

Basic Structure

json
{
  "email": "lead@example.com",
  "event": "event_name",
  "properties": {
    "key": "value"
  }
}

Field Reference

No single field is strictly required for the webhook to accept a payload. However, for a signal to be processed into a lead, at least one persistent identifier must be present.

Identifying Fields

At least one of these should be present for the signal to create or match a lead:

FieldTypeDescription
emailstringLead's email address. Primary identifier for matching signals to leads. Case-insensitive. Can appear at top level, in traits, properties, or context.traits
userIdstringYour internal user identifier (product user ID)
anonymousIdstringAnonymous visitor identifier (for identity resolution). Not sufficient alone to create a lead, but enables cold storage rehydration when later identified
FieldTypeDescription
eventstringEvent name (e.g., form_submission, page_view, demo_request)
typestringSegment event type (track, page, identify). Used for source auto-detection
propertiesobjectEvent-specific data

Optional

FieldTypeDescription
timestampstringISO 8601 timestamp (e.g., 2024-01-15T14:30:00Z). Defaults to receipt time if omitted
sourcestringSystem that generated the signal (overrides auto-detection)
traitsobjectUser traits (common in Segment identify calls)
contextobjectContextual metadata (page info, device, etc.)

Payload Examples

Form Submission

json
{
  "email": "prospect@company.com",
  "event": "form_submission",
  "timestamp": "2024-01-15T11:15:00Z",
  "properties": {
    "form_name": "Request Demo",
    "form_id": "demo-form-main",
    "page_url": "https://yoursite.com/demo",
    "company": "TechCorp",
    "company_size": "100-500",
    "job_title": "Marketing Director"
  }
}

Page View

json
{
  "email": "visitor@example.com",
  "event": "page_view",
  "properties": {
    "page_url": "https://yoursite.com/pricing",
    "page_title": "Pricing - Your Product",
    "referrer": "https://google.com",
    "time_on_page": 45
  }
}

Product Trial Signup

json
{
  "email": "newuser@startup.io",
  "event": "trial_started",
  "properties": {
    "plan": "pro_trial",
    "trial_length_days": 14,
    "signup_source": "website",
    "company": "StartupIO"
  }
}

How Properties Map to Signal Rules

Signal mapping rules can access any field using dot notation:

Example ConditionMatches
event equals demo_requestSignals with event "demo_request"
properties.company_size equals EnterpriseEnterprise company signals
properties.page_url contains /pricingPricing page activity

Design your payload structure with your signal mapping rules in mind. Consistent field names across sources simplify rule creation.

Validation

RuleRequirement
JSONValid JSON syntax
Content-TypeMust be application/json
EncodingUTF-8

The universal webhook is lenient with payload structure. If payload standardization fails, the raw payload is stored as-is with event type defaulting to the type or event field, or "universal" if neither is present.

Next Steps