Notify Users When a New Notification Arrives

Learn how to add a hook to the new notification event

You might want to play a sound or show a toast when a new notification arrives. We expose the onNewNotification hook to help you achieve it. When you initialize your notification inbox, define the onNewNotification function. This function receives the new notification as its only argument.

The following example shows how to show an alert when a new notification arrives: