Fetching One Signal ID into Bubble for Notifications


#1

I have created an app on bubble and have used dropsource to create an android app through the web view component. Have integrated the One Signal Notification Service into the dropsource app. I am able to view the One Signal ID for each user on the app in the One Signal dashboard. And I am able to send push notification to the users from the one signal platform.

However, i am unable to fetch this One Signal ID into bubble. I would like to send the notifications automatically from bubble, but I need the One Signal ID stored in bubble for the same. Have tried using the javascript code in bubble but to no avail. Can anyone help with this? Need to deliver the app for a client but without the notifications, this is difficult.


#2

For android apps in dropsource you can get the onesignal player id (or user id) by adding the action
Get OneSignal Subscription Status.
This action returns the OneSignal player id in the Action data as user id as shown below.
You can send this value to your bubble backend to save against the current user.
Then if you want to send a notification to the current user you use their player id.

Normally i would have this action when the application launches and save the value in a device variable.
Then after the user logs in i will send this value alongside the current bubble users id (bubble user returned by the login action) to my bubble backend. In the backend i will have a workflow that will check if this current bubble user has his one signal player id set, if not set then i will assign the player id to the user.

But since you’re using a webview and i don’t know your setup you might have to determine the right time to send the playerid to the backend. Also you have to figure out a way to determine the current bubble user id.
If the user is login in from dropsource then its easy to get their bubble user id and do something similar to what i suggested above. If you’re login in from your webview i’m not sure how you’re getting the bubble user id as i haven’t tried this before.


How to use Onesignal
#3

thanks @seanhoots

Since this is a webview, how would dropsource know when to send the id back to bubble? I mean, is there any workflow I need to write in Dropsource that can send data to bubble based on the application interaction (say when the user logs in) I am not sure how dropsource would understand that a user has logged in in the first place, since this is handled by bubble.


#4

Yeah that’s the issue I mentioned. Since you’re doing everything in the webview you will have to handle everything at bubble’s end.
If you search in the bubble forum you will find some posts on how to get onesignal player ID.


#5

@seanhoots

Did you encounter ‘no Device ID appear on Bubble’ when you tried to subscribe ?

I used an action “Get Onesignal Subscription Status” after a user sign up successfully(200: wf response) and set value the UserID to the device variable so I could later pass it to Bubble backend. I did not trigger these events at Application Launched because my app crashes by doing so.

After all, I successfully subscribed my device on Onesignal. However, on Bubble, there is no data shown up(device id) or even in Dropsource, when I tried to check by assigning device id to the text element, there is nothing shows up.


#6

On Android it works well to test but how to test One Signal Notification on IOS ? even installing on physical , we need an One Signal App Id , this one is linked to the app ID Apple, as com.xxxxx.xxxx wich we do not have on the test build then we cannot have the One Signal App Id.

I have already have One Signal App Id for my web application in GoNative IOS App, so this One Signal App Id is linked to the to this Gonative app and App ID. So of course when i put the One Signal App Id in the dropsource app , there is App ID mistmatch
So cannot get the PlayerID from Get OneSignal Suscription Status and pass it to bubble , and of course cannot receive Notification .
Am I correct or do I miss something , is there a solution ?

Thanks


#7

@LOIC

I would like to ask something.
On Android, do you start “Get OSS ID” action on lifecycle ‘Application Launched’ or somewhere else?
My app crashes when I start this action at Application Launched.


#8

Hi guys, you’ll need to add your Dropsource app bundle ID in OneSignal also (it’s not exposed by default but it will be in an upcoming release) - it’s “com.dropsourcetesting.project-id” where “project-id” is the string of numbers you’ll see in your project URL after “project/”.


#9

And a bit more info I’ve just got :grin: - you’ll also need a .p12 file from us to test your notifications, so if you can open a support request in the editor we’ll get that sorted for you.


#10

@ihfdai on Android, I start Get OSS ID it in at the main user page, as he is supposed to be logged in, then action An API/WF on Bubble, to register the IDplayer to the DB

You can eventually get it at the Landing Page, as well, The general idea is to get it at the first page a user will see

In Application Lauch it crashes indeed

On IOS, Same logic


#11

Has anyone figured this out? I am running into the same issue?


#12

If the user launches the app and we save the player ID in OneSignal, and then they get a new device or a second device and log in using the second device, won’t it overwrite the player ID saved inside of Bubble if it’s a single playerID?

Is a playerID specific to the device used?

Perhaps better to create a list of player ID’s inside of bubble’s back end to solve this?

And do you make the playerID required on the login api endpoint? Will there ever be an instance where the device doesn’t pull in a PlayerID from one signal?


#13

@seanhoots

Is one signal just for a mass email?

Does it also work for say, when user A subscribes to user B’s event, then user B will be notified that user A subscribed. and for other user to user based notification?


#14

OneSignal is for sending push notifications to either a single device (user) or a list of devices (users .
So yes it can be used for what you described.


#15

If A sends a message to user B saying
“hi. where are you”
Will we have to pass the string in the dropsource events using the functionalty " Set one signal user tag?" and populate the key and value fields?


#16

I’m not 100% sure that will work but definitely check it out. If it doesn’t produce the expected outcome, I know that @markpiller used his platform Backendless to produce the result you want. He created a chat app and can pass info on the conversation back to other users via push notifications too.

He posted and even included an awesome demo video too