Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.suprsend.com/llms.txt

Use this file to discover all available pages before exploring further.

@suprsend/expo-sdk combines the headless inbox feed from @suprsend/react-core with native push notifications (FCM + APNs) via expo-notifications.

Install

npx expo install @suprsend/expo-sdk \
  expo-notifications expo-secure-store expo-application

SuprSendExpoProvider

SuprSendExpoProvider identifies the current user and is required by both the feed and push notification providers. Wrap your app (or the authenticated portion of it) with it once:
import { SuprSendExpoProvider } from "@suprsend/expo-sdk";

export default function App() {
  return (
    <SuprSendExpoProvider
      publicApiKey={process.env.SUPRSEND_PUBLIC_KEY!}
      distinctId={currentUser.id}
      userToken={currentUser.suprsendToken}
    >
      <RootNavigator />
    </SuprSendExpoProvider>
  );
}
interface SuprSendExpoProviderProps {
  publicApiKey: string;
  distinctId?: unknown;
  userToken?: string; // jwt token needed when enhanced security mode is enabled
  host?: string; // custom host url
  refreshUserToken?: (
    oldUserToken: string,
    tokenPayload: Dictionary,
  ) => Promise<string>; // called after current user token expiry, call your BE api and return new user token
}
See client authentication for how to generate userToken on your backend. Passing null (or undefined) for distinctId after a user was previously identified resets the client and clears the authenticated user — use this on logout. Inside this provider you can mount SuprSendFeedProvider (for the inbox feed) and/or SuprSendPushProvider (for push notifications) — each is independent, so use whichever your app needs.

useSuprSendClient

This hook contains the SuprSend client instance and has all the methods like preferences, user methods, etc. Read more in the @suprsend/react-core README.