OneSignal FREE plugin for FREE and UNLIMITED Push Notifications šŸ“±

Iā€™m using dropsource to wrap my bubble app. Does anyone know what the js bridge would be to get the player id to populate from onesignal? The ones in this thread or in pastebin donā€™t seem to be working.

I was not within a wrapper. It was intended for a PWA - progressive web app (added to home screen app). Managed to make it work for desktop browser notification but not for PWAā€¦

Hey @mattmazzega! Still no luck with finding a solution for the PWA?

Was stuck on that myself a month or two ago, and now coming back from a hiatus to try again (was planning to have an iOS download, but just stick with a PWA for android)

Hi @merav.leviten
For PWA on Android, notifications are working. With PWA on IOS, notifications are not possibleā€¦

Hi, can anyone suggest me how to send push notifications only to the specific category of the user using OneSignal?

Excellent work putting this together @mvandrei
I bet many bubblers have benefited from this post and your plugin.

The code provided for the web didnā€™t work for me, Although, I manged to get it to work using the below code:

OneSignal.isPushNotificationsEnabled(function(isEnabled) {
if (isEnabled) {
// user has subscribed
OneSignal.getUserId( function(userId) {
console.log('player_id of the subscribed user is : ā€™ + userId);
// Make a POST call to your server with the user ID
bubble_fn_1(userId)
});
}
});

1 Like

Iā€™ve been using a single ā€œspaceā€ in the URL field so a push doesnā€™t load a URL at all, which has worked for the past 3 months - thanks Jameson! However, this hack has recently been causing my hybrid apps to crash if the user receives the push while the app is open.

Iā€™m using SuperView as the web wrapper for iOS. Havenā€™t changed anything - same iOS devices iPhone 5 and 7, iOS 11.3 (hasnā€™t been updated since Iā€™ve used the single ā€œspaceā€ trick). Just thought Iā€™d post this here in case others have a similar issue. Will update if I find a solution.

Edit: Havenā€™t changed anything again, but push notifications are no longer causing my app to crash :slight_smile: Concerning inconsistent behaviour, if I work out why this is, Iā€™ll update here.

Some tips for using the Javascript to Bubble:

Make sure it is ā€œvisibleā€ on the page, although it can be tiny and underneath something else.

If you enable the ā€œeventā€ option, you can start a workflow from the event triggered by running bubble_fn_1(value). The workflow will then run at the right time to ensure having the value passed in.

image

Iā€™ve also played with the REST API, and found if you leave out the url, clicking the notification opens the root domain of the app, i.e. https://myapp.com or https://myapp.bubbleapps.io (no version_test).
This seems fairly useless, so may as well point to a page and parameters that have some meaning to the notification.

@mvandrei there are a lot of possible combinations of parameters for the create notification API call.

I suggest making (another call) the entire JSON body as the only parameter, and have something like what you have now as a sample value. Its harder for the Bubbler to edit, but much more flexible. The only downside is having to put the APP-ID into each call in the workflow.

Iā€™m trying to develop a web app (mobile). The prompts (bells) for allowing notifications do show up, however the user never gets registered despite me clicking to subscribe many times. I canā€™t figure out what is going on and Iā€™m not familiar with any JS.

Edit: The problem was that there was no OneSignalSDKWorker.js file. Canā€™t find mysite.com/OneSignalSDKWorker.js

Is this something wrong with the plugin or my setup on Bubble or OneSignal?

If your app is on a paid Bubble plan, you can host the three files OneSignal looks for.
If your app is on the free plan, you can use OneSignalā€™s ā€œnon-httpsā€ option, where they host the files for you on a subdomain of their site named after your app.

1 Like

Thanks! Mine is on a paid plan and Iā€™ve tried the hosting files in the root directory option under SEO/Metatags, but it doesnā€™t seem to work. I still canā€™t access mysite.com/OneSignalSDKWorker.js, it returns the 404 page.

How does one go about hosting the files to make sure it shows?

Some possible traps in this topic:

2 Likes

Thank you! That solved my issue.

Hey guys! Has anyone found an elegant way to send an individual push message to multiple users? (i.e. when a user messages a list of friends)

I thought that scheduling the API workflow on a list might be handy, but it wonā€™t trigger external actions, i.e. this plugin.

I suggest use the API Connector Plugin, make your own API call to OneSignal ā€œnotificationsā€ ā€¦


This is what I put in the value, approximately ā€¦
{ "app_id" : "APP-ID", "data": {"foo": "bar"}, "contents" : {"en" : "text"}, "include_player_ids" : ["PLAYER1","PLAYER2"], "url" : "https://example.com", "headings" : {"en" : "title"}, "ios_badgeType" : "Increase", "ios_badgeCount" : "1" }

This setup for the API call lets you use most of the options as described in OneSignalā€™s API doc. They recommend setting up ā€œSegmentsā€ or groups of users to send to at the same time.

Yes you could schedule an API workflow to do the API call as above.
: )

1 Like

Hello, Iā€™m also having issues to get the player ID from android devices, I tried this but I donā€™t get the player Idā€¦
Could you please tell me what do I need to be able to get the player ID?
Thanks

Hey @hguerrero, what is your set up?

This is mine. Let me know if this isnā€™t clear!

Hey @merav.leviten,

Did you find an easy and elegant solution? I have the same issue right now, did you go through the API Connector as suggested by @mishav?

I cannot create segment on OneSignal as the group is dynamic and changes often. I would like to send directly individual messages to a dynamic list of users. Your input is much appreciated.

Best,
Daniel

Hey @mvandrei,

first of all thanks a lot for your free OneSignal plugin :slight_smile:

Second, Iā€™m facing an issue following your instructions.
I can do everything except use CURRENT USER in the field WORFLOW DATA

So, I think itā€™s for this reason that it does not save anything in my DB.

Should maybe add also the JS BRIDGE code from the web view documentations?