Tell your users about News they haven't read yet

Tell your users about News they haven't read yet

Last update: Wednesday, Apr 14, 2021

When you add a news to your newsfeed, it will be added in the list located in your chatbox. In this case, you might want your users to be aware about it without actually opening the chatbox.

Using a pre-built badge

By adding the class asktech-badge to an element, a badge will be displayed in the top right corner of this element, showing the number of unread news. Your user will then be able to click on this element to open the news list, which will clear the badge for further visits until you release an additional news.

Using the Javascript API

If you need a cutom solution, you can use the _xeno.unreadNewsIds array along with the news_read event. Here is a usage example:

window._xenoSettings = {
  /* ... Your settings */
  onInit: function(_xeno) {
    _xeno.on('ready', function() {
      if (_xeno.unreadNewsIds.length) {
        // Add unread indicator
      }
    });
    _xeno.on('news_read', function() {
      // Clear indicator
    });
  }
};


REST API - Post Categories

6 articles in this category.