Skip to main content

Event

Immutable signals that happened to the lead within an organization. Append-only.
Event
├── id                    UUID, PK
├── lead_organization_id  UUID, FK → LeadOrganization
├── source_type           ENUM (external, internal, direct)
├── source                VARCHAR(100) — source identifier
├── event_type            VARCHAR(100) — normalized event type
├── object_id             VARCHAR(255), nullable — internal system ID of the referenced object
├── object_id_ref         VARCHAR(255), nullable — external/provider ID of the referenced object
├── payload               JSONB — normalized and enriched data
├── raw_payload           JSONB, nullable — original untouched payload
├── external_event_id     VARCHAR(255), nullable — original ID for idempotency
├── occurred_at           TIMESTAMPTZ — when the fact happened
└── received_at           TIMESTAMPTZ — when the Lead Domain received it
Idempotency via partial UNIQUE on (source, external_event_id).

Sources

source_typesourceDescription
externalstripe, hotmart, shopify, typeformVia Webhook Domain
internalmessaging_serviceConversation and dispatch signals
internalai_agents_serviceAgent insights
directwhatsapp, web, instagramLead initiated interaction

Event Types

Categoryevent_typePayload
Purchasepurchase_completedproduct_id, product_name, category, amount, currency, payment_method
Purchasepurchase_abandonedproduct_ids, cart_value, stage_abandoned
Productproduct_viewedproduct_id, product_name, category
Productproduct_askedproduct_id, question, channel
Interestinterest_detectedcategory, product_id, confidence
Sentimentsentiment_detectedscore, label, context
Conversationconversation_startedchannel, context
Conversationconversation_endedchannel, duration_seconds, message_count, sentiment_score
Campaigncampaign_deliveredcampaign_id, campaign_name, product_id, channel
Campaigncampaign_engagedcampaign_id, engagement_type
Campaigncampaign_ignoredcampaign_id, days_since_delivery
Subscriptionsubscription_createdplan_id, plan_name, amount
Subscriptionsubscription_cancelledplan_id, reason
Formform_submittedform_id, form_name, responses[]
Discountdiscount_requestedcontext, product_id
Discountdiscount_accepteddiscount_percent, product_id
Agentagent_insightinsight_type, content, confidence
Objectionobjection_raisedtype, context, product_id