requestPermission() when appropriate.
Setup
- Create a OneSignal app and get your OneSignal App ID
- Configure it in your Stackfront dashboard
- The SDK fetches the OneSignal App ID from remote config and initializes automatically
How It Works
WhenStackfrontProvider initializes:
- OneSignal is initialized with the app ID from remote config
- Permission is NOT requested automatically — call
requestPermission()fromusePushat an appropriate moment - Device is registered with the Stackfront API (platform, app version, device model, OS version)
- 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 acampaign_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’sadditionalData 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, importOneSignal:

