Skip to main content
NOTE: Refer type definitions for this guide here .

Initialise feed client

Using SuprSend client instance create Feed client instance.
If you are passing tenant_id in feed, make sure to pass scope key while creating userToken else 403 error will be thrown due to scope mismatching.

Feed client

Get feed data

This returns notification store which contains list of notifications and other meta data like page information etc. You can call this anytime to get updated store data.

Initialise socket for realtime update

Fetching notification data

This method will get first page of notifications from SuprSend server and set data in notification store.

Fetch more notifications

This method will get next page of notifications from SuprSend server and set data in notification store.

Listening for updates to store

Whenever there is update in notification store (ex: on new notification or existing notification state updated) this event is fired by library. You can listen to this event and update your local state so that UI of you application is refreshed.

Listening for new notification

In case you want to show toast notification on receiving new notification you can use this listener.

Removing feed

This will remove feed client data and abort socket connection. Additionally calling suprSendClient.reset method during logout will also remove all feedClient instances attached SuprSend client instance.

Other methods

Example

For understanding purpose we have added current simple example in react. You could refer this headless example and design the feed in your Angular or Vue.js etc. If you want to implement in react please refer @suprsend/react-core or @suprsend/react