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
npm install @clariodesk/react-native-push \
@react-native-firebase/app @react-native-firebase/messaging
Wire the token provider
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:
import messaging from '@react-native-firebase/messaging';
import { ClarioDesk } from '@clariodesk/react-native';
messaging().setBackgroundMessageHandler(async (msg) => {
if (ClarioDesk.isClarioMessage(msg.data ?? {})) return; // ours — SDK handles it
/* your app's own handling */
});
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.
Deep-link on tap
On a notification tap, navigate straight to the ticket:
// Imperative
ClarioDesk.openTicketFromPush(data);
// …or via the hook
import { usePushOpened } from '@clariodesk/react-native/hooks';
usePushOpened((ticketId) => navigateToSupport(ticketId));
Preferences
const prefs = await ClarioDesk.getNotificationPreferences();
await ClarioDesk.setNotificationPreferences({ ...prefs, agentReplies: true });
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.