Web Notifications – Making Siebel Notifications better

Web Notifications is little known feature that allows websites to display desktop style notification based on user permissions. Now it is extensively used by websites such as New Sites, What’s app web to display desktop style notifications. When I came across this feature the thought that immediately that came to my mind was can this be used for Siebel OpenUI notifications that have replace black message broadcast bar in HI.

The implementation is fairly simple and follows this approach

  • Check for Notification object
  • If Found ask for user permission
  • If allowed display notifications

When Web Notification framework was introduced it allows HTML styling that allowed truly beautiful and feature rich notification but now it only allows for text notification, I believe might be due to security concerns but nevertheless it still allows us to build pretty useful functionalities.

So, I researched on OpenUI Notification framework and found a place that allows for easy integration of Notification. Before we start time for a statuary warning, “This is not a supported customization and I do not recommend you using this in production. Consider this as a Proof of Concept Solution”. The intention is to just showcase a possibility and hope that somebody from oracle can have a look at it and may be make it a part of framework itself 🙂 .

Siebel OpenUI Notification framework is based on PM/PR model just like other OpenUI functionalities. The two JS files that house the code are

  • msgbrdcstpm.js – Presentation Model responsible for interacting with proxy and get the required data for Notifications
  • msgbrdcstpr.js – Physical renderer responsible for actually creating the UI elements of Notification framework.

These files reside in SIEBEL_BUILD/siebel directory. Here is what we are trying to do with these files

Problem Statement:

When a new message is created for broadcast Siebel makes Notification UI element blink which is not sufficient to draw attention of the users to have a look at it.

Solution:

We will use Web Notification framework to display a desktop style notification that is displayed when a new message created for broadcast.

We are going to touch the PR (msgbrdscst.pr) file. In order to do that you will have to beautify/expand the code. In the PR we will modify UpdateMsgBar function add our custom code to display Web Notification when a new message is broadcasted.

/* code to show desktop Notification*/
var iCounter = 0; //counter to check number of new notifications
if(Notification){ //check for Notification object

   for(var msg in msgArray){ //access individual messages from Array
       if(typeof(msgArray[msg]) === "object"){ //we do get function object
           var iMsg = msgArray[msg];
           //status is blank when new unread notification is added
           if(iMsg.status === "")iCounter++; //new notification found increase counter
        }//end of if
    }//end of for

    if(iCounter > 0){ //if new notification found
        //ask for permission - only need to happen once
        //once user provides permission choice is recorded by browser
       if (Notification.permission !== "granted")
            Notification.requestPermission();
       else {
             //create new Notification
             var notification = new Notification('Message Broadcast', {
                 icon: "./images/favicon_touch.png",
                 body: "There are " + iCounter + " new messages. Please check!",
              });
              iCounter = 0;//reset the counter for next time
       }//end of else
   }//end of if iCounter
}
/*Notification code ends here*/

Once you have this code you UpdateMsgBar function should look something like this.

notifications_code

Save the file, clear the cache and reload the page. It is going to take couple of minutes but you should get a prompt asking for permission as shown below

notifications_permission

Click on Allow, then sit back and watch a small little smart notification popup every few minutes when you have unread messages. Cool, isn’t it!!!

notifications

The best part is that you don’t need to have active Siebel Window to view these notification they will act like outlook notifications.

Closing Notes:

The message array has several other properties such as urgency, message text that you can use for example you want to show notifications only for Urgent messages or use different icons based on type of messages. It is also possible to attach click handlers to the notifications. Web Notifications are not supported by IE yet (surprised ???)

Unfortunately it is an unsupported customization as of today which is not recommended but hopefully it will become of the actual framework at some point in time. The way I envision this to work as part of actual framework is that an “User Preference” will be used to enable/disable desktop notifications.

2 Responses to Web Notifications – Making Siebel Notifications better

  1. Web notifications are road map material indeed. It should bring relief to CTI inbound calls going unnoticed. But yeah, IE blocking the party…

  2. Hi Neel,
    I am wondering is there any provision to determine and control frequency/time interval between successive notifications.
    Also is there any trigger for these notifications to be shown on demand.
    I have implemented this as you suggested and notification popup is intermittent and displays at irregular intervals.
    Please let me know, if you can throw some light

    Thanks
    Naresh Telukutla

Leave a Reply

Contribute