psy Posted January 27, 2019 Share Posted January 27, 2019 Background I'm creating a module to integrate https://pushalert.co/ into ProcessWire. You actually don't even need a module. You could just use the "Other Websites" javascript provided by PushAlert for basic functionality, ie send a broadcast notification to all subscribers. This is essentially what all the other integrations, including WordPress, do. The WP integration installs a widget with a form enabling the admin to enter details such as title, message, etc from a blog post. It does not: collect any statistics within the CMS about the notification enable audience fine tuning to eg a particular subscriber or subscriber segment within WP. The admin needs to use the PA dashboard for that functionality PushAlert has a javascript and REST API. It's intended that this module will use both. https://pushalert.co/documentation What my module does so far: associate a subscription with a user. FE user clicks a button on the website front end to subscribe and/or agrees to the browser popup to accept notifications from this site send broadcast push alerts from a page within admin It doesn't have a 'widget' but easy enough to create a fieldsetpage with the relevant fields and add that fs page to any appropriate templates, then with a hook, send the notification. Need to be careful that once published/sent, the notification is not automatically re-sent on subsequent page edits. Looking for help/collaboration on how best: to send a notification, eg from a blog post, then track the statistics. Dilemma is that the push notification must come from the admin page. Responses go to the sending page which, as it's an admin page, is restricted and will not accept the https response. This is where the other CMS integrations stop. The only json response from PushAlert is the status, eg 'success', and the notification id. There is no opportunity at this point to capture the sending page id. handle, 'once sent on page publish', do not automatically resend on future page edits Am thinking along the lines that FS Page will have a @kongondo runtime markup field https://modules.processwire.com/modules/fieldtype-runtime-markup/ to pull the stats from PushAlert. Every time an admin visits the page, the stats will update. Once an admin checks the 'Send notification on page publish' checkbox, a hook creates new front end page that records the 'sender page', sends the notification request to PA, which then uses that newly created frontend page, as the response endpoint. Another rook re-associates the front end page with the admin page (eg blog post), to update the stats. Potential use cases: Notify individual and/or users with a particular role of an event, eg "New work opportunity" for job seekers; new blog post published; entries now open, etc... Looking for help/ideas/collaboration on this module. Please let me know if you're interested and as I do, believe this would be a great addition to ProcessWire 6 Link to comment Share on other sites More sharing options...
dragan Posted January 27, 2019 Share Posted January 27, 2019 I am generally interested, but I'm wondering: What's the advantage of using a service such as pushalert.co? Apparently there is a PHP library you could use: https://github.com/web-push-libs/web-push-php/blob/master/README.md I'm guessing the hard part about the whole setup is to create server keys? Guess I have to dig deeper into this whole topic... 2 Link to comment Share on other sites More sharing options...
PWaddict Posted January 27, 2019 Share Posted January 27, 2019 1 hour ago, psy said: I'm creating a module to integrate https://pushalert.co/ into ProcessWire. Have you checked out Foxpush? The free plan has unlimited subscribers. Maybe overall has better features than PushAlert? 1 Link to comment Share on other sites More sharing options...
elabx Posted January 27, 2019 Share Posted January 27, 2019 I've made some development using OneSignal's API which has the caveat that if you use their free service they can use your data for their purposes. For the 'once sent on page publish' issue, I just put a checkbox on the pages that enable notifications and check them if I wan to actually send the notification. Why would you not be able to get the response? I don't remember having any trouble getting responses from the OneSignal API, all code ran through a hook in ProcessPageEdit. I then saved the response data and basically just checked on page load for the notification info with its ID, I see push alert has a similar API. (if it had been completed, and how many had received it,failed, clicked). 4 hours ago, dragan said: I am generally interested, but I'm wondering: What's the advantage of using a service such as pushalert.co? In my case, I thought the API was really nice and offered an easy way to manage mulitple websites straight from the API. (that way i handle multiple website's notifications from one place) . Also the Js to actually display subscription buttons info frontend or call their API in an easier fashion from a custom button. I even configured some color fields and text fields in PW to customize every text/color that rendered from their Js UI passing a customization object. Also didn't have to build any reporting stuff which for my case, wasn't necessary. 2 Link to comment Share on other sites More sharing options...
psy Posted January 28, 2019 Author Share Posted January 28, 2019 Thank you @dragan @PWaddict and @elabx for your detailed and considered opinions. Much appreciated. I investigated all your suggestions and all of you asked why I chose PushAlert. Simple really, it was the first I found some time last year. I searched for others but none of the solutions you presented came up. PushAlert seemed to have the best plans and I've found their tech support to be responsive and helpful. OneSignal appears to be the biggest and has the most fully documented solutions. However, like @elabx, I was uncomfortable with the fact that you had to pay for GDPR security??? The leap from free to US$99/mo for what should be a right not a privilege didn't sit well with me. I guess they make their money from selling the marketing data rather from their sender clients? Ended up going back to PushAlerts and they have a published GDPR Compliance page covering all plans, including free. https://pushalert.co/gdpr On the flip side, you don't get the detailed reporting but then I doubt 99.9% of clients would want it. They want to know how many notifications were sent, how many were successfully received, how many CTA's clicked and how many unsubscribed. All this info is provided by PushAlert while still protecting subscriber confidentiality. Works for me! @elabx would you consider sharing your code with me? Why reinvent the wheel and your ideas are exactly what I'm looking for to adapt to PushAlert. Thanks again 1 Link to comment Share on other sites More sharing options...
PWaddict Posted January 28, 2019 Share Posted January 28, 2019 Will push notifications cause trouble on shared hosting websites if all sent at once? Maybe an option would be great to send notifications for example in batch of 50 per x minutes? Link to comment Share on other sites More sharing options...
psy Posted January 28, 2019 Author Share Posted January 28, 2019 2 hours ago, PWaddict said: Will push notifications cause trouble on shared hosting websites if all sent at once? Maybe an option would be great to send notifications for example in batch of 50 per x minutes? Yes, absolutely - same as sending email campaigns directly from the website vs going with an email-sending provider such as CampaignMonitor or MailChimp. This is a key decider for going with a notification-sending provider 1 Link to comment Share on other sites More sharing options...
psy Posted January 29, 2019 Author Share Posted January 29, 2019 PushAlert4PW WIP.... Some more on the PushAlert REST API. Every sent alert requires a URL and it appears in the notification. Silly me thought that was 'just life'. Didn't realise until I chatted with Alex from PushAlert, that it is in fact the URL to which notification responses are sent. It does not have to be the page, eg an admin page, that sent the push notification. So cool! The URL also appears in the notifications so thinking about hooking into the front end home page URL to capture the json responses and save the data to a different page that connects the sending page with the message id. Onward & upward 3 Link to comment Share on other sites More sharing options...
PWaddict Posted January 29, 2019 Share Posted January 29, 2019 @elabx Can you please write a tutorial with the related code on how to implement OneSignal with PW? Link to comment Share on other sites More sharing options...
psy Posted January 30, 2019 Author Share Posted January 30, 2019 Module starting to come together. Will of course give credit to other devs whose module code I've studied and in some cases, unashamedly copied, including @elabx draft OnSignal and nico's MarkupSEO. Ready now to jump 3 Link to comment Share on other sites More sharing options...
elabx Posted January 30, 2019 Share Posted January 30, 2019 19 hours ago, PWaddict said: @elabx Can you please write a tutorial with the related code on how to implement OneSignal with PW? I'll try to find time to write a simplified version of the module and share it here. (because the module I wrote is a bit quite messy code wise). 1 Link to comment Share on other sites More sharing options...
psy Posted February 20, 2019 Author Share Posted February 20, 2019 Quick update Please (whatever deity you choose), I'm close to publishing an alpha version. The PushAlert API is easy. It's the PW integration that challenged me. If you only ever want to capture subscriptions to PushAlert and send notifications carte-blanche via a PW template without capturing stats, and/or sending advanced options, eg to a specific user instead of everybody, the instructions in the PushAlert docs will get you going. This module is more than just a wrapper... more soon including the readme.md (why does that always come last?) Anyone interested in being a guinea pig tester? 2 Link to comment Share on other sites More sharing options...
Jozsef Posted March 19, 2020 Share Posted March 19, 2020 Hi, I'm thinking to implement your solution for a couple of primary school websites (they would comfortably fit into the free plan). I can see the module requires a separate title and message field for templates. Is it not possible to just use the existing title/headline and summary/body fields for the message purpose? My purpose would be to provide parents to possibility to get notified each time a news article is published on the website. Thanks for the great work! 1 Link to comment Share on other sites More sharing options...
psy Posted March 19, 2020 Author Share Posted March 19, 2020 Hi @Jozsef The module defines a special fieldtype of FieldtypePushAlert - this generates the message title, content etc sub-fields in the template for the push notification. It's used in various ways under the hood to send and gather/display stats about the notification. So, no, you can't use the existing title, headline, summary fields with this module. Link to comment Share on other sites More sharing options...
Jozsef Posted March 21, 2020 Share Posted March 21, 2020 Thanks, @psy, it sure offers more flexibility. I'll play around if I can use hooks to manipulate these fields on save when I get a little time. Link to comment Share on other sites More sharing options...
pwFoo Posted July 13, 2020 Share Posted July 13, 2020 Nice to see a push notification module, but I would love a universal webpush api module for that case? Browser dependent push notifications working with edge, firefox, chrome (for android) without forced to use one push service. Just let the browser decide. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now