Unread Count
The unread count component displays a count of all the unread messages for a given user.
The unread count component displays a count of all the unread messages for a given user. It will typically be embedded in your main menu or sidebar to call attention to any unread messages to which the user should respond.
The component will hide itself if there are no unread messages and display the count whenever unread messages are received. This allows you to always have the iframe displayed on your page.
Installation
The simplest version of the unread count component can be embedded like this:
Both {SURGE_USER_ID}
and {ACCOUNT_TOKEN}
are required parameters. You can find
them in the Surge dashboard. We will also be providing more robust auth options
in the near future.
Styling
With this component, we recommend styling the iframe to allow for automatic expansion. We recommend giving the link container relative positioning so that the iframe can have absolute positioning to allow it to be positioned in the bottom right corner of the link. This allows the button icon to remain centered within the container while the unread count floats over the top of it.
Using Tailwind CSS, that can be accomplished like this:
Events
The Unread Count component emits events that you can listen to in your application. Here are the events that you can listen to:
Count Updated
When the user selects a conversation, this event is emitted with the details of the conversation: