Forum Academy Marketplace Showcase Pricing Features

Push Notifications, OneSignal and Headaches

Looking for some advice.

Here’s the background and what I’d like to achieve.

//–

A user creates an account on my website. We’ll call this person Alice. Alice uses the website to schedule an event with Bob.

Bob also creates an account on the website. This allows him to request and accept events with Alice. Bob also has our Android app. The login used at the website is also used in the app.

Shortly before the scheduled event, Bob receives a push notification on his Android device. Tapping the notification opens the Android app. If he’s not logged in, he’s prompted to do so, and the app launches.

At the same time, Alice receives a web notification. Tapping the notification opens the web URL. If she’s not logged in, she’s prompted to do so.

//—

So obviously, a lot of things happen outside of Bubble.

My initial thought was to use OneSignal. Somehow generate a OneSignal user ID when the web account is created and then use workflows to trigger appropriate push messages via OneSignal at the appropriate time.

However, I created a OneSignal account, followed the setup for OneSignal in the docs, but the setup ends with the OneSignal account setup! (see https://manual.bubble.io/bubble-made-plugins/onesignal-web-notifications.html). There is literally nothing about how to use the plugin within Bubble. I can find nothing about how to actually use the OneSignal plugin (the one actually from OneSignal) once the account is set up.

When I look in Workflows, none of the plugin workflows seem to involve creating a new OneSignal user ID. It’s also utterly unclear as to whether I need to add the script to the page header, or if the plugin takes care of that.

Which brings me to my questions:

  1. How would you solve for the situation I described?
  2. If OneSignal is the way, how the heck do I use the plugin to create a user ID?

All suggestions welcome.

I would also like to know this answer, in particular Web notifications.

Commenting here so I get updates on this thread.

Definitively needed… has anyone got any advice for this ? Thanks

I’ve had no luck with OneSignal support on this. One person said that Bubble integration was on the roadmap (they didn’t know the official OneSignal plugin existed) and the other ducked the question…

+1
Still haven’t been able to use Onesignal properly.

Hi Nick,

I think I can help you out a little here. OneSignal can be hard work to setup, here’s a couple of facts…

First thing is that Bubble’s own OneSignal plugin (the one called “OneSignal - Push Notifications” published by OneSignal and not Bubble) won’t work with apps. By apps, I mean your bubble site wrapped in any wrapper. It will only work with browsers and in your OneSignal account you have to configure it as per these instructions:

https://manual.bubble.io/bubble-made-plugins/onesignal-web-notifications.html

To make push notifications work either through an Android or iOS app, there is another plugin (called “OneSignal Push Notifications” published by Two Bits") which has the necessary workflow actions allowing you to send.

I don’t think I’ve tried having both plugins installed at the same time, I guess you can have them both installed although I’m unsure what they add into your website’s header.

The first plugin I mention handles the playerId, I think it does all that automatically, but the second one you have to get it yourself. I use the SuperView Android/iOS apps to wrap Bubble websites in and I have a small JS that when run will get the playerId and it’s stored against my users. Once you have that playerID, then the workflow actions work.

If you’re planning on doing something like that, you’ll also need to configure the separate Android/iOS sections back over in your OneSignal account to get it working.

Bit of a pain but it can all be done. Any questions just ask!

:slight_smile:

Thanks so much. I think that puts me on the right path.

The page you linked to is fine for setting up the OneSignal side of things, but says nothing about actually generating a playerID on a Bubble site. Any tips there?

To clarify:

  1. I have a website built in Bubble that a customer uses to create an account.
  2. I have a native mobile app (totally separate codebase, not a wrapped Bubble app) that uses API calls to the Bubble website to log the user in.
  3. The user agrees to receiving notifications as part of the web signup/account creation process.
  4. I’d like the user to get notifications regardless of whether they are logged in to the website directly, or if they’ve given permission for the android app to send notifications.

So the workflow I was hoping for was something like:

  1. Create a OneSignal playerID on the website during account creation.
  2. Store that ID with the user’s account info.
  3. Either create an additional playerID, or grab and use the existing playerID on first login from the Android app. If there’s a second playerID, store that in the same user account.
  4. Push messages to the user regardless of whether they are on the web site or using the Android app.

Does that seem doable?

I’ll take a look at the Two Bits plugin too.

Ok, that seems doable however, I’ve noted a couple of things below which may change your thought process. I might have waffled a bit whilst writing this too so bare with me!


Website access
You can’t get the playerID using the “OneSignal - Push Notifications” plugin (not as far as I know).

So if a user signs up using your website and they click Allow for receiving notifications, then this is for web access only and in order to send them a notification you have to use that plugin’s actions which only require you to point to a user anyway (they kept it nice and simple for us) :slight_smile:

If I’m understanding it correctly, when a user receives the prompt to enable notifications and they agree, the plugin then sends the User’s unique ID to OneSignal and they generate the playerID for that unique user. I don’t quite understand what happens during this process, the plugin must handle it as in the documentation it states the following…

Send notifications directly to a user or list of users in your Bubble database. When you prompt a user to enable notifications and they agree, we send OneSignal the unique ID of their User Thing, so you’re able to send a targeted web push as easily as you would run a search in your Bubble database.

OneSignal must have some configuration in place which matches the unique ID of our users in Bubble to generated OneSignal playerID’s in their system, because when you go through their setup, you hit this…

Either way, you won’t have to worry about getting the playerID for this.

I’ve been trying to find a way if you can tell if a user had clicked on Allow or Disallow but I don’t think you can get to that information easily. Need to investigate it further. We could ask the OneSignal guys who created the plugin to perhaps publish this information if you think it would be useful.


Your app!

My understanding is that you have to use the OneSignal Android Native API inside your app which should do all the work. You can get at the playerID which OneSignal generate using one of it’s methods and then send it back into Bubble, using whatever API process you have in place to store it against your users.

You’ll then be able to use that playerID in the other plugin I mentioned to send out push notifications to your Android users using it’s workflow actions.

I’ve always used a web wrapper with all the integration built in, so for me it was simply a case of running a JS bridging script through Bubble to get a user’s playerID.


Workflow actions

I’d keep it simple, I think all you need is this…

  1. For web users: Show the ‘prompt for allowing notifications’ after the user has logged in.
    Assume everyone has clicked “Allow” (because I can’t find a way of telling otherwise!!).

  2. For app users: Get the playerID (you’ll have to figure this part out)
    Send it back to Bubble and store it in a playerId field against the user.

  3. Whenever you would potentially send a notification, create 2 workflow actions together (one from each plugin).
    Don’t put a condition on the web one (not sure if this errors when it fails, you’ll have to experiment with it), you could put a condition on the app users one (when playerId is not empty).

I hope that helps!

Paul

Thanks for the detailed thoughts.

I did manage to get the “Allow notifications” popup to function, but even after clicking “allow”, the OneSignal dashboard doesn’t show any subscribers. It shows one visitor, but I cannot message them.

Also, since the “allow” popup doesn’t seem to return anything at all as far as Bubble is concerned, I have no way of telling if a user enabled notifications or not.

So far, it’s seeming pretty clunky and useless. And OneSignal have been no help at all.

Strange, when this first come out, I remember testing it and it worked first time for me. @bubble.onesignal can you guys advise?

What’s your Url? I can try

Unfortunately, the site isn’t public yet.

I’ve tried logging in from 3 different browsers with 3 different accounts. I’ve never seen the “allow” popup since the first time.

What’s worse, I now see some brief onesignal (looks like javascript) junk when the browser refreshes.

Given the utter lack of support from OneSignal, I think I’m done with them. If they can’t be bothered to provide support for their products, why would I use them? There must be another way.

To close this out for anyone following…

I solved my problem and got everything up and running. The fastest route appears to be to simply NOT use OneSignal.

I abandoned OneSignal in favor of Google’s Firebase Cloud Messaging.

I also used the Firebase Cloud Messaging plugin.

The whole thing was up and running in under 15 minutes. It does exactly what I needed for my particular use case, and it all worked as advertised.

I never did hear anything useful from OneSignal’s support.

2 Likes

Wow @nick12, thank you very much.

I’m definitely going to try it out :slight_smile:

Hi @nick12

How did you get the fcm token?

BR
Chris

There are a couple of steps, but this is how we did it:

  1. We have an android app that uses Bubble as the backend for login and account management.
  2. We make a firebase api call from our Android app and store the fcm token there.
  3. When the user logs in, or any time we check that they are logged in, we use an API call that updates that user’s info in Bubble with the fcm token.

The whole brick wall I ran into with OneSignal was that I originally wanted to grab the unique ID (equivalent of the fcm token) when the user was in the web browser. OneSignal doesn’t seem to let you do this. Once I found that out, and “experienced” their support, I was very keen to find a different solution.

FCM continues to work like a charm.

***while reviewing my post below i saw that @nick12 has used fire base cloud messaging which I haven’t tried yet with iOS. So push safer might be moot. I haven’t compared pricing either but I’d venture firebase would be cheaper… (Maybe it’s not apples to apples comparison??)

Hello everyone, after banging my head with the various threads on push notifications , none of them worked on the iPhone (gold standard am I right?).

I recommend using a 3rd party service pushsafer.com . It was very easy to get up and running using the bubble api connector and a curl command.

The caveat is the user has to install the push safer app, and u get 10,000 push notifications for a $1 (if my memory services me correctly).

Folks have asked bubble to build this into the product, but maybe it’s better to use another service that already has the cost externalized?

Bottom line, it works and it’s easy!

@iancampbelle @innovation.lab.fr74 @renatoasse

I’m still happy with Firebase. My usage volume falls within their monthly free tier, so the price is hard to beat.

I believe it will work with iOS. We are actually now working on an iOS version of our Android app. I’ll report back if we run into issues.

1 Like

Hello @nick12!

Any pointers on how to use firebase messaging in a standard web browser environment? Meaning, no android/ios apps for now.

Thanks!

Sorry, no. I didn’t look into that. There seems to be decent documentation on the Firebase site, so hopefully it wouldn’t be too tricky.

Thanks @nick12!
Knowing that’s possible, now I will look into it in more detail.