Skip to content

Web SDK

html
<script src="/wingblaze-sdk.js"></script>
<script>
  WingBlaze.init({ appId: "...", apiUrl: "https://api...", ingestUrl: "https://ingest..." });
  await WingBlaze.enablePush();               // permission + subscription + registration
  await WingBlaze.login("user-123");
  await WingBlaze.addTags({ plan: "pro" });
  await WingBlaze.trackEvent("purchase", { amount: 42 });
  await WingBlaze.showInAppMessages();        // render pending in-app messages
</script>

Serve wingblaze-sw.js at your site root — the service worker displays pushes, beacons confirmed delivery with campaign/device attribution, and handles clicks (focus/open + deep-link postMessage to the page).

VAPID keys are fetched automatically from GET /sdk/app/:appId; no manual configuration.

In-app messages

WingBlaze.showInAppMessages() fetches active in-app messages (banner or modal) and renders them with impression/click beacons and local seen-dedupe — no push service involved.

Testing hooks

engage:simulate-push and engage:simulate-click messages run the identical worker code paths without a push service — used by WingBlaze's own Playwright suite.

App inbox

js
const { items, unread } = await WingBlaze.getInbox();      // newest first
await WingBlaze.markInboxRead(items[0].id);                // per-item read state

Items arrive from campaigns sent with Also deliver to app inbox and from the per-subscriber inbox API. Render them however fits your product — the SDK returns data, not UI.

Data hosted in Southeast Asia (asia-southeast1).