ComRaidComRaid Docs

Migrate from RNFirebase

Move React Native Firebase messaging to ComRaid.

Replace @react-native-firebase/messaging and Notifee with @comraid/react-native. Migrate-only — do not run two FirebaseMessagingService implementations.

Migrate only — do not coexist

ComRaid registers its own FCM messaging service (com.comraid.android.internal.ComraidMessagingService). Running that alongside @react-native-firebase/messaging (or another FirebaseMessagingService) is unsupported — only one service receives messages. Remove RNFirebase messaging and Notifee; keep Firebase as a host dependency for FCM when the Android / Expo plugin needs it.

  • Uninstall @react-native-firebase/messaging and @notifee/react-native (and related dual-service wiring).
  • Install @comraid/react-native and use its Expo config plugin or native SDK setup — see React Native SDK.
  • Do not add forwarding from RNFirebase or expo-notifications into ComRaid.

Audience CSV import from OneSignal is a separate path — Migrate from OneSignal.

API mapping

ComRaid JS event names match RNFirebase messaging so call sites can move mechanically. Tray promotion replaces Notifee display.

RNFirebase / NotifeeComRaid
messaging().onMessageComRaid.onMessage
messaging().setBackgroundMessageHandlerComRaid.setBackgroundMessageHandler (register from the app entry file before other setup)
messaging().onNotificationOpenedAppComRaid.onNotificationOpenedApp
messaging().getInitialNotificationComRaid.getInitialNotification
messaging().getTokenComRaid.getToken (Provider FCM/APNs token — not an Endpoint id)
messaging().onTokenRefreshComRaid.onTokenRefresh
notifee.displayNotification / createChannelComRaid.presentNotification (optional tray from a received message; channel defaults via initialize / Expo plugin)
notifee foreground/background press eventsComRaid.onNotificationOpenedApp / getInitialNotification (action taps include actionId; presentNotification auto-ACKs opened)
FirebaseMessagingService subclass / dual serviceRemove — Expo plugin registers ComraidMessagingService; set android.includeMessagingService: false only if you subclass that ComRaid service

Event payloads include messageId, deliveryId, title, body, data (sender keys only), deepLink, actions when present, and presentation fields (imageUrl, subtitle, sound, badge, threadId, androidChannelId, priority). See the React Native receive event table. iOS images need a Notification Service Extension — Images and action buttons (iOS).

Data-only Notifications

A Data-only Notification sets content.push.data_only: true. The Provider does not draw system tray UI; optional title, body, and actions are app hints. Message data must be a non-empty object. Send via the API or @comraid/node — there is no Dashboard data_only toggle. Full Content rules: Notifications.

Reliability caveats

  • Android force-stop — if the user force-stops the app, data-only (and other) pushes may not wake it until the user opens the app again. Do not treat delivery as guaranteed.
  • iOS best-effort — data-only uses background / content-available delivery. iOS may delay or skip waking the app. When the OS runs your code, ComRaid bridges into the same JS handlers as Android.
  • Delivered ≠ opened — receive ACK records delivered; opened is not implied. Tray taps from presentNotification auto-ACK opened; in-app UI must call acknowledgeOpened explicitly if you want CTR.

Rematch example: tray vs modal

Game-invite / rematch flows often send ACCEPT / REJECT on a Data-only Notification. The app chooses presentation: promote to the shade with presentNotification, or show an in-app modal.

Send (API / Node)

import { ComRaid } from "@comraid/node";

const comraid = new ComRaid({ apiKey: process.env.COMRAID_API_KEY });

await comraid.push.send({
  to: { external_user_ids: ["user_42"] },
  data: { type: "rematch", match_id: "m_100" },
  content: {
    data_only: true,
    title: "Rematch?",
    body: "Player_7 wants to play again.",
    actions: [
      { id: "accept", text: "Accept" },
      { id: "reject", text: "Reject" },
    ],
  },
  idempotencyKey: comraid.createIdempotencyKey(),
});

Promote to tray

Call presentNotification from a receive handler when you want a shade item. Body and action taps fire open callbacks and auto acknowledgeOpened (with actionId for buttons).

import { ComRaid } from '@comraid/react-native';

// App entry — before other setup
ComRaid.setBackgroundMessageHandler(async (message) => {
  if (message.data?.type === 'rematch') {
    await ComRaid.presentNotification(message);
  }
});

ComRaid.onMessage(async (message) => {
  if (message.data?.type === 'rematch') {
    await ComRaid.presentNotification(message);
  }
});

ComRaid.onNotificationOpenedApp((message) => {
  if (message.actionId === 'accept') {
    // route into rematch
  }
});

In-app modal (explicit ACK)

If you draw your own UI, do not call presentNotification. Call acknowledgeOpened yourself when the user acts (or skip opens if you do not want CTR for that path).

ComRaid.onMessage((message) => {
  if (message.data?.type !== 'rematch') return;
  showRematchModal({
    title: message.title,
    body: message.body,
    onAccept: async () => {
      if (message.deliveryId && message.attributionToken) {
        await ComRaid.acknowledgeOpened(
          message.deliveryId,
          message.attributionToken,
          'accept',
        );
      }
      // start rematch
    },
    onReject: async () => {
      if (message.deliveryId && message.attributionToken) {
        await ComRaid.acknowledgeOpened(
          message.deliveryId,
          message.attributionToken,
          'reject',
        );
      }
    },
  });
});

Next

On this page