Newsfeed embeddable widget

The Newsfeed widget acts as a notification center attached to a custom element in your application.

The Newsfeed announcement type is typically used for announcing new features or general changes in your application. The best part of this tool is it can be displayed as a widget embedded into your application.

Integration

The widget can be integrated easily by using our JavaScript API. Check the following example code with comments:

// When your custom element is rendered in your application.
// If you use React, get a "ref" is the launcher element
const customLauncher = document.getElementById('newsfeed-launcher');

// If you want to render a badge with number of unread items...
//
// If you want to get the initial number of unread items,
// attach this event BEFORE the attachNewsWidgetToElement method call.
window.productFruits.api.announcementsV2.listen('newsfeed-unread-count-changed', (data) => {
	const unreadCount = data.count;
	
	// Render the count in your UI. We don't render badges automatically, it is up to you.
});

// Later, when the PF JS API is available, call the following API method and pass the element instance.
window.productFruits.api.announcementsV2.attachNewsWidgetToElement(customLauncher);