Resource icon

XenForo OneSignal Push Notifications - Now With Simple Install 1.1.11.2

No permission to download

David XLD

Aspirant
Joined
Apr 27, 2017
Messages
22
Impressive Roldan, it seems you have a huge community to have so many subscribtions to push notifications if you adress your xenforo members only.
I am jealous. ;-))
FYI, I have sent a push notification from OneSignal to all subscribers with a link to a news and I have a great 9.1% click rate after 2 days.
Subscribing is opened to guests and members by default.
So it is a very good result from my point of view.
 

pierce

Habitué
Joined
Apr 10, 2016
Messages
1,165
I've always compared the subs for guests as an email news letter experience in retargeting after they leave. It's powerful if you know / experienced how to do it.

A 9% click rate on 10,000 subs is 900.

Get 1% or 9 to spend $100 and that's a $900 return.
 

WoodiE55

Enthusiast
Joined
Feb 6, 2004
Messages
189
I've subscribed to the notifications on my phone using the Chrome browser and have received several likes on a few threads, but I haven't been getting any alerts on my phone via OneSignal.
 

pierce

Habitué
Joined
Apr 10, 2016
Messages
1,165
If it's apple regardless of browser it's WebKit which does not support service workers thus does not support push notifications :(
 

Sal Collaziano

Womanizer
Joined
Jan 1, 2004
Messages
881
Has anyone had experience installing everything and having the "bell" display and state "Subscribe to notifications" on rollover but clicking did nothing?
 

pierce

Habitué
Joined
Apr 10, 2016
Messages
1,165
Yeah usually a manifest issue.

Are you installed in a sub folder?

Chrome ctrl+shift+I and look for errors in console
 

Sal Collaziano

Womanizer
Joined
Jan 1, 2004
Messages
881
Yeah usually a manifest issue.

Are you installed in a sub folder?

Chrome ctrl+shift+I and look for errors in console
No subfolder but here's what I get when I look into the console:

OneSignal: Please don't call init() more than once. Any extra calls to init() are ignored. The following parameters were not processed: ["persistNotification","appId","safari_web_id","autoRegister","notifyButton"]
e.init @ cdn.onesignal.com/sdks/OneSignalSDK.js:1
cdn.onesignal.com/sdks/OneSignalSDK.js:1 OneSignal: The web push SDK is included more than once. For optimal performance, please include our SDK only once on your page.
(anonymous) @ cdn.onesignal.com/sdks/OneSignalSDK.js:1
xenforo.js:223 XenForo.activate(#document)
xenforo.js:209 XenForo.init() 105ms. jQuery 1.11.0/1.2.8-dev
domain/:1 Error in event handler for (unknown): TypeError: Cannot read property 'verdict' of undefined
at chrome-extension://cfnpidifppmenkapgihekkeednfoenal/aph.js:240:17
 

pierce

Habitué
Joined
Apr 10, 2016
Messages
1,165
Did you copy/paste the onesignal example into your page container?

My addon will automatically do it, so you need to remove that.

To confirm - view source, search for

OneSignal.push(

and make sure only one of them has:

["init", {

Also under "persistent notifications" make sure that either true/false is selected.
 

pierce

Habitué
Joined
Apr 10, 2016
Messages
1,165
Hi Shin Ryoku,

Its been a few days and I had some time to look at the problem.

Code:
<?php



function validate_input($input)
{
        if(!preg_match('#^[a-zA-Z0-9\-]+$#',$input)) 
        {      

                exit('nope');
        }
}

validate_input($_GET['appId']);
if($_GET['uid'] == '') $uid = 0;  else $uid = $_GET['uid'];
validate_input($uid);
if($_GET['hash'] == '') $hash = 0;  else $hash = $_GET['hash'];
validate_input($hash);
validate_input($_GET['osid']);


                $fields = array(        
                'app_id' => $_GET['appId'],
                'tags' => array( 'uid'=>$uid,
                                'hash'=>$hash ),
                'contents' => $content,
                'url' => $url,
                'headings' => $headings
                );


                $fields = json_encode($fields);
                //print("\nJSON sent:\n");
                //print($fields);

                $ch = curl_init();
                curl_setopt($ch, CURLOPT_URL, "https://onesignal.com/api/v1/players/" . $_GET['osid']);
                curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
                curl_setopt($ch, CURLOPT_HEADER, FALSE);
                curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
                curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
                curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

                $response = curl_exec($ch);
                curl_close($ch);


?>

I have also validated that i do get push notifications from this code.
 

Dan18

Fan
Joined
Jun 9, 2014
Messages
772
/library/OneSignal/Model/Conversation.php
Line 84.

From this:
PHP:
$url = $options->boardUrl . "/conversations/".$mid['conversation_id']."/#message-".$mid['last_message_id'];
To this:
PHP:
$url = $options->boardUrl . "/conversations/".$mid['conversation_id']."/unread";

To direct the user to first unread message.
Is it correct?
 

pierce

Habitué
Joined
Apr 10, 2016
Messages
1,165
It does, it brings me to the last post of a conversation but I don't have any unread. You should be safe enough to try it.

I'll update the add-on with that change. But you are safe enough to change it.
 

Sal Collaziano

Womanizer
Joined
Jan 1, 2004
Messages
881
Did you copy/paste the onesignal example into your page container?

My addon will automatically do it, so you need to remove that.

To confirm - view source, search for

OneSignal.push(

and make sure only one of them has:

["init", {

Also under "persistent notifications" make sure that either true/false is selected.
I have this in my page_container:

<link rel="manifest" href="/manifest.json">
<script src="https://cdn.onesignal.com/sdks/OneSignalSDK.js" async></script>
<script>
var OneSignal = window.OneSignal || [];
OneSignal.push(["init", {
appId: "my id number",
autoRegister: false,
notifyButton: {
enable: true /* Set to false to hide */
}
}]);
</script>

I have my actual id number in the "my id number" area... Where do I look for "persistent notifications"?
 

pierce

Habitué
Joined
Apr 10, 2016
Messages
1,165
Ok you need to remove that from the page container.

All settings are under: home->options -> onesignal In admin cp
 

Sal Collaziano

Womanizer
Joined
Jan 1, 2004
Messages
881
Ok you need to remove that from the page container.

All settings are under: home->options -> onesignal In admin cp
Okay. Thank you. I removed it. Now I'm back to where I was before I added it in... I really can't imagine what's going wrong. It figures it works for everyone but me. :eek:
 

pierce

Habitué
Joined
Apr 10, 2016
Messages
1,165
I just wanted to say it here on the thread.

The support in private messages has been overwhelming when I am supporting people. I may not reply to that support probably because I am not used to getting it (I get it from my parents all the time and my girlfriend and family of course). If I have not replied to the support I would just like to say it here and say Thank You.

My goal with this addon was never to get to where it is today, not for 1.5. It was supposed to be for XF2 only but I am glad I released it all that time ago its not just helped others but also myself.

The other goal was to support the forum community which I feel like I am doing. That to me to build community here with others is the most import part of all.

So again, thank you for everything.
 

R0binHood

Habitué
Joined
Nov 23, 2011
Messages
1,606
We're the ones who should be thanking you mate, putting in all this hard work and releasing it for free.

It's incredibly generous of you, thank you! You're doing a great job with it :)
 
Top