• Resolved Nifty

    (@niftythree)


    Hi Murali,

    Thank you for creating the PNFPB plugin.

    We are attempting to interface our app to the plugin but unfortunately we are not able to receive any notifications. We’re specifically trying to notify our users when they receive new private BuddyPress messages.

    We have followed the instructions you have specified on this page.

    Some points to note;

    – Our app uses the BuddyPress API to communicate with our website
    – “Private messages notifications in BuddyPress” is selected in the plugin settings
    – When subscribed through a web browser, notifications for new private message come through fine
    – Our app is able to successfully subscribe with the PNFPB plugin via the API endpoint and we are able to see the token via the settings page on website dashboard along with the correct user IDs
    – Sending a notification directly from the Firebase dashboard works correctly and the notification is displayed and received successfully by the app

    Is there something we may be overlooking at the app end, or is there some additional configuration that may be required on the website?

    Thanks for your help.

Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Author Murali

    (@murali-indiacitys)

    if $recipient->user_id matches while sending private messages then it will send notification. Please verify userid subscribed matches with recipient userid in private message tab. In the plugin, in the routine, PNFPB_icforum_push_notifications_private_messages, will select push notification token based on condition equal to recipient user id on which user is sending message to particular user id and it will send notification only to particular subscribed token. Sorry for the late reply.

    • This reply was modified 2 years, 5 months ago by Murali.
    Plugin Author Murali

    (@murali-indiacitys)

    I have also verified with my Android mobile flutter app with webview(designed in Flutter) for my website which is using buddypress and i have received private message push notification to the correct receipient in mobile, Following link contains screenshot for your referenceFlutter_webview_push_notification_for_private_message
    If you need further clarification, please contact us in plugin help forum Plugin help forum for this plugin

    Thread Starter Nifty

    (@niftythree)

    Hi Murali,

    Thank you for your reply, and sorry for our late reply. After further investigation, we realised that our configuration in the Firebase dashboard was incorrect. We had separate app projects for our app and website, when in fact they should have been configured in the same project. We are able to receive notifications successfully now after adding a new web app to our existing project.

    We have a few other questions/ideas, please see below:

    1. Emojis do not display in the notification that is received (they display as Unicode). We are not sure what can be done about this, but maybe we could have an option to disable the message content being sent in the notification? Instead, maybe an editable setting can be created where you can configure a generic message such as “You have a new message waiting.”, or similar.

    2. Since we are only using the REST API to send private message notifications through a native app, would it be possible to add in an option to disable notifications on the website (which are opted into through the web browser)? This would disable the “<domain> wants to Show notifications” prompt on the website.

    3. When a private message notification is received on the device, we would like it to open the app when the notification is tapped. We have found that tapping the notification does not do anything, unless ‘click_action’ => $messageurl (line 1805 in pnfpb_push_notification.php) is commented out or removed. As the notification contains a link to the private message and an instruction to open our app, there is a conflict. Removing the ‘click_action’ => $messageurl line fixes this for us. Would it be possible to add in an option to disable the click action being sent with the notification? This would allow more flexibility for when the notification is tapped.

    Thank you and looking forward to hearing from you.

    Plugin Author Murali

    (@murali-indiacitys)

    I will look into your suggestions and I will let you know once it is incorporated(suggestions 2 and 3) in next release. Regarding suggestion:1, i will do some analysis on Firebase and i will try to incorporate it as it is related to encryption of messages in Firebase along with emojis.

    Thread Starter Nifty

    (@niftythree)

    Hi Murali,

    That sounds great; we’ll look forward to the next update. ??

    Thanks again.

    Plugin Author Murali

    (@murali-indiacitys)

    Regarding emoji if you directly cut and paste emoji it will work. I directly copied emoji in new activity and posted in activity, it came in push notification as shown in screenshot(both mobile and desktop browsers)
    screenshot_push_notification

    Thread Starter Nifty

    (@niftythree)

    Hi Murali,

    Thank you for your reply and looking into it.

    You are correct, copying and pasting the emoji will work. For sending out push notifications from the admin side, this is fine. However, the challenge is when users who are conversing between each other, type out a message on a phone app (such as a private message), they will use the phone’s keyboard emojis and not the copy and paste method. Having the ability to send a generic message instead of the message’s content in the push notification is the only workaround we can think of at the moment. What are your thoughts?

    Thanks.

    Plugin Author Murali

    (@murali-indiacitys)

    I have released 1.42 version with following changes,

    Added default push notification message content options in plugin setting field when new BuddyPress activity/BuddyPress group activity/post/BuddyPress activity comments/custom post/custom post comments/BuddyPress private messages
    Modified click action logic in push notifications, click action option removed when site invoked using WebView mobile app. Click action will present if site is invoked using Desktop/Mobile browsers and in PWA.
    Allow/Block prompt for push notification will appear only if site is invoked using using Desktop/Mobile browsers and in PWA.
    Added new admin option in plugin settings area for NGINX server/hosting to enable/disable static push notification service worker file and for PWA manifest json files.
    Compatible with WordPress 6.1.1 version.

    In order to get click_action disabled for WebView users needs to subscribe again, I have changed logic to concatenate WebView string along with device token while subscribing from device which is using WebView of the website. Please change/update your WebView logic to send tokens again for the devices which are already subscribed, it will be concatenated with WebView string to distinguish between browser tokens and WebView app tokens. If you implement this logic in WebView app then you can clear all existing device tokens and whenever user access your WebView app, it will automatically send device token to WordPress site for already subscribed devices. Example app is available in my help forum WebView app link Since we are sending device tokens in a array to firebase server and firebase server sends push notification to each device in loop, in order to implement click action disabled for WebView device token, I am sending WebView device tokens to firebase server separately and web browsers(mobile/desktop) device tokens separately to firebase server for push notification.

    • This reply was modified 2 years, 3 months ago by Murali.
    Thread Starter Nifty

    (@niftythree)

    Hi Murali,

    Thank you for taking our suggestions onboard, and for the new update. We appreciate the work that you have put in to provide this plugin.

    We’re coming across an issue which we’re hoping you can help us diagnose. After applying the update, we are now receiving 2 notifications on our devices that are running our apps, whereas before we only used to receive 1 notification (as expected). Tapping on the first notification works correctly (i.e. our app opens as expected) while tapping on the second notification does nothing. We suspect the first notification does not contain the “click_action” parameter (hence our app opens correctly), however the second contains this “click_action” and tapping on it does not invoke the app.

    Our app is written using Xamarin and interfaces with our BuddyPress website via the REST API, and it uses your plugin’s REST endpoint to register Firebase tokens.

    Is there a configuration change that we need to make so that we don’t receive the second notification? Or is there an issue somewhere else? We have cleared existing tokens and resubscribed as you had instructed.

    Thank you.

    Plugin Author Murali

    (@murali-indiacitys)

    I have fixed that problem and released 1.43 version. It is due to mismatch in sql query condition due to which webview token along regular tokens are retrieved for browser push notification. I have fixed that problem 1.43 latest version, please download latest version and let me know your comments.

    Thread Starter Nifty

    (@niftythree)

    Hi Murali,

    Thank you very much for your explanation and the prompt update. The problem looks to be fixed. We will let you know if we encounter any more issues ??.

    We have one more question, but could be seen as a feature suggestion, also. How could we disable the notifications (notifications prompt with Allow/Block options) in the browser? We will be encouraging users to download and use the app, thus we are looking to have a website that will essentially be closed off and promote downloading of the app only (while still running BuddyPress and your plugin, but only using the REST API components of the plugins).

    For example, in the “API to integrate mobile app” tab, there could be an option to disable the service worker (if that’s the correct reference) for browsers, for those using the PNFPB REST API only. Put simply, notifications will only work through the PNFPB REST API and the user won’t be asked about notifications on the website.

    Thanks again and thank you for your ongoing support!

    Plugin Author Murali

    (@murali-indiacitys)

    I will implement above mentioned enhancement to enable/disable push notification from browser. Service worker is common for PWA and push notification related to cache, it requires some modification, I will try to implement this enhancement after some analysis.

    Thread Starter Nifty

    (@niftythree)

    Thanks, Murali! We’ll look forward to hearing back from you. ??

    Plugin Author Murali

    (@murali-indiacitys)

    I have added that option in 1.44 latest version uploaded yesterday, please verify

    Thread Starter Nifty

    (@niftythree)

    Hi Murali,

    Thank you for the update. So far, everything looks to be working great!

    Is there any way we could donate towards your efforts? ??

    Thanks again.

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘App not receiving push notifications’ is closed to new replies.