I have Pushwoosh configured and can receive alerts/notifications when the app is closed. However when I have the app open and am waiting for a confirmation of a transaction I can't seem to receive them. This is despite configuring the listener in the Layout webpart. It just never fires. I'm also playing around with Firebase and the In App Notification plugin but I'm not sure if that is complimentary, mutually exclusive  of or just a completely different action and functionality. Can someone kindly help me out as to the proper/best/easiest way to achieve in app alerts and also push notifications?

Thanks in advance.

Hello Christopher,


Without looking at your code, it's difficult to understand the underlying issue. But let me try my best to help you.

In order to receive the notification when the app is open, you'll have to include the PushwooshNotifications webblock into the screen (ideally, the layout - as documented here).


I've created a sample PoC with my own credentials and I've tested on iOS. While sending a push from the PW control panel, I'm able to receive without any issue - either open on the foreground or closed on the background.


Take a look at it, review and let me know if you have any issue or question.


Cheers,

Armando


Edit: if you're looking to receive an event while the app is open, I would suggest Firebase. Either way, you can achieve the same with Pushwoosh.

Thanks Armando. Much appreciated. For some reason the alert still doesn't trigger. I followed your example exactly. I might switch over to Firebase either way though. Do you have an example of that?

Update. I've gotten the notification to appear in the application. It appears that it was the positioning of the actual PW control in context to the Layout web block. It had to be on the same "level" as the actual LayoutBlank and Layout block rather than inside the "layout" and "layout blank" container:



However the messages only appear when I send it through the Pushwoosh site itself. The API call is still not generating the message. I'm using the SendPushNotificationToUserId method. Perhaps incorrectly. Thoughts there?

Hello Christopher,


I'm glad we're one step forward! When you invoke the registerDevice action, the plugin tries to create a record into the Device entity (PushNotificationsApi module). As such, when you invoke the SendPushNotificationToUserId, the plugin is going to query that same entity in order to detect which deviceId's are going to receive the notification.

So, my suggestion is for you to debug what's happening on the PushNotificationsApi side of things when the token is registered. Just a side note: the user provider for the PushNotificationsApi is set as (Current eSpace) - this has no effect in the "working behavior" but may lead to some confusion while debugging. Just set it as the same user provider you use for your application and everything should be fine.

TL;DR: are you registering the device with the user logged in or not? If not, the UserId attribute on the Device entity might not being filled.


In the case that the OutSystems team responsible for the plugin hasn't fixed yet some issues with the Pushwoosh Plugin, you're free to take a look at this module file.


Let me know if this helps.