Answered

How do I install Intercom on React?


Userlevel 2
Badge

How can I install Intercom on React Native?

icon

Best answer by Eric Fitz 26 June 2020, 12:28

View original

10 replies

Userlevel 1

Here are our instructions on how to install Intercom using our official React Native SDK.

Hey Eric,

 

the react packages that I found look not very good to have something “clean“.

 

if we are using react native to développe our app do you think that use a webview + Segment to push event to intercom could be a good workaround?

Userlevel 1

Hey @user675​, when you say "use a webview", can you tell me more about what you're hoping to achieve?

Userlevel 1

I'm sharing an answer from our old dev community which folks may find helpful!

 

"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-intercom468). 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.

 

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."

 

 

hi @eric f11​  Do your lib can intergrate with chat bot of intercom?

Userlevel 1

Hey @thuy​, when you say "integrate with chat bot", can you tell me a little more about what you're looking to do, specifically? Do you mean Custom Bots or Resolution Bot?

Userlevel 1

@user675​ @thuy​ We now officially support React Native, and I've updated my first response to link to our instructions on how to do this 😄

Oh wow @eric f11​ That's an amazing news !!!

That is great news!

Do you plan to support expo plugin config? This would allow your library to work with expo SDK41+ which would be amazing

 

Userlevel 1

Hey @jordane​, no plans to support expo plugin config right now.

Reply