For: developers.
Events
The surface emits three events. In iOS they arrive at the atlas message handler; on the web they arrive as window.postMessage from the surface's origin.
func userContentController(_ controller: WKUserContentController,
didReceive message: WKScriptMessage) {
guard let body = message.body as? [String: Any],
let event = body["event"] as? String else { return }
switch event {
case "activated":
break // the user signed in; you may cache that results exist
case "results_ready":
break // show a badge or schedule a local notification
case "signed_out":
break // dismiss or return to your own screen
default:
break
}
}
<script>
window.addEventListener("message", (e) => {
if (e.origin !== "https://<partner>.atlasbiolabs.com") return;
const { event, order_ref } = e.data || {};
if (event === "results_ready") {
// update your UI
}
});
</script>
| Event | When |
|---|---|
activated | The customer signed in and has at least one order |
results_ready | The customer opened an order with at least one released layer |
signed_out | The customer signed out |
Payload
{ "event": "activated", "order_ref": "ON-…", "height": 1280 }
{ "event": "results_ready", "order_ref": "ON-…", "layers": ["biology_age"], "height": 1640 }
{ "event": "signed_out", "height": 560 }
order_ref is Atlas's order reference, safe to store and to quote in support requests. height is the surface's content height in CSS pixels.
Server-side callbacks Planned
If you run a backend, Atlas can POST the same events to an HTTPS endpoint you provide, signed with HMAC-SHA256 over the body, with a timestamp header and a five-minute replay window. Until this is live, use the in-view events.