Skip to main content
📘 Upgrading major version of SDK:We have changed the web SDK authentication from workspace key-secret to public key and JWT based authentication. This is done to improve security in frontend applications.
This is the client JavaScript SDK used to integrate SuprSend features like Webpush, Preferences in JavaScript websites like React, Next.js, Angular, Vue.js etc.

NPM Link

GitHub Link

Installation

Integration

1

Create Client

Create suprSendClient instance and use same instance to access all the methods of SuprSend library.
2

Authenticate User

Authenticate user so that all the actions performed after authenticating will be w.r.t that user. This is mandatory step and need to be called before using any other method. This is usually performed after successful login and on reload of page to re-authenticate user.
Returns: Promise<ApiResponse>

2.1 Check if user is authenticated

This method will check if user is authenticated i.e. distinctId is attached to SuprSend instance. To check for userToken also pass checkUserToken flag true.
3

Reset user

This will remove user data from SuprSend instance. This is usually called on logout action.
Returns: Promise<ApiResponse>

Response structure

Almost all the methods in this SDK return response type Promise<ApiResponse>