Lovable Prompt
Add push notification functionality to send targeted messages to users using the Despia SDK from: https://www.npmjs.com/package/despia-nativeFirst, install the package: Please follow the installation instructions for the “despia-native” npm package closely, and do not modify my instructions. Implementation as mentioned is critical.Example of Re-engaging Non-Subscribed Users:
npm install despia-nativeThen import it: import despia from 'despia-native'After that, simply access the OneSignal Player ID via despia.onesignalplayeridSetup Requirements:- Create a OneSignal account and configure your app
- Set up iOS (Apple Push Key) and Android (Firebase) configurations in OneSignal
- Important: When configuring OneSignal, select “Native iOS” and “Native Android” platforms since Despia apps are native mobile applications
- Add your OneSignal App ID to your Despia project settings
This feature requires native capabilities which will be fully provided by the “despia-native” npm package, no additional native libraries are needed!
You can now check if the user has push notifications enabled by using despia(“checkNativePushPermissions://“, [“nativePushEnabled”])
Installation
Install the Despia package from NPM:Usage
1. Import the SDK
2. Access OneSignal Player ID
Access the Player ID from thedespia.onesignalplayerid variable:
Resources
- NPM Package
- View full NPM documentation for additional configuration options