If you are not using any of the In-build UI
components while
designing your custom UI for feed, you can
use @suprsend/react-core SDK.
These hooks and context providers are available in
both
@suprsend/react-core
and @suprsend/react
SDK’s. Integration steps
mentioned in this guide are also same for both.Pre-Requisite
Integrate SuprSendProvider as it is needed for creating SuprSend Client and authenticating user.Installation
In
@suprsend/react-core
v1.0.0, we have changed the pageInfo
object data.
Please refer to Migration
guide
for more details.Integration
SuprSendFeedProvider
This provider internally creates InApp feed client instance and also removes it on unmounting. This should be called inside SuprSendProvider. FeedClient can be accessed using useFeedClient hook.useFeedClient
This hook is used to get Feed client instance. Using this instance you can access feed methods like mark seen, archive, read etc. Use this hook inside SuprSendFeedProvider.useFeedData
This hook returns react state that contains notification store data which includes notifications list and other meta data. This state gets updated internally when there is any update in store. Use this state to render UI in your application. Use this hook inside SuprSendFeedProvider.Example
Using built-in components in headless implementation
We exported few inbuilt components you can use to save time while building your own UI. If you are using@suprsend/react-core
and want to use these components please remove that package and install @suprsend/react
, integration steps remain unchanged other than changing import statement.
NotificationCard component
This is single notification card component. It will be handy if you want to implement your own UI but want to just use our notification card as it has a bit complex logic and UI.
Please refer Customising CSS styles section to view typedefs for INotificationCardTheme
.
BodyMarkdown component
This is simple div element but also supports rendering of markdown language. Read more about the component.Sample Notification JSON Structure
Field | Type | Description |
---|---|---|
n_id | string | Unique notification ID for a message. |
n_category | string | Category of the notification. Used to fetch and apply category-level preferences (e.g., transactional , marketing ). You can also use categories to group notifications in different tabs. |
created_on | number | Timestamp (epoch ms) when the notification reached the inbox. |
seen_on | number | Timestamp (epoch ms) when the notification was first seen. |
read_on | number | Timestamp (epoch ms) when the notification was marked as read using the markAsRead method. |
interacted_on | number | Timestamp (epoch ms) when the user clicked or interacted with the notification. |
message | object | Payload containing the actual notification content and metadata. |
tenant_id | string | Tenant identifier. Used to identify the tenant in a multi-tenant setup. |
is_pinned | boolean | Whether the notification is pinned in the inbox. Pinned notifications remain fixed at the top of the inbox feed. Commonly used for critical messages that should not scroll down as new notifications arrive. |
archived | boolean | Whether the notification has been archived by the user. Archived notifications are hidden from the inbox feed by default unless you explicitly pass is_archived = false in the store config. |
is_expiry_visible | boolean | Whether the notification’s expiry is visible to the user. Expiry details are found inside the message object. Useful when you want notifications to auto-delete after a certain time. |
message
Object Fields
Field | Type | Description |
---|---|---|
schema | string | Schema version for the message format. |
header | string | Main title/header of the notification. |
text | string | Body text of the notification; supports Markdown and HTML content. Default format is markdown. |
subtext | object | Secondary text with optional action_url . Is visible below the main text. Generally used to show additional information or footer text. |
avatar | object | Avatar image shown with the notification, generally used to show sender’s profile picture; can include an action link. |
url | string | URL where user will be redirected when they click the notification. |
extra_data | string | JSON string for passing additional data that can be used to design custom notification card UI. |
tags | array | List of tags to classify the notification (e.g., feature_launch , mentions ). Generally used to filter and organize notifications inside multiple tabs. |
is_expiry_enabled | boolean | Whether expiry handling is enabled for this notification. Expiry is set for notifications that are supposed to auto delete after a certain time (e.g., upcoming maintenances, events, etc.). Used to send notifications like upcoming maintenances, events, etc. |
expiry | object | Expiry configuration (format, type, visibility, value) set when is_expiry_enabled is true. |
is_pinned | boolean | Whether this message should pin at top of the notification feed. Generally used to send critical notifications to the user that you don’t want to go down when new notifications are added. |
actions | array | List of call-to-action buttons (each with url and name ). |