Skip to main content

Push Notifications

Push notifications use OneSignal for delivery. The SDK handles initialization, permission requests, device registration, and notification interaction tracking automatically.

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 requested automatically via the usePush hook
  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:

Service API

OneSignal Integration

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