Notification Open trigger

Hey there, I do have a Notification open trigger at the Global canvas page and it does work as it should, open the dedicated page depending on the provided data within that notification. However, I have experienced this strange behaviour, where I initialize send a notification and this trigger is triggered too :smiley: I Guess it should trigger only when I click in the notification, right? Is it possible, that’s a bug?

Hmm… It’s been a while since I last worked with push notifications but I’ll bite :grinning_face_with_smiling_eyes: What do you mean by “initialize send a notification”? Do you mean when push notification permissions are read or…? Please show which flow is called when it’s triggered unnecessarily so I can investigate better!

Screenshot 2021-12-09 at 10.20.28
I am talking about the trigger event “Notification opened”. This flow is set up on the Global canvas and basically, the notification looks like this {“data”:{“route_ref”:“XXXXXX”}, “notification”: {“to”:“deviceTokenHere”, “title”:“Hello”, “body”:“World”}}.

It does work as it is supposed to, however, when the notification is triggered (via an HTTP request), this trigger is also triggered, which I find at least weird as the notification is being sent and not received nor opened.

So if I receive a notification on the other device and click on it, it’s fine and it does work. Problem is only while sending the notification out.

Hope that make sense :slight_smile:

Oh, so the sender of the notification also gets that “notification opened” flow triggered? :thinking: That sounds like it’s either a bug or that the sender also receives the notification and thus is already in the “notification opened” state since the app is open. Does your logic include it also being sent to the sender? If yes, can you try excluding the sender and see if the problem goes away?

Ah, that actually makes sense and it is caused by this the notification is being sent to the topic which the sender is also a part of. It’s for chat purposes, whenever I send a message, that message is also being sent to the other members of the chat (topic). I am not sure, I can exclude myself somehow, do you have some solution in mind, please?

You could include sender_id in the sending and exclude it from the list of user ids sent to? Something like that would be most elegant.

@Mevi Hey Mevi, I believe that is not doable as FCM can either send a notification to a topic (group of people) or to a single device. In this case, as I wanna notify everyone in the channel (which I am a part of), so I have no way how to exclude myself from the topic. I guess the option would be to unsubscribe myself from the topic before sending the message and after the message is sent again subscribe myself to the topic, however, I believe there must be a better way as this seems rather complicated and not really efficient.

I would probably do a check on the app side that if the user sent a notification just now, don’t do all the other logic that follows from the notification event. (e.g. an app variable with a timestamp or a boolean that is checked)

But regarding the very potential bug – double check whether you’re using the received or opened event. Received should fire even if app is in foreground, opened should only fire if the user has tapped on the notification to get into the app.

@Mevi Thanks, that was my initial thought. Notification Open should fire ONLY if I click the notification, right? But since I am within the app, sending the notification, should not trigger for me. I guess it would explain a lot if I would be using Notification Received but I am not. However, even though it looks like a bug to me it solves only half of the problem. :slight_smile:

Hi, @Jaroslav_Krajca how are you navigating to a dedicated page? Is it through actions sent in the push notification or through data/variables that you extract once the push notification has been opened in the app that you then use to route to a page? Or is it some other method?

Hey, it is the second one. The notification has chat room identification. When the notification is opened, that identification is extracted in order to open the correct page with a chat room. However, as I mentioned that does not work properly apparently as the page is opening even though I am sending the message with the notification and even though I am not clicking on the notification it still open the page (at this point it does open the page I am on, so it just reloads the current page).

@Mevi Hey, did you have a chance to check the bug on your side as at our side it is definitely a bug as Notification Opened is triggered even when I am sending one (and I am also a receiver). Thanks a lot! :slight_smile:

Yep I was able to verify the bug, please file a bug report at tracker.appgyver.com for this :slight_smile:

Notification opened triggered even without opening the notification | Voters | AppGyver @Mevi Just did that, thank you for your cooperation. I hope it will be fixed soon. From my previous experience I guess it will be fixed in less than a month, is that right, please? :slight_smile:

Hey @Mevi, do you have any update on this, pretty please? :slight_smile:

Mmm I went and had a look and it looks like push notifications are getting a lot of fixes in the upcoming (currently in QA) 4.X release, I’m not certain if this is included but I would hope so.

@Mevi Hey Mevi, any update on this? It’s been 6 weeks and release 4.X is here, however, I cannot see there that this has been fixed, could you either confirm or provide any ETA (if you can) of the bug fix release? Thanks! :slight_smile:

Hi! I tested with firebase & iOS on 4.X just now and did not have a problem with notification opened, only notification received fired when app was open :slight_smile:

Releasing the build version of 4.X has been delayed due to issues with builds that were found in the process, however 4.1.X should be released soon – perhaps even later today :crossed_fingers: When it is released, you can build your app and test if your issue has been fixed by this, and hopefully it is.

1 Like

create an app variable true/false to define whether a user is already inside the app. when the initial screen launches, before navigating to another screen, make sure the variable is set to true. In your logic which extracts the on opened event, check whether the variable is true or false, and only if false continue the redirect.