Is there a way to select the notification sound played when sending a push notification at this point? If possible, I’d like to know how to do that.
Or can OneSignal be used here? If possible, I’d like to know how to generate a player_id.
Bubble’s native push notifications don’t let you customize the notification sound they just use the device’s default. If you need custom sounds, you’ll need to use OneSignal instead.
To set it up, create a OneSignal account and grab your App ID and REST API Key. In Bubble, use the API Connector to create a POST call to OneSignal’s notification endpoint. You can specify custom sounds in the payload using “ios_sound” or “android_sound” parameters with sound files you’ve uploaded to OneSignal’s dashboard.
The player_id is OneSignal’s device identifier. To generate it, add the OneSignal JavaScript SDK to your Bubble app’s HTML header or use the Toolbox plugin to run the initialization script. When a user visits your app, OneSignal automatically generates their player_id. Capture it with JavaScript, then store it in your User data type in Bubble. When you send a notification via API Connector, target that stored player_id and include your custom sound in the request. It’s more setup than Bubble’s native notifications, but it’s the only way to get custom sounds and advanced notification control.
I tried to see if it could be done using only the API since the OneSignal SDK couldn’t be installed on Bubble Mobile, but it still doesn’t work. The user’s subscription isn’t activated in OneSignal.
that’s expected behavior. oneSignal can’t activate a user subscription through the API alone. the subscription (player_id) is only created when the oneSignal SDK runs on the device and registers it. without the SDK, oneSignal has nothing to attach the notification to, so the user stays unsubscribed.
since bubble mobile doesn’t currently support running the oneSignal SDK, there’s no way to generate or activate a player_id there. the API is only for sending notifications, not creating subscriptions.
so on bubble mobile you’re limited to bubble’s native push notifications and the default sound. oneSignal with custom sounds only works on web or PWA for now.