[In-App Notifications Mobile] Is there a way to open a screen in a mobile app which is receiving the notification?

[In-App Notifications Mobile] Is there a way to open a screen in a mobile app which is receiving the notification?

Forge Component
Published on 2017-09-15 by OutSystems Labs
4 votes
Published on 2017-09-15 by OutSystems Labs

Is there a way to open a screen from a link embeded in the message sent to a mobile app using the in-App Notification component? 

Hello Mariela,

Sorry for the late reply. Currently, that feature is not implemented in the component. 

You could implement the feature yourself directly in the component, however this would cause you to loose the capability to upgrade the component automatically from Forge.

However, I have a workaround that will solve your scenario by extending the component, instead of changing it.

Since the implementation it is a little bit complex, I'm attaching an eSpace Module with an example of this implementation. This module is based on the sample that comes with the component.

Nevertheless, I'm also including here a (not so) short description of the steps I did to extend the component:

  • To start, in my app, I created a new entity called NotificationExtension. This entity will store the notification ID and the destination URL:

  • In my screen (based on the sample examples that come with the component) I did a couple of changes to the GetNotifications DataAction:
    • Instead of using the Get action from the component API, I copied the aggregate and changed it to include my newly created entity
    • Changed the output of the action. Instead of using just the API structure, I added 2 more attributes: 
      • URL (Text)
      • Image (Binary) - this  will store my thumbnail picture. I had to do this change because the original action from the API returns not the image binary but a URL that is built using private functions from the API module.
    • I also changed the output to mirror these changes

  • With these changes, I now had the URL available in the UI, so I used the OnClick of my notification to navigate to the new screen:

  • Now, the only thing missing is to change my SendNotificationOnClick action:
    • I added a new local variable in the action called NotificationExtension (type: NotificationExtension)
    • After sending the new notification using the API action, I added a validation to check if there was a success, and if True, I used the Id from the output of the SendNotification action to create a new NotificationExtension, that will store my URL (in my case, an URL to the screen1):

I know this implementation may be a bit cumbersome, so please check the final implementation in the example module, and let us know if this solution worked for you or if you have any questions.