> ## 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.

# Integration

`@suprsend/expo-sdk` combines the headless inbox feed from [`@suprsend/react-core`](https://github.com/suprsend/suprsend-react-core) with native push notifications (FCM + APNs) via [`expo-notifications`](https://docs.expo.dev/versions/latest/sdk/notifications/).

## Install

<CodeGroup>
  ```bash expo theme={"system"}
  npx expo install @suprsend/expo-sdk \
    expo-notifications expo-secure-store expo-application
  ```
</CodeGroup>

## 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:

<CodeGroup>
  ```tsx App.tsx theme={"system"}
  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>
    );
  }
  ```
</CodeGroup>

<CodeGroup>
  ```ts TypeDef theme={"system"}
  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
  }
  ```
</CodeGroup>

See [client authentication](/docs/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`](/docs/expo-inbox) (for the inbox feed) and/or [`SuprSendPushProvider`](/docs/expo-push-notifications) (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](https://github.com/suprsend/suprsend-react-core?tab=readme-ov-file#usesuprsendclient).

***
