Skip to main content

Webhook Domain (external sources)

The Lead domain consumes normalized events published by the Webhook Domain — the central webhook reception and normalization service for the platform. The Webhook Domain receives webhooks from external platforms (Hotmart, Stripe, Typeform, etc.), validates authenticity, normalizes the payload, and publishes an EventNormalized to the message broker. Multiple domains consume this event; the Lead domain is one of them.

Minimum contract expected by the Lead domain

When an event involves a lead, the Lead domain expects event.data to contain a lead object with identity resolution data:
{
  "metadata": {
    "eventId": "string (UUID v7, idempotency key)",
    "organizationId": "string (UUID)",
    "timestamp": "string (ISO 8601)",
    "correlationId": "string (UUID)"
  },
  "source": {
    "sourceType": "string (CHECKOUT, FORM, MEMBERS_AREA, MEETING, etc.)",
    "source": "string (hotmart, stripe, typeform, etc.)"
  },
  "event": {
    "key": "string (purchase_completed, form_submitted, etc.)",
    "data": {
      "lead": {
        "phoneNumber": "string? (E.164)",
        "email": "string?",
        "name": "string?",
        "channel": "string (whatsapp, web, instagram, etc.)",
        "channelIdentifier": "string (phone number, email, cookie id, etc.)"
      }
    }
  }
}
event.data.lead.channel + event.data.lead.channelIdentifier are used for identity resolution via ChannelIdentity. The rest of event.data (amount, productName, formResponses, etc.) is event-type-specific — the Event Ingester and Memory Updater know how to interpret it. The Webhook Domain is also consumed by other domains that extract their own data from event.data. The lead object is a convention for events that involve a lead.

Internal service signals

In addition to the Webhook Domain (external webhooks), the Lead domain receives signals from internal services via SNS/SQS:
ServiceSignal examples
Messagingconversation_started, conversation_ended, interest_detected, sentiment_detected, campaign_delivered, campaign_engaged, campaign_ignored
AI Agentsagent_insight
These services publish to their own SNS topics. The Lead domain has an SQS subscription with message filtering to receive only relevant event types.