Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.digifist.com/llms.txt

Use this file to discover all available pages before exploring further.

Domain events are the internal communication layer between Galantis’s webhook handlers and the rest of the application. When a Shopify webhook is received and processed by a handler job, the job fires one or more domain events. Other parts of the system — automation triggers, segment re-evaluation, real-time broadcasting — subscribe to these events and react accordingly. This decoupled architecture means webhook handlers do not need to know about automation logic, and automation logic does not need to know about webhook format. Each layer communicates through typed events with well-defined payloads.

What this covers

  • Shopify-triggered domain events and what fires them
  • Automation trigger events and how they map to domain events
  • Broadcast events for real-time dashboard updates
  • How listeners subscribe to events

Shopify-triggered domain events

These events are fired by Shopify webhook handler jobs after processing the incoming payload. Each event carries the relevant entity data needed by downstream listeners.

Customer events

EventFired byPayload
CustomerCreatedProcessShopifyCustomerCreatedJobNew customer record data
CustomerUpdatedProcessShopifyCustomerUpdatedJobUpdated customer record with changed fields
CustomerDeletedProcessShopifyCustomerDeletedJobCustomer ID
CustomerMarketingConsentUpdatedProcessShopifyCustomerMarketingConsentUpdatedJobCustomer ID and new marketing_state
CustomerTagsAddedProcessShopifyCustomerTagsAddedJobCustomer ID and array of added tags
CustomerTagsRemovedProcessShopifyCustomerTagsRemovedJobCustomer ID and array of removed tags
Listeners: CustomerCreated → Automation trigger evaluation for CUSTOMER_CREATED CustomerUpdated → Segment rule re-evaluation for the updated customer; marketing_state propagation if consent changed CustomerMarketingConsentUpdatedmarketing_state update on the contact record; re-evaluation of any pending automation enrollments CustomerTagsAdded → Automation trigger evaluation for CUSTOMER_TAGGED (if a specific watched tag was added); segment rule re-evaluation for tag-based rules

Order events

EventFired byPayload
OrderCreatedProcessShopifyOrderCreatedJobFull order data including line items, customer reference, and totals
OrderCancelledProcessShopifyOrderCancelledJobOrder data with cancellation reason
OrderShippedProcessShopifyOrderShippedJobOrder data with fulfillment details including tracking information
Listeners: OrderCreated → Automation trigger evaluation for ORDER_PLACED; customer purchase history update for segment re-evaluation OrderCancelled → Automation trigger evaluation for ORDER_CANCELLED OrderShipped → Automation trigger evaluation for ORDER_SHIPPED

Product events

EventFired byPayload
ProductCreatedProcessShopifyProductCreatedJobFull product data including variants
ProductUpdatedProcessShopifyProductUpdatedJobUpdated product data; includes inventory change data for Back-in-Stock detection
ProductDeletedProcessShopifyProductDeletedJobProduct ID
CollectionUpdatedProcessShopifyCollectionUpdatedJobCollection data with product membership changes
Listeners: ProductUpdated → Back-in-Stock restock detection (inventory 0→>0 check); Meta catalog sync queue (SyncMetaCatalogJob); segment re-evaluation for collection/product-based rules CollectionUpdated → Segment rule re-evaluation for Purchased collection conditions

Automation trigger events

Automation trigger events are a distinct layer above the Shopify domain events. They represent the business-level trigger conditions that automations subscribe to, rather than the raw Shopify data changes. Some automation triggers map directly to a single domain event. Others require evaluation logic before the trigger event fires.
Automation trigger eventSourceTrigger condition
UserAddedToListTriggerGalantis list managementCustomer manually or programmatically added to a specific list
UserAddedToSegmentTriggerSegment evaluationCustomer newly matches a segment’s rules (membership transition)
AbandonedCheckoutTriggerPolling jobIncomplete checkout detected for a customer via 10-minute poll
BackInStockTriggerProductUpdated eventinventory_quantity changed from 0 to >0 on a variant with active subscribers
The remaining automation triggers — ORDER_PLACED, ORDER_CANCELLED, ORDER_SHIPPED, CUSTOMER_CREATED, CUSTOMER_TAGGED — map directly to their corresponding Shopify domain events (OrderCreated, OrderCancelled, OrderShipped, CustomerCreated, CustomerTagsAdded). The automation engine listens to these domain events and evaluates trigger conditions for any active automations using those trigger types.

Trigger event processing

When an automation trigger event fires for a customer:
  1. The automation engine identifies all active automations with a matching trigger type
  2. For each matching automation, eligibility checks run:
    • Consent check: marketing_state = SUBSCRIBED?
    • Frequency cap check: within the configured cap window?
    • Exclusion rule check: member of any excluded list or segment?
  3. Eligible customers are enrolled — a new AutomationActivity execution context is created
  4. The first node in the flow executes (Delay, Condition, or Action)

Broadcast events

Broadcast events are real-time events pushed to connected merchant dashboard clients via Laravel Reverb WebSocket connections. They enable live updates in the Inbox without polling.
EventTriggerWhat it updates
ConversationMessageCreatedNew inbound message received from Meta webhookInbox — new message appears in the conversation thread immediately
ConversationMessageCreated is fired after:
  1. The inbound message Meta webhook is received and validated
  2. A Conversation and Message record are created
  3. Laravel Reverb broadcasts the event to the merchant’s active dashboard WebSocket connection
  4. The Inbox React component receives the broadcast and updates the conversation thread without a page refresh

Event listener architecture

Domain events in Galantis follow Laravel’s event and listener pattern. Events are dispatched synchronously from handler jobs after the primary record operation completes. Listeners are registered in the application’s EventServiceProvider and execute in the order they are registered. For operations that could be slow — such as triggering segment re-evaluation for a customer whose data just changed — listeners dispatch new queue jobs rather than performing the work synchronously. This keeps event dispatch fast and moves expensive downstream processing to the queue layer. The event → listener → queue pattern means:
Webhook received
  → Handler job (queue)
  → Record updated
  → Domain event fired (synchronous)
  → Listeners run
    → Fast operations run inline (e.g., flag update on record)
    → Slow operations dispatch queue jobs (e.g., segment re-evaluation, automation trigger)
  → Automation trigger job (queue)
  → Customer eligibility checks
  → Enrollment and first node execution