Skip to main content
Push notifications use OneSignal for delivery. The SDK handles initialization, device registration, and notification interaction tracking automatically — but never prompts for permission; your app calls requestPermission() when appropriate.

Setup

  1. Create a OneSignal app and get your OneSignal App ID
  2. Configure it in your Stackfront dashboard
  3. The SDK fetches the OneSignal App ID from remote config and initializes automatically

How It Works

When StackfrontProvider initializes:
  1. OneSignal is initialized with the app ID from remote config
  2. Permission is NOT requested automatically — call requestPermission() from usePush at an appropriate moment
  3. Device is registered with the Stackfront API (platform, app version, device model, OS version)
  4. Notification clicks are tracked — when a user taps a notification containing a campaign_id, an open event is sent to the API

Hook API

Permission Handling

Customer Linking

When a customer logs in, the SDK automatically links their OneSignal player ID to their customer ID. This enables targeted notifications:

Notification Click Tracking

When a user taps a push notification with a campaign_id in its additionalData, a click event is sent to the Stackfront API:

Tap Actions

A campaign can carry an action that runs when the shopper taps the notification. The backend places it in the push’s additionalData under action_payload, and usePush().onNotificationOpened hands you that payload verbatim:
Every action resolves to { type, value } — the dashboard’s Tap Action picker writes it, so the host app never has to hard-code ids. In the Shopify admin, each action type is chosen from a picker over real store data (products, collections, pages, discount codes, popups, story groups and app screens) — merchants select records by name rather than typing ids. Discount-code search needs the read_discounts scope; without it the field falls back to manual entry.

Service API

OneSignal Integration

If you need to use OneSignal APIs directly outside the SDK, import OneSignal: