Overview
Your app runs in a sandboxed iframe with no access to Elata’s cookies, backend, or the user’s wallet. When it needs something from the platform, such as a purchase, saved data, or consent, it sends apostMessage to the parent
frame. Elata does the work with the user’s session and replies.
Your app never sees who the user is. It only gets the answers it needs.
Use the SDK packages
For most features there’s a small package that wraps the messages, timeouts, and errors for you:
Consent, insights, notifications, navigation, and feedback use plain
postMessage calls. They’re documented below and on their own pages.
Ground rules
- Send to the parent. Post to
window.parent. Using'*'as the target origin is fine: Elata checks that the message came from your app’s frame and origin. - Use a
requestId. Where a reply is expected, include a uniquerequestId(8 to 128 characters;crypto.randomUUID()works) and match it on the reply. - Handle no reply. Outside Elata (for example in local development) nobody answers. Use a timeout and degrade gracefully. The SDK packages do this for you.
- Elata is the source of truth. Prices, ownership, and consent always come from Elata, never from values your app sends.
Message reference
Purchases
Use
app-payments instead of sending these by hand.
App state
Once
@elata-biosciences/app-state is on npm, prefer it over sending these by hand. See App state.
Metrics
app-metrics uses a dedicated MessageChannel set up with a
__elata_metrics_init handshake, not individual window messages. Always use
the package.
Consent and insights
See Consent and insights.
Notifications
See Notifications.
Navigation
Send the user to another app’s play page in Elata:slug must be an Elata app slug: lowercase letters, digits, and dashes, up to
64 characters. There’s no reply.