Notification Center

Open App Inbox

You can show a list of push notifications received in an In-app Notification Center. Expiry of the notifications can be set from the panel.

NotifyVisitors.showNotifications((JSON Object)appInboxInfo,  (int)dismiss);

*If you want to use a customized notification center. Pass a json   object appInboxInfo as the first parameter. Otherwise pass null for standard notification center.
*The Key’s value should be static and values will be dynamic.
*You can create upto three labels. Label names exactly same as you passed in notifyvisitors panel. 

var appInboxInfo = {
      "label_one" : "tab1Label",
      "name_one" : "name_a" ,
      "label_two" : "tab2Label" ,
      "name_two" : "name_b",
      "label_three" : "tab3Label",
      "name_three" : "name_c",
      "selectedTabTextColor" : "#FF3D00",
      "unselectedTabTextColor" : "#FF6D00",
      "selectedTabBgColor":"#E1BEE7",
      "unselectedTabBgColor_ios" : "#00796B",
      "selectedTabIndex_ios" : "0",
      "tabTextFontName_ios" : "xxx",
      "tabTextFontSize_ios" : "13"
  };

dismiss:-  You can dismiss the notification-center page after clicking the notification.
pass 0 :- notification-center page will not be destroyed from memory.
pass 1 :- notification-center page destroyed  from memory.

//Example:
Notifyvisitors.showNotifications(appInboxInfo, 0);

We have now released the callback feature that will help you handle any condition that occurs when the user presses the close button in the notification center. Currently, this callback is only available on the Android platform, however, it behaves identically to the showNotifications() function on the iOS platform, allowing you to avoid adding platform-specific checks when using this updated function. This feature is available from v4.4.2 onwards.

Notifyvisitors.openNotificationCenter(tabConfig, dismissVal, (callback: any) => {
     //do your task here
});

For example,

var appInboxInfo = {
       "label_one" : "tab1Label",
       "name_one" : "name_a" ,
       "label_two" : "tab2Label" ,
       "name_two" : "name_b",
       "label_three" : "tab3Label",
       "name_three" : "name_c",
       "selectedTabTextColor" : "#FF3D00",
       "unselectedTabTextColor" : "#FF6D00",
       "selectedTabBgColor":"#E1BEE7",
       "unselectedTabBgColor_ios" : "#00796B",
       "selectedTabIndex_ios" : "0",
       "tabTextFontName_ios" : "xxx",
       "tabTextFontSize_ios" : "13"
};

Notifyvisitors.openNotificationCenter(appInboxInfo, 0, function(callback: any) {
       //do your task here
});

📘

NOTE:

For now in the above function, the callback will only be triggered whenever the close button is clicked otherwise it won't.

UseCase Example
Suppose a user clicks on the Close button in the Notification Center and you want to update its bell icon count.

Notification Count

This function provides the unread count(s) of push notifications. This functionality can be used to show the user number of unread push notification count on the bell icon.

Pass a json object tabCountInfo as the first parameter. Otherwise pass null for standard notification center.
The Key’s value should be static and values will be dynamic

var tabCountInfo = {
      "label_one" : "tab1Label",
      "name_one" : "name_a" ,
      "label_two" : "tab2Label" ,
      "name_two" : "name_b",
      "label_three" : "tab3Label",
      "name_three" : "name_c"
  };

Notifyvisitors.getNotificationCenterCount(tabCountInfo, callback);

//Example
Notifyvisitors.getNotificationCenterCount(tabCountInfo, function(count){
     alert("response : " + count); 
 });

Notification Center Data

This function provides notification center data as JSON in callback. This functionality can be used if a client wants to create their own custom notification center ui.

Notifyvisitors.getNotificationDataListener(callback);

//Example
Notifyvisitors.getNotificationDataListener(function(callback){
  alert("response : " + callback); 
 });

Stop Notification

If a client wants to stop displaying inapp notifications (banners & surveys) then they can call this function in their app.

Notifyvisitors.shared.stopNotification();