> ## Documentation Index
> Fetch the complete documentation index at: https://docs.clariodesk.com/llms.txt
> Use this file to discover all available pages before exploring further.

# React Native push

> Firebase-backed push via a separate package, so Firebase never autolinks into headless hosts.

Push is a separate package (`@clariodesk/react-native-push`), so Firebase's
native code never autolinks into a host that doesn't want it. Your app owns the
messaging plugin; the SDK receives tokens through a `PushTokenProvider` seam.

## Install

```sh theme={null}
npm install @clariodesk/react-native-push \
  @react-native-firebase/app @react-native-firebase/messaging
```

## Wire the token provider

```ts theme={null}
import { ClarioDesk } from '@clariodesk/react-native';
import { FirebaseTokenProvider } from '@clariodesk/react-native-push';

await ClarioDesk.init({
  apiKey: 'pk_live_…',
  pushTokenProvider: new FirebaseTokenProvider(),
});
```

## Route messages in your background handler

In your shared background/foreground handler, hand ClarioDesk messages back to
the SDK so they don't collide with your app's own notifications:

```ts theme={null}
import messaging from '@react-native-firebase/messaging';
import { ClarioDesk } from '@clariodesk/react-native';

messaging().setBackgroundMessageHandler(async (msg) => {
  if (ClarioDesk.isClarioMessage(msg.data ?? {})) return; // ours, the SDK handles it
  /* your app's own handling */
});
```

<Warning>
  Registering the background handler in `index.js` at startup is the #1 push
  setup-failure cause. It must run at app entry, not inside a component, or
  background messages are silently dropped.
</Warning>

## Deep-link on tap

On a notification tap, navigate straight to the ticket:

```ts theme={null}
// Imperative
ClarioDesk.openTicketFromPush(data);

// …or via the hook
import { usePushOpened } from '@clariodesk/react-native/hooks';
usePushOpened((ticketId) => navigateToSupport(ticketId));
```

## Preferences

```ts theme={null}
const prefs = await ClarioDesk.getNotificationPreferences();
await ClarioDesk.setNotificationPreferences({ ...prefs, agentReplies: true });
```

<Note>
  Remote push is not available in Expo Go. Use a dev build / EAS for push. The
  backend is presence-aware and suppresses a push when the user is already
  connected live. See the [push concept page](/concepts/push-notifications).
</Note>
