Skip to content
Concepts

Events

The AppCore event envelope, transactional outbox, at-least-once and unordered delivery, client telemetry vs server-authoritative events, and the event catalog.

On this page

AppCore modules (identity, commerce, entitlements, messaging, engagement, analytics) coordinate through domain events. A purchase being verified, a consent changing or an account deletion being requested is written as an event, and other modules react to it. Your app takes part in two ways:

  • it sends client telemetry (product events such as "screen viewed") to analytics; and
  • it sees the effects of server-authoritative events through APIs. For example, an entitlement snapshot changes after commerce.purchase.verified.v1.

Domain events are internal to your app's runtime. There is no outbound subscription that delivers them to your own backend in this release.

The envelope

Every domain event has the same shape (EventEnvelope):

JSON
{
  "event_id": "evt_…",
  "event_type": "commerce.purchase.verified.v1",
  "schema_version": "1.0.0",
  "scope": { "tenant_id": "ten_…", "app_id": "app_…", "environment_id": "production" },
  "occurred_at": "2026-11-30T10:00:00.000Z",
  "producer": "commerce",
  "actor_type": "consumer",
  "subject_id": "usr_…",
  "correlation_id": "…",
  "causation_id": null,
  "data": { "purchase_id": "pur_…", "user_id": "usr_…", "amount_minor": "49900", "currency": "INR", "amount_status": "provider_verified" }
}
FieldMeaning
event_type<area>.<thing>.<verb>.v<N>. It must exist in the catalog, and unknown types are rejected.
producerThe only module allowed to emit this type. This is enforced in code.
actor_typeconsumer, operator, system or provider.
occurred_at / received_atServer-side time. received_at is added by the server. Client clocks are never trusted for ordering.
correlation_idThe request ID that caused it. Use it with support.
dataOpaque references (IDs) plus the catalog's required fields. Private details are fetched from the owning module under authorization, not carried in the event.

An event ID is not an authorization token. Knowing one grants nothing.

How delivery works

Diagram (Mermaid source)
flowchart LR
  R["API request or webhook"] --> B["One atomic D1 batch:<br/>state change + outbox row"]
  B --> O[("event_outbox")]
  O -- "drained after the request<br/>and on the scheduled tick" --> C1["consumer A<br/>inbox keyed by event_id"]
  O --> C2["consumer B<br/>inbox keyed by event_id"]
  C1 -- "failure" --> X["retry with backoff<br/>→ dead after 10 attempts"]
  • Transactional outbox. The state change and its event commit in the same database batch. A purchase cannot be recorded without its event, and an event cannot exist without the purchase.
  • At-least-once. A consumer can see the same event more than once. Each consumer records (consumer, event_id) in its own inbox, and its handler's writes commit together with that record, so a duplicate does nothing.
  • Unordered. There is no ordering guarantee. Consumers re-read current facts or compare timestamps. For example, a refund arriving before its purchase grants nothing, and consent uses the newest recorded_at.
  • Tamper check. The same event_id with a different payload is quarantined (EVENT_DIGEST_MISMATCH), never applied.
  • Retries. A failed delivery backs off exponentially (5 s × 2ⁿ, capped at one hour). After 10 attempts the row is marked dead and is visible to operators.
  • When it runs. The outbox is drained right after each mutating request, and again on the runtime's scheduled tick.

Client events vs server-authoritative events

Client telemetryServer-authoritative
Sent byYour app, through POST /v1/analytics/eventsAppCore modules only
Examplesproduct.screen_viewed.v1, product.paywall_viewed.v1commerce.purchase.verified.v1, entitlements.*, finance.*, identity.*
Can change money, access or identityNeverYes
TrustUntrusted. Validated, deduplicated, bucketed by server receipt timeProduced after server verification

A client batch that names an authoritative type (commerce.*, finance.*, entitlements.*, identity.*) is rejected. Revenue reports are built only from server facts, so telemetry cannot inflate them.

Client event types

Client events (ClientEvent) carry event_id, event_type, occurred_at, installation_id and properties. The accepted types and their allowed properties are fixed by the analytics schema registry:

TypeRequired propertiesOptional properties
product.app_opened.v1——
product.screen_viewed.v1screen—
product.lesson_started.v1lesson_id—
product.lesson_completed.v1lesson_idduration_ms, score (0–100)
product.question_answered.v1question_idlesson_id, correct (boolean)
product.paywall_viewed.v1paywall_idplacement
product.purchase_ui_cancelled.v1product_idstore (app_store, google_play, web)
product.notification_opened.v1—intent_id, campaign_id
product.config_exposed.v1experiment_id, variant_idrelease_id

Identifier properties (screen, lesson_id, …) are short opaque IDs. Unknown properties, personal-looking field names, email addresses and long digit runs are rejected per event. Each rejection names its reason: unregistered_event, pii_field, pii_value, unknown_property, invalid_property, missing_property, event_too_large, clock_skew_future, too_old, consent_withdrawn or subject_erased. A rejected event is final, so do not retry it. Retry only a whole request that failed with 429 or 5xx. Size, batching and time-window limits are on Limits, quotas and costs.

Warning

Not yet enabled: registering your own product event types. The registry is fixed in this release, and any other type is rejected as unregistered_event.

The catalog

Each event lists its producer and the minimum data it must carry. Producers may add reviewed optional fields.

EventProducerConsumersMeaning
control.app.provisioned.v1controlconnectionsApp resources passed structural checks. Provider readiness is separate.
connections.status.changed.v1connectionscontrol, messaging, identity, commerceRedacted readiness change. It never contains credentials.
identity.user.created.v1identityanalytics, engagementNew app-scoped user. Optional locale, timezone, platform, country when known.
identity.guest.converted.v1identitymessaging, analytics, engagementA guest installation is now bound to an account. Guest data moves once.
identity.user.deletion_requested.v1identitymessaging, engagement, commerce, analyticsStarts deletion everywhere. Does not cancel store subscriptions.
identity.session.revoked.v1identitycontrolA session was revoked.
identity.consent.changed.v1identitymessaging, engagement, analyticsPurpose, status, policy version, time.
catalog.plan.published.v1catalogcommerce, entitlementsImmutable plan version published.
commerce.purchase.verified.v1commerceentitlements, analyticsVerified, normalized purchase (with amount when known).
commerce.subscription.changed.v1commerceentitlements, engagement, analyticsCurrent verified subscription state and period end.
commerce.purchase.reversed.v1commerceentitlements, analyticsRefund, revocation or chargeback, as a compensating record.
finance.invoice.issued.v1financemessaging, analyticsMerchant document issued (web sales with a legal issuer only).
finance.reconciliation.completed.v1financeanalytics, controlReconciliation run finished.
entitlements.snapshot.changed.v1entitlementsmessaging, analyticsA user's access changed. Refresh caches.
entitlements.usage.captured.v1entitlementsanalyticsCredits consumed (units, operation ID).
messaging.intent.created.v1messagingmessagingA message intent was committed.
messaging.delivery.accepted.v1messaginganalytics, engagementThe provider accepted it. This does not mean it was displayed.
messaging.delivery.failed.v1messaginganalytics, controlNormalized failure and whether it is retryable.
engagement.campaign.published.v1engagementmessaging, analyticsApproved campaign version scheduled.
engagement.journey.entered.v1engagementanalyticsJourney entry. Journeys are R2 and disabled, so this is not emitted today.
config.release.published.v1engagementcontrolNew remote-config release.
analytics.batch.accepted.v1analyticsanalyticsIntake durably accepted (not yet aggregated).
analytics.export.ready.v1analyticscontrolA scoped export is ready. Downloading it is authorized separately.

The machine-readable catalog is packages/contracts/event-catalog.json. See also the API reference.

What this means for your app

  • Give every client event a unique event_id and keep it across retries. AppCore deduplicates by installation and event ID for 30 days.
  • Send occurred_at from the device, but expect reports to bucket by server receipt time.
  • Never use telemetry to unlock anything. Use the entitlement snapshot.
  • Expect effects to be eventually consistent and possibly duplicated. For example, an inbox item or a campaign push can follow a purchase a moment later. Design UIs to refresh, not to count on exact ordering.
  • Keep personal data out of event properties. It will be rejected.