Skip to main content

Hello,
We have an issue when using Expo + CustomerIO + Intercom for notifications, on Android. We don't receive notifications from Intercom after installing CustomerIO.
On iOS, everything works fine, we receive notifications from CustomerIO as well as from Intercom without any issue.

**SDK version:**

{
    "@intercom/intercom-react-native": "^7.1.3",
    "customerio-expo-plugin": "^1.0.0-beta.15",
    "customerio-reactnative": "3.7.0"
}

**Environment:** Android only

**Are logs available?** 
No logs available

**Describe the bug**
Push notifications are not received from Intercom after installing CIO SDK.

**To Reproduce**
- Create a fresh expo app
- Install intercom (and add the plugin in `app.config.ts`)
- Push notifications are received from Intercom
- Install CIO sdk (and add the plugin in `app.config.ts`)
- Push notifications are not received from Intercom anymore

**Expected behavior**
We would expect to be able to receive both CIO and Intercom notifications.

**Additional context**
For context, we already have the setup CustomerIO + Intercom and receiving notifications from both, in our react-native setup (without Expo).
The problem appears when we try to migrate to Expo.
Initially, the problem is the same on React-Native, and we had to override the `FirebaseMessagingService` to make it work, dispatching in both cases depending on Intercom or CustomerIO, see below.


package com.goliaths.app;

import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
import com.intercom.reactnative.IntercomModule;
import io.customer.messagingpush.CustomerIOFirebaseMessagingService;

public class MainNotificationService extends FirebaseMessagingService {

  @Override
  public void onNewToken(String refreshedToken) {
    CustomerIOFirebaseMessagingService.onNewToken(this, refreshedToken);
    IntercomModule.sendTokenToIntercom(getApplication(), refreshedToken);
    //DO LOGIC HERE
  }

  public void onMessageReceived(RemoteMessage remoteMessage) {
    boolean handled = CustomerIOFirebaseMessagingService.onMessageReceived(getApplication(), remoteMessage);
    if (handled) {
      // Handled by customerIO
    } else if (IntercomModule.isIntercomPush(remoteMessage)) {
      IntercomModule.handleRemotePushMessage(getApplication(), remoteMessage);
    } else {
      // HANDLE NON-INTERCOM MESSAGE
    }
  }
}

Modifying the native files when using Expo becomes very complicated (using the custom plugins) and it doesn't seem worth to migrate to Expo if we still need to manage this kind of native issues.

Is there a way for you to handle this on the Intercom side directly? Or maybe do we need to ask to Intercom if they could do it? Maybe by exposing to the JS some functions to forward the received notifications from our custom handler directly to Intercom SDK?
I am really not sure who has to take action for this setup "Expo + CustomerIO + Intercom" to work gracefully.

This is the last step preventing us to fully migrate to Expo, so I'm really looking forward for a solution on this.
Maybe someone already has a plugin that would create the `FirebaseMessagingService` just like in a react-native setup?

Thank you very much

Be the first to reply!

Reply