Integrating Intercom into a React Native App

Our team has successfully integrated Intercom into the React Native framework we use to create apps for both Android and iOS. An open source library that was a nice kickstarter to get this going was the react-native-intercom package (https://github.com/tinycreative/react-native-intercom). Some interesting things we found along the way are detailed below in hopes the Intercom team will notice and gain better support for react-native (and similar mobile frameworks)

Push Notifications:
react-native-firebase is SUCH a powerful library to use across both Android and iOS. In Android, we had to implement our own FCM handler, and then surface notifications to Intercom & RNFirebase selectively. This was SUPER easy, and Intercom excels here by surfacing isIntercomPush(message) to know who should handle the message. iOS was similar, BUT they don’t allow for FCM in iOS. I know, even firebase is just a passthrough for APN, but it would be a nice option. Similarly in iOS, the ability to check isIntercomPushNotification(userInfo) here is super helpful.

[Android] Dex References:
Won’t go into much detail here, check out my other post here:
https://community.intercom.com/t/20000-dex-references
This still feels like something Intercom should try and address in Android.

Some general things to be aware of:
As a newer iOS developer, I don’t know how much of this is commonplace for an SDK that has a UI component, but the two SDKs are implemented pretty differently. The biggest deal here is that in Android, Intercom lives in its own activity. When launched, your activity will no longer be in the foreground & all the applicable activity lifecycle events apply. On iOS however, the UI is an overlay on top of your app, so your view will continue to believe the it is actively displayed (because a small portion of it is). For us, this means that iOS and Android have different code within the RN javascript bundle to handle the difference, shutting down things in iOS that need to be stopped when the screen is taken by intercom, and in Android, being conscious about how we bring back the activity w/ the focus they were in.

Thanks for reading! Happy to use this thread to provide more detail, answer questions people have about Intercom & React Native.

1 Like

Amazing write up @woody - great to hear the perks and pitfalls of integrating into the React Native framework :+1:

Thanks for this @woody. It was really helpful when I was using the same library to add the messenger to our app.

You mentioned you had to shut down things in iOS that needed “to be stopped when the screen is taken by intercom”. What kinds of things did you need to shut down?

We’re having issues with the entire app crashing when a user tries to submit an image through the messenger, and I’m wondering if we need to shut something down in our JS bundle to prevent that.

Is anyone available to hire for implementation of the react native sdk. We’ve tried multiple times and haven’t had any success with getting the tracking working for logged in users and ability for users to initiate a chat etc