Tell your users about News they haven't read yet

Tell your users about News they haven't read yet

Written by Remi Delhaye
Last update: Monday, Jan 20, 2025

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 _polaria.unreadNewsIds array along with the news_read event. Here is a usage example:

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


REST API - Post Categories

6 articles in this category.
Written by Remi Delhaye.