Show Developer Menu

Unread Messages Callback

Benefits

When customers are authenticated you'll be able to display the count of unread messages in your application UI. This way, your customers will be notified of your replies immediately, without needing to leave your site to check their email.

When you're using the standard shoutbox with the built in icon trigger, the unread count UI is provided for you as part of the icon. You will only need to implement the callback below if you are using a custom lightbox trigger or if you're looking to add the count to your application UI.

Installation

Make sure you have the Reamaze.js snippet installed from the Installation Step and authentication from the Auth & SSO Step.

<script type="text/javascript">
  _support['unread_callback'] = function(data) {
    // your code here. 'data.count' contains the unread count
  }
</script>

Replace the body of the callback function above with your application specific logic. For example, you can take data.count and render it in a notification badge.

Next Step

If you're implementing your Reamaze.js integration in a single page page, you may need to reinitalize Reamaze after a UI refresh or AJAX page load. We'll cover that in the next section.

Next: Single Page Apps →