How do I install Intercom on React? | Community
Skip to main content
Answered

How do I install Intercom on React?

  • Jun 26, 2020 10:11 AM UTC
  • 10 replies
  • 617 views

10 replies

Eric Fitz
Employee
Forum|alt.badge.img+5
  • Employee
  • Answer
  • Jun 26, 2020 10:28 AM UTC

  • New Participant
  • Aug 14, 2020 9:31 PM UTC

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?


Eric Fitz
Employee
Forum|alt.badge.img+5
  • Employee
  • Aug 17, 2020 3:19 PM UTC

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


Eric Fitz
Employee
Forum|alt.badge.img+5
  • Employee
  • Sep 18, 2020 11:37 AM UTC

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

 

 


  • New Participant
  • Jun 17, 2021 6:22 AM UTC

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


Eric Fitz
Employee
Forum|alt.badge.img+5
  • Employee
  • Jun 17, 2021 8:50 AM UTC

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?


Eric Fitz
Employee
Forum|alt.badge.img+5
  • Employee
  • Jun 25, 2021 11:20 AM UTC

@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 😄


  • New Participant
  • Jun 25, 2021 12:29 PM UTC

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


  • New Participant
  • Jul 19, 2021 8:31 AM UTC

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

 


Eric Fitz
Employee
Forum|alt.badge.img+5
  • Employee
  • Jul 19, 2021 10:27 AM UTC

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