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):
{
"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" }
}| Field | Meaning |
|---|---|
event_type | <area>.<thing>.<verb>.v<N>. It must exist in the catalog, and unknown types are rejected. |
producer | The only module allowed to emit this type. This is enforced in code. |
actor_type | consumer, operator, system or provider. |
occurred_at / received_at | Server-side time. received_at is added by the server. Client clocks are never trusted for ordering. |
correlation_id | The request ID that caused it. Use it with support. |
data | Opaque 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
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_idwith 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
deadand 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 telemetry | Server-authoritative | |
|---|---|---|
| Sent by | Your app, through POST /v1/analytics/events | AppCore modules only |
| Examples | product.screen_viewed.v1, product.paywall_viewed.v1 | commerce.purchase.verified.v1, entitlements.*, finance.*, identity.* |
| Can change money, access or identity | Never | Yes |
| Trust | Untrusted. Validated, deduplicated, bucketed by server receipt time | Produced 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:
| Type | Required properties | Optional properties |
|---|---|---|
product.app_opened.v1 | — | — |
product.screen_viewed.v1 | screen | — |
product.lesson_started.v1 | lesson_id | — |
product.lesson_completed.v1 | lesson_id | duration_ms, score (0–100) |
product.question_answered.v1 | question_id | lesson_id, correct (boolean) |
product.paywall_viewed.v1 | paywall_id | placement |
product.purchase_ui_cancelled.v1 | product_id | store (app_store, google_play, web) |
product.notification_opened.v1 | — | intent_id, campaign_id |
product.config_exposed.v1 | experiment_id, variant_id | release_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.
| Event | Producer | Consumers | Meaning |
|---|---|---|---|
control.app.provisioned.v1 | control | connections | App resources passed structural checks. Provider readiness is separate. |
connections.status.changed.v1 | connections | control, messaging, identity, commerce | Redacted readiness change. It never contains credentials. |
identity.user.created.v1 | identity | analytics, engagement | New app-scoped user. Optional locale, timezone, platform, country when known. |
identity.guest.converted.v1 | identity | messaging, analytics, engagement | A guest installation is now bound to an account. Guest data moves once. |
identity.user.deletion_requested.v1 | identity | messaging, engagement, commerce, analytics | Starts deletion everywhere. Does not cancel store subscriptions. |
identity.session.revoked.v1 | identity | control | A session was revoked. |
identity.consent.changed.v1 | identity | messaging, engagement, analytics | Purpose, status, policy version, time. |
catalog.plan.published.v1 | catalog | commerce, entitlements | Immutable plan version published. |
commerce.purchase.verified.v1 | commerce | entitlements, analytics | Verified, normalized purchase (with amount when known). |
commerce.subscription.changed.v1 | commerce | entitlements, engagement, analytics | Current verified subscription state and period end. |
commerce.purchase.reversed.v1 | commerce | entitlements, analytics | Refund, revocation or chargeback, as a compensating record. |
finance.invoice.issued.v1 | finance | messaging, analytics | Merchant document issued (web sales with a legal issuer only). |
finance.reconciliation.completed.v1 | finance | analytics, control | Reconciliation run finished. |
entitlements.snapshot.changed.v1 | entitlements | messaging, analytics | A user's access changed. Refresh caches. |
entitlements.usage.captured.v1 | entitlements | analytics | Credits consumed (units, operation ID). |
messaging.intent.created.v1 | messaging | messaging | A message intent was committed. |
messaging.delivery.accepted.v1 | messaging | analytics, engagement | The provider accepted it. This does not mean it was displayed. |
messaging.delivery.failed.v1 | messaging | analytics, control | Normalized failure and whether it is retryable. |
engagement.campaign.published.v1 | engagement | messaging, analytics | Approved campaign version scheduled. |
engagement.journey.entered.v1 | engagement | analytics | Journey entry. Journeys are R2 and disabled, so this is not emitted today. |
config.release.published.v1 | engagement | control | New remote-config release. |
analytics.batch.accepted.v1 | analytics | analytics | Intake durably accepted (not yet aggregated). |
analytics.export.ready.v1 | analytics | control | A 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_idand keep it across retries. AppCore deduplicates by installation and event ID for 30 days. - Send
occurred_atfrom 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.
Related
- Consent and privacy: consent gates intake
- Limits, quotas and costs
- Flutter SDK
- API reference: analytics