Skip to main content
New to SuprSend React SDK? See how to build a complete react application with Inbox notification, Toast and Preference Centre in task management example app.

Installation

We support 2 SDK’s for react based applications.
  • @suprsend/react-core: This provides context providers and hooks to integrate SuprSend in to your application. If you want to use web-push, user methods, track events or implement your own UI for preferences and inbox by using provided methods, this library is better option. If you want to use any of inbuilt components for inbox or preferences then use @suprsend/react.
  • @suprsend/react: This library is built on top of @suprsend/react-core, so all hooks, context providers and methods that are present in @suprsend/react-core library are also present in this, with addition to that drop-in components like Inbox, NotificationsFeed, Preferences etc are available which comes with UI to ease integration.

Integration

SuprSendProvider

This context provider need to be wrapper around your component in which you want to use SuprSend methods. This is responsible for creating client instance(new SuprSend()), identify and reset user. You can access the SuprSend client instance using useSuprSendClient hook. This instance contains all methods needed to integrate preferences, webpush, track events and user methods.
After implementing the above SuprSendProvider you can be able to use all SuprSend features.

useSuprSendClient

This hook is used to access internal SuprSend client instance which has all methods related to webpush, preferences, user methods and track event. Use this hook inside child of SuprSendProvider.

useAuthenticateUser

This hook is used to get authenticated user anywhere in your application inside SuprSendProvider. This can also be used to check if user is authenticated before calling any method of SuprSend.