Giter Club home page Giter Club logo

react-native-intercom's Introduction

Official Package

Intercom has released an official package for React Native. Please use it.

https://github.com/intercom/intercom-react-native

react-native-intercom [DEPRECATED]

React Native wrapper for Intercom.io. Based off of intercom-cordova

Installation Guide

  1. Install Intercom for iOS via whichever method you prefer.

    More recently others have had more success Installing Intercom Manually.

    In the past, installing via CocoaPods was recommended.

  2. Install react-native-intercom:

    yarn add react-native-intercom  # or npm install react-native-intercom
  3. Link native dependencies

    react-native link react-native-intercom
  4. Manually Link the library in Xcode (Linking librarys on iOS)

    1. Open Xcode -> Right click "[Your Project Name]/Libraries" folder and select "Add File to [Your Project Name]" -> Select RNIntercom.xcodeproj located in node_modules/react-native-intercom/iOS.
    2. Open "General Settings" -> "Build Phases" -> "Link Binary with Libraries" and add libRNIntercom.a
  5. Config for iOS (intercom-ios)

    1. Add #import "Intercom/intercom.h" with the other imports at the top of ios/YOUR_PROJECT/AppDelegate.m.

    2. Initialize Intercom in ios/YOUR_PROJECT/AppDelegate.m with your Intercom iOS API Key and your Intercom App ID:

      - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
      
          // Intercom
          [Intercom setApiKey:@"YOUR_IOS_API_KEY_HERE" forAppId:@"YOUR_APP_ID_HERE"];
      
      }
    3. Optional, Intercom's documentation suggests adding the following call in order to receive push notifications for new messages:

      - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
      
          // Intercom
          [Intercom setDeviceToken:deviceToken];
      
      }
    4. Optional, allow access to photos on iOS. Open Info.plist in Xcode and add a new key "Privacy - Photo Library Usage Description". Or alternately, open ios/YOUR_PROJECT/Info.plist and add:

      <dict>
      
        ...other configuration here...
      
        <key>NSPhotoLibraryUsageDescription</key>
        <string>Send photos to help resolve app issues</string>
      
        ...other configuration here...
      
      </dict>
  6. Config for Android (intercom-android)

    1. In android/app/src/main/java/com/YOUR_APP/app/MainApplication.java, add the following code in the respective sections of the file using your Intercom Android API Key and Intercom App ID:

      // ...other configuration here...
      
      import com.robinpowered.react.Intercom.IntercomPackage;
      import io.intercom.android.sdk.Intercom;
      
      public class MainApplication extends Application {
      
        @Override
        public void onCreate() {
          super.onCreate();
          Intercom.initialize(this, "YOUR_ANDROID_API_KEY_HERE", "YOUR_APP_ID_HERE");
      
          // ...other configuration here...
      
        }
      
        public List<ReactPackage> getPackages() {
            // ...other configuration here...
      
            packages.add(new IntercomPackage());
      
            // ...other configuration here...
        }
      }
    2. In android/build.gradle add maven { url "https://maven.google.com" } (h/t):

      allprojects {
        repositories {
      
          //...other configuration here...
      
          maven { url "https://maven.google.com" }
        }
      }
    3. Decide which type of push messaging you want to install, and add choosen method to android/app/build.gradle.

      1. If you'd rather not have push notifications in your app, you can use this dependency:

        dependencies {
            implementation 'io.intercom.android:intercom-sdk-base:5.+'
        }
      2. If "Firebase Cloud Messaging(FCM)", then:

        dependencies {
        
          //...other configuration here...
        
          implementation 'io.intercom.android:intercom-sdk-base:9.+'
          implementation 'io.intercom.android:intercom-sdk:9.+'
        }

        If you're already using FCM in your application you'll need to extend FirebaseMessagingService to handle Intercom's push notifications (refer to Using Intercom with other FCM setups)

        Here's an example if you're using react-native-firebase as your existing FCM setup:

        I. Add a new file if you don't have one (android/app/src/main/java/com/YOUR_APP/MainMessagingService.java)

        package com.YOUR_APP;
        import io.invertase.firebase.messaging.*;
        import android.content.Intent;
        import android.content.Context;
        import io.intercom.android.sdk.push.IntercomPushClient;
        import io.invertase.firebase.messaging.ReactNativeFirebaseMessagingService;
        import com.google.firebase.messaging.RemoteMessage;
        import android.util.Log;
        import java.util.Map;
        
        public class MainMessagingService extends ReactNativeFirebaseMessagingService {
            private static final String TAG = "MainMessagingService";
            private final IntercomPushClient intercomPushClient = new IntercomPushClient();
        
            @Override
            public void onMessageReceived(RemoteMessage remoteMessage) {
                Map message = remoteMessage.getData();
        
                if (intercomPushClient.isIntercomPush(message)) {
                    Log.d(TAG, "Intercom message received");
                    intercomPushClient.handlePush(getApplication(), message);
                } else {
                    super.onMessageReceived(remoteMessage);
                }
            }
        }

        II. Then add the following code to android/app/src/main/AndroidManifest.xml:

        <?xml version="1.0" encoding="utf-8"?>
        <manifest package="com.YOUR_APP"
        
          ...other configuration here...
        
        >
          <application
        
            ...other configuration here...
        
            xmlns:tools="http://schemas.android.com/tools"
          >
        
            <!-- ...other configuration here... -->
            <!-- ...ADD THE SERVICE BELOW... -->
            <service
              android:name=".MainMessagingService"
              android:enabled="true"
              android:exported="true">
                <intent-filter>
                  <action android:name="com.google.firebase.MESSAGING_EVENT" />
                </intent-filter>
            </service>
          </application>
        </manifest>
        • make sure you have only one service intent with action com.google.firebase.MESSAGING_EVENT
  7. Import Intercom and use methods

    import Intercom from 'react-native-intercom';
    // or…
    // var Intercom = require('react-native-intercom');
    Intercom.registerIdentifiedUser({ userId: 'Bob' });
    Intercom.logEvent('viewed_screen', { extra: 'metadata' });
    
    //...rest of your file...

    Note that calling Intercom.registerIdentifiedUser({ userId: 'Bob' }) (or Intercom.registerUnidentifiedUser()) is required before using methods which require that Intercom know the current user… such as Intercom.displayMessageComposer(), etc.

Usage

Import or Require the module

import Intercom from 'react-native-intercom';

or

var Intercom = require('react-native-intercom');

Log an event

Intercom.logEvent('viewed_screen', { extra: 'metadata' });

Register a Logged In user

Intercom.registerIdentifiedUser({ userId: 'bob' });

Register Unidentified user

Intercom.registerUnidentifiedUser();

Register a Logged In user and post extra metadata

Intercom.registerIdentifiedUser({ userId: 'bob' })
Intercom.updateUser({
    // Pre-defined user attributes
    email: '[email protected]',
    user_id: 'user_id',
    name: 'your name',
    phone: '010-1234-5678',
    language_override: 'language_override',
    signed_up_at: 1004,
    unsubscribed_from_emails: true,
    companies: [{
        company_id: 'your company id',
        name: 'your company name'
    }],
    custom_attributes: {
        my_custom_attribute: 123
    },
});

Set User Hash for Identity Validation (optional)

Intercom.setUserHash(hash_received_from_backend)

Sign Out

Intercom.logout()

Show Message Composer

Intercom.displayMessageComposer();

Show Message Composer with an Initial Message

Intercom.displayMessageComposerWithInitialMessage('Initial Message');

Display Latest Conversation

Intercom.displayMessenger();

Display Conversations List

Intercom.displayConversationsList();

Display Help Center

Intercom.displayHelpCenter();

Set Bottom Padding

Intercom.setBottomPadding(64);

Display Help Center

Intercom.displayHelpCenter();

Note that before calling Intercom.displayHelpCenter() it is required to enable Help Center in your Intercom settings.

Present a Carousel

Intercom.presentCarousel(carouselID);

Note that before calling Intercom.presentCarousel(carouselID) it is required to enable carousels and create a carousel in your Intercom settings.

Listen for Unread Conversation Notifications

componentDidMount() {
  Intercom.addEventListener(Intercom.Notifications.UNREAD_COUNT, this._onUnreadChange)
}

componentWillUnmount() {
  Intercom.removeEventListener(Intercom.Notifications.UNREAD_COUNT, this._onUnreadChange);
}

_onUnreadChange = ({ count }) => {
  //...
}

Other Notifications

    // The window was hidden
    Intercom.Notifications.WINDOW_DID_HIDE

    // The window was shown
    Intercom.Notifications.WINDOW_DID_SHOW

Send FCM token directly to Intercom for push notifications (Android only)

Firebase.messaging().getToken()
  .then((token) => {
    console.log('Device FCM Token: ', token);
    Intercom.sendTokenToIntercom(token);
});

react-native-intercom's People

Contributors

asamiller avatar atticoos avatar beausmith avatar browniefed avatar ciocan avatar duailibe avatar export-mike avatar iagormoraes avatar ifero avatar kageurufu avatar kgnadinger avatar kuglemic avatar leolebras avatar ljcp avatar lucasfronza avatar luizparreira avatar mathieumg avatar melvynhills avatar michaelknoch avatar mirtinika avatar mstllc avatar nbokmans avatar negativetwelve avatar nikitawolfik avatar phips28 avatar radko93 avatar renanpupin avatar rogchap avatar secobarbital avatar slorber avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

react-native-intercom's Issues

Does the file-attach functionality work ok on Android?

screenshot from 2016-09-27 12-29-14

Clicking on the attach icon gives the following in logcat -

09-27 12:33:34.650  1531  1723 I ActivityManager: START u0 {act=android.content.pm.action.REQUEST_PERMISSIONS pkg=com.android.packageinstaller cmp=com.android.packageinstaller/.permission.ui.GrantPermissionsActivity (has extras)} from uid 10073 on display 0
09-27 12:33:34.664  1531  2672 W InputMethodManagerService: Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@ce0b9e attribute=null, token = android.os.BinderProxy@5fe4c9b

I don't have much experience with Android. Probably this is a permissions issue to be fixed in my AndroidManifest?

Could not find com.android.support:recyclerview-v7:24.2.1

Any ideas why we are getting this error message upon compiling on Android? (the compilation fails)

A problem occurred configuring project ':react-native-intercom'.
Could not resolve all dependencies for configuration ':react-native-intercom:_debugCompile'.
> Could not find com.android.support:recyclerview-v7:24.2.1.

Upgraded version of Android SDK

Just wanted to check if you've got any plans or ongoing work on updating the Intercom SDK for Android?

The current implementation looks like it is using 1.+ while Intercom has released 3.+.

Building iOS failed

I followed instructions mentioned in README.md but I couldn't build the iOS app.

Here's Steps that I followed.

  1. npm install react-native-intercom
  2. rnpm link
  3. react-native run-ios

The following build commands failed: CompileC ../ios/build/Build/Intermediates/RNIntercom.build/Debug-iphonesimulator/RNIntercom.build/Objects-normal/x86_64/IntercomWrapper.o IntercomWrapper.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (1 failure)

#import <Intercom/Intercom.h> in IntercomWrapper.m file of react-native-intercom npm module causes above build error.

Did i miss any step that need to be done before do react-native run-ios?

Intercom.h file not found

HI,
I installed the lib and when i compile i get an error that the file Intercom/Intercom.h was not found.

screen shot 2016-05-25 at 14 09 43

Where is this folder and file, i can't even find them in the node_modules

am i missing something?

"no known class method for selector 'presentMessageComposerWithInitialMessage:'"

Hello.

I just received this error while trying to deploy my app.

/node_modules/react-native-intercom/iOS/IntercomWrapper.m:127:19: no known class method for selector 'presentMessageComposerWithInitialMessage:'

[Intercom presentMessageComposerWithInitialMessage:message];

Do you have any idea what may be going on here? Thanks!

Replace call to registerForRemoteNotifications with setDevice

Intercom v2.0.7 was the last version that supported the registerForRemoteNotifications function. v2.1 deprecated this function and replaced it with setDeviceToken

From v2.1:


 ## How do push notifications work?

 The Intercom iOS SDK enables your users to receive push notifications for new messages. Simply call:

    - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
        [Intercom setDeviceToken:deviceToken];
    }

 in your `didRegisterForRemoteNotificationsWithDeviceToken:` method once you have registered your app for 
 push notifications with the `UIApplicationDelegate`.

We should call setDevice and remove the old call (mentioned in #1)

How to open the conversation input?

When I call the method:

Intercom.displayMessenger()

I can see a message saying: "No conversations" but I can not write anywhere. What is the method to allow the user write a message

Thanks!

Android support

Thanks for putting together this package!

I'm in the process today in integrating Android on my fork. I'll throw a pull request your way at some point this week 😄

Android Not Functional

Latest build/release 4.2.0

Looking at the code, this seems to be iOS only, but Android will not load because of it.

undefined is not an object (evaluating 'IntercomEventEmitter.UNREAD_CHANGE_NOTIFICATION') IntercomClient IntercomClient.js:26 <unknown> IntercomClient.js:241 loadModuleImplementation require.js:122 guardedLoadModule require.js:65 _require require.js:49 <unknown> authStore.js:19 loadModuleImplementation require.js:122 guardedLoadModule require.js:65 _require require.js:49 <unknown> index.js:5 loadModuleImplementation require.js:122 guardedLoadModule require.js:65 _require require.js:49 <unknown> index.js:21 loadModuleImplementation require.js:122 guardedLoadModule require.js:65 _require require.js:49 <unknown> index.android.js:1 loadModuleImplementation require.js:122 guardedLoadModule require.js:58 _require require.js:49 global code require-0.js:1

'React/RCTEventEmitter.h' file not found

guys,

first of all, thank you for the awesome job!

I have a small problem though: I am developing an IOS app and I struggle with this for hours now.
When I build project in xCode I get the following:
image

Any idea why does it happen? Thank you!

[Question] How is setupAPN() supposed to get the deviceToken?

I see that the library includes setupAPN(deviceToken). How is the deviceToken supposed to find its way into the JS environment?

It's not an issue because you can just add [Intercom setDeviceToken:deviceToken]; but wanted to know if there was an alternative way or if it's there for API parity.

IntercomWrapper.setBottomPadding is not a function

I'm trying to change the padding of messenger and this error happen. On iOS works fine.

screen shot 2016-12-21 at 17 40 19

Update: Looking on the IntercomModule.java there is no method to easy change the position of icon.

What you think is the best way to do this on Android?

Execution failed for task ':react-native-intercom:processReleaseResources'.

I started getting this error today when building the Android side of my React-Native app. No changes were made to my code, it just popped up. Anyone else run into this?

Here is the output:

[14:08:55]: Exit status of command '/Users/distiller/mobile/android/gradlew assembleAcceptance -p android/' was 1 instead of 0.
Incremental java compilation is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preAcceptanceBuild UP-TO-DATE
:app:checkAcceptanceManifest
:app:preDebugBuild UP-TO-DATE
:app:preReleaseBuild UP-TO-DATE
:app:preStagingBuild UP-TO-DATE
:app:preUiTestBuild UP-TO-DATE
:react-native-device-info:preBuild UP-TO-DATE
:react-native-device-info:preReleaseBuild UP-TO-DATE
:react-native-device-info:checkReleaseManifest
:react-native-device-info:preDebugAndroidTestBuild UP-TO-DATE
:react-native-device-info:preDebugBuild UP-TO-DATE
:react-native-device-info:preDebugUnitTestBuild UP-TO-DATE
:react-native-device-info:preReleaseUnitTestBuild UP-TO-DATE
:react-native-device-info:prepareComAndroidSupportAppcompatV72301Library
:react-native-device-info:prepareComAndroidSupportRecyclerviewV72301Library
:react-native-device-info:prepareComAndroidSupportSupportV42400Library
:react-native-device-info:prepareComFacebookFrescoDrawee0110Library
:react-native-device-info:prepareComFacebookFrescoFbcore0110Library
:react-native-device-info:prepareComFacebookFrescoFresco0110Library
:react-native-device-info:prepareComFacebookFrescoImagepipeline0110Library
:react-native-device-info:prepareComFacebookFrescoImagepipelineBase0110Library
:react-native-device-info:prepareComFacebookFrescoImagepipelineOkhttp30110Library
:react-native-device-info:prepareComFacebookReactReactNative0381Library
:react-native-device-info:prepareComFacebookSoloaderSoloader010Library
:react-native-device-info:prepareComGoogleAndroidGmsPlayServicesBase1020Library
:react-native-device-info:prepareComGoogleAndroidGmsPlayServicesBasement1020Library
:react-native-device-info:prepareComGoogleAndroidGmsPlayServicesGcm1020Library
:react-native-device-info:prepareComGoogleAndroidGmsPlayServicesIid1020Library
:react-native-device-info:prepareComGoogleAndroidGmsPlayServicesTasks1020Library
:react-native-device-info:prepareOrgWebkitAndroidJscR174650Library
:react-native-device-info:prepareReleaseDependencies
:react-native-device-info:compileReleaseAidl
:react-native-device-info:compileReleaseNdk UP-TO-DATE
:react-native-device-info:compileLint
:react-native-device-info:copyReleaseLint UP-TO-DATE
:react-native-device-info:compileReleaseRenderscript
:react-native-device-info:generateReleaseBuildConfig
:react-native-device-info:generateReleaseResValues
:react-native-device-info:generateReleaseResources
:react-native-device-info:mergeReleaseResources
:react-native-device-info:processReleaseManifest
:react-native-device-info:processReleaseResources
:react-native-device-info:generateReleaseSources
:react-native-device-info:incrementalReleaseJavaCompilationSafeguard
:react-native-device-info:compileReleaseJavaWithJavac
:react-native-device-info:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
:react-native-device-info:extractReleaseAnnotations
:react-native-device-info:mergeReleaseShaders
:react-native-device-info:compileReleaseShaders
:react-native-device-info:generateReleaseAssets
:react-native-device-info:mergeReleaseAssets
:react-native-device-info:mergeReleaseProguardFiles
:react-native-device-info:packageReleaseRenderscript UP-TO-DATE
:react-native-device-info:packageReleaseResources
:react-native-device-info:processReleaseJavaRes UP-TO-DATE
:react-native-device-info:transformResourcesWithMergeJavaResForRelease
:react-native-device-info:transformClassesAndResourcesWithSyncLibJarsForRelease
:react-native-device-info:mergeReleaseJniLibFolders
:react-native-device-info:transformNative_libsWithMergeJniLibsForRelease
:react-native-device-info:transformNative_libsWithSyncJniLibsForRelease
:react-native-device-info:bundleRelease
:react-native-intercom:preBuild UP-TO-DATE
:react-native-intercom:preReleaseBuild UP-TO-DATE
:react-native-intercom:checkReleaseManifest
:react-native-intercom:preDebugAndroidTestBuild UP-TO-DATE
:react-native-intercom:preDebugBuild UP-TO-DATE
:react-native-intercom:preDebugUnitTestBuild UP-TO-DATE
:react-native-intercom:preReleaseUnitTestBuild UP-TO-DATE
:react-native-intercom:prepareComAndroidSupportAnimatedVectorDrawable2511Library
:react-native-intercom:prepareComAndroidSupportAppcompatV72511Library
:react-native-intercom:prepareComAndroidSupportDesign2511Library
:react-native-intercom:prepareComAndroidSupportRecyclerviewV72511Library
:react-native-intercom:prepareComAndroidSupportSupportCompat2511Library
:react-native-intercom:prepareComAndroidSupportSupportCoreUi2511Library
:react-native-intercom:prepareComAndroidSupportSupportCoreUtils2511Library
:react-native-intercom:prepareComAndroidSupportSupportFragment2511Library
:react-native-intercom:prepareComAndroidSupportSupportMediaCompat2511Library
:react-native-intercom:prepareComAndroidSupportSupportV42511Library
:react-native-intercom:prepareComAndroidSupportSupportVectorDrawable2511Library
:react-native-intercom:prepareComAndroidSupportTransition2511Library
:react-native-intercom:prepareComFacebookFrescoDrawee061Library
:react-native-intercom:prepareComFacebookFrescoFbcore061Library
:react-native-intercom:prepareComFacebookFrescoFresco061Library
:react-native-intercom:prepareComFacebookFrescoImagepipeline061Library
:react-native-intercom:prepareComFacebookFrescoImagepipelineOkhttp061Library
:react-native-intercom:prepareComFacebookReactReactNative0153Library
:react-native-intercom:prepareIoIntercomAndroidIntercomSdkBase310Library
:react-native-intercom:prepareOrgWebkitAndroidJscR174650Library
:react-native-intercom:prepareReleaseDependencies
:react-native-intercom:compileReleaseAidl
:react-native-intercom:compileReleaseNdk UP-TO-DATE
:react-native-intercom:compileLint
:react-native-intercom:copyReleaseLint UP-TO-DATE
:react-native-intercom:compileReleaseRenderscript
:react-native-intercom:generateReleaseBuildConfig
:react-native-intercom:generateReleaseResValues
:react-native-intercom:generateReleaseResources
:react-native-intercom:mergeReleaseResources
:react-native-intercom:processReleaseManifest
:react-native-intercom:processReleaseResources/Users/distiller/mobile/node_modules/react-native-intercom/android/build/intermediates/res/merged/release/values-v24/values-v24.xml:3: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.
    
/Users/distiller/mobile/node_modules/react-native-intercom/android/build/intermediates/res/merged/release/values-v24/values-v24.xml:4: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.
    
/Users/distiller/mobile/node_modules/react-native-intercom/android/build/intermediates/res/merged/release/values-v24/values-v24.xml:3: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.

/Users/distiller/mobile/node_modules/react-native-intercom/android/build/intermediates/res/merged/release/values-v24/values-v24.xml:4: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.


 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-intercom:processReleaseResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Error: No known class method

I followed the guideline in README.md step by step. I don't use CocoaPods so I added intercom library manually. When I built the project, I got this error:
"No known class method for selector 'registerForNotifications' " in IntercomWrapper.m file.
screen shot 2016-04-16 at 12 40 53 pm

Does it necessary to use CocoaPods ? or the problem is something else?

Unable to install

I'm trying to use this library on a react-native 0.34.0 project, and I cannot get this library to work. I've fought through a number of problems, but am still unable to get it working. I am following the instructions thoroughly.
I install the library npm install react-native-intercom --save
I link the library react-native link
I use cocoapods to install the app 'react-native-intercom', :path => '../node_modules/react-native-intercom'.

I've tried many variations on this theme, but I either end up getting a 'Dependency analysis error, recursion etc.' or 'Intercom/Intercom.h cannot be found' error, or a duplicate symbols error, or a linker error of some sorts.

I've even tried just manually downloading Intercom and installing the framework, and then trying to use the library on top of the manually downloaded/installed framework.

Any tips on how to make this library work?

Update:

Solved this by manually installing Intercom, no pods, and then using installing this package, and react-native linking it afterwards. Cheers.

There is a problem starting this conversation

Hi,
I am trying to open the message composer, but when I do, I get this.
I was wondering if anyone had stumbled across this problem or it was something related to what product has been bought on Intercom. I have just found out that only the "Support" product works on mobile.

Thanks

No errors but doesn't seem to be working

Which file should:

Intercom.initialize(getApplicationContext(), "your api key", "your app id");

go in?

I have it set up with the previous line in an onCreate method in my reactnative_app/android/app/src/main/java/com/reactnative_app/MainActivity.java file, is that the correct location for this? Or should it be going in one of the android files in react-native-intercom?

I'm not getting any error messages when I attempt to create a user, but no user is showing up in my intercom dashboard...

undefined is not an object (evaluating 'IntercomWrapper.registerIdentifiedUser'

I'm trying to get the iOS module to work. When running from xcode everything works fine, but when starting using react-native run-ios I get IntercomWrapper is undefined when trying to log events.

  1. I installed intercom-ios manually
    • Added it to embedded frameworks
    • Added custom build phase
  2. npm install react-native-intercom --save
  3. rnpm link react-native-intercom

It is working fine on Android and on iOS when building/running from the xcode interface.

Anyone had a similar issue?

Intercom.displayMessageComposer() not working on Android

I followed the instructions for setup the this library.
I have already the user registration working, but when I execute Intercom.displayMessageComposer() I got nothing, no error and not loading the message composer.

{ title: 'Contactar a soporte', onPress: () => Intercom.displayMessageComposer() }

render() {
   var {logo, title} = this.props.link;
   var image = logo && <Image style={styles.picture} source={{uri: logo}} />;
   return (
     <Touchable onPress={this.handlePress.bind(this)}>
       <View style={styles.row}>
         {image}
           <Text style={styles.title} numberOfLines={2}>
             {title}
          </Text>
          <Image source={require('../../components/img/disclosure.png')} />
        </View>
      </Touchable>
   );
}
handlePress() {
  var {url, onPress} = this.props.link;
  if (onPress) {
    onPress();
  }
  if (url) {
    Linking.openURL(url);
  }
}

Any one is having the same problem that me?

Trigger Notifications

I was wondering if the addEventListener for Intercom.Notifications.UNREAD_COUNT is supposed to trigger when the app is not in the foreground for local notification purposes? Otherwise how would I go about notifying the user they have a new message when the app is not in the foreground?

Because right now it's not.

Add additional methods for Intercom integration

A few handy methods are still missing, would love an implementation for Android on these.

Intercom.client().getUnreadConversationCount();
Intercom.client().addUnreadConversationCountListener(listener);
Intercom.client().setInAppMessageVisibility(Visibility.GONE);
Intercom.client().hideMessenger();

Not sure about the process to submit a pull request, I can work on these if they're not currently in progress or not taken.

Android Erroring

Sometimes we get a Fatal exception from this library:
react-native-intercom: 4.4.0
react-native: 0.36.1

Fatal Exception: java.lang.RuntimeException: Attempt to call JS function before JS bundle is loaded.
       at com.facebook.react.cxxbridge.CatalystInstanceImpl.callFunction(CatalystInstanceImpl.java:199)
       at com.facebook.react.bridge.JavaScriptModuleRegistry$JavaScriptModuleInvocationHandler.invoke(JavaScriptModuleRegistry.java:110)
       at java.lang.reflect.Proxy.invoke(Proxy.java:813)
       at $Proxy6.emit(Unknown Source)
       at com.robinpowered.react.Intercom.IntercomEventEmitter.sendEvent(IntercomEventEmitter.java:54)
       at com.robinpowered.react.Intercom.IntercomEventEmitter.handleUpdateUnreadCount(IntercomEventEmitter.java:47)
       at com.robinpowered.react.Intercom.IntercomEventEmitter.access$000(IntercomEventEmitter.java:21)
       at com.robinpowered.react.Intercom.IntercomEventEmitter$1.onCountUpdate(IntercomEventEmitter.java:61)
       at io.intercom.android.sdk.store.UnreadCountTracker$1.onStateChange(UnreadCountTracker.java:29)
       at io.intercom.android.sdk.store.UnreadCountTracker$1.onStateChange(UnreadCountTracker.java:27)
       at io.intercom.android.sdk.utilities.ChangeSubscriber$1.run(ChangeSubscriber.java:37)
       at android.os.Handler.handleCallback(Handler.java:751)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at android.os.Looper.loop(Looper.java:154)
       at android.app.ActivityThread.main(ActivityThread.java:6119)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

EDIT: Looks like it might have been fixed in the RN 0.38-rc0 build. facebook/react-native@68aeffe

Android GCM Integration

I managed to integrate the iphone push notifications but somehow it wasn't so easy for the Android. I guess this is probably since i am a newbee for android and mobile dev.

The app is compiling but no push notification are displayed. I checked the errors from the logcat and found the following error:
intercom-sdk-gcm module not found

I am not sure how to add this module to the gradle file, since just adding it

dependencies {
    compile project(':react-native-intercom')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile 'com.google.android.gms:play-services-gcm:8.4.0'
    compile "com.facebook.react:react-native:+"  // From node_modules
    compile project(':react-native-vector-icons')
    compile project(':react-native-maps')
    compile project(':react-native-share')
    compile project(':intercom-sdk-gcm') // <-- i add this 
}

throws an error Project with path ':intercom-sdk-gcm' could not be found in project ':app'.

what am i doing wrong? Isn't the react-native-intercom adds the gcm module already?

Temporary support

Hey,

Thanks for the awesome module and your help so far! Looks like there are few PRs awaiting merging - is anyone having a more up to date fork? I'd be interested in maintaining it

Cheers

You have not accepted the license agreements of the following SDK components

How do I get around this?

A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApk'.
   > A problem occurred configuring project ':react-native-intercom'.
      > You have not accepted the license agreements of the following SDK components:
        [Android Support Repository].
        Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
        Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html

I don't need android studio, and our CI needs to build this with command-line-only tools. All of our other libraries with android parts have worked fine so far, seems to be something exclusive to this library.

Can we change the 'Api Key' dynamically from JavaScript after login?

Hello,

as per instructions, we initialize intercom inside MainApplication.java:
Intercom.initialize(this, "android_sdk-8ee58c77f126f7cb2f12319c116081723de30717e", "yq2easq1b");

However, how can we dynamically change the intercom api key while we are in the JavaScript side?

Why?

We need to use the intercom for our users, but there are customers that want to use their own Intercom for their end users. So, we need to change the api key dynamically depending on the login of the user.

Is this possible, somehow?

Thanks!

Segment.io vs logEvent

Hello,

We've been sending event data to Intercom via the https://segment.com/ pipeline so far. We've noticed that there's quite a delay (10-30s) using this method, so we're looking for something faster, so that our "open messenger if X event happens" stuff happens immediately.

So then I saw that this library provides for the following type of API call:
Intercom.logEvent('viewed_screen', { extra: 'metadata' });

Questions:

  1. Would this make our automatic events like above happen faster?
  2. Would this cause duplication if all actions also being sent on segment.com?

Undefined symbols for architecture arm64

When I try to build my app on my device, I'm receiving this error. Do you have any idea why? I saw a bunch of links and I tried to do some things but, nothing has worked.

P.s: I needed to import manually the framework like the issue 45

Undefined symbols for architecture arm64:
  "_IntercomUnreadConversationCountDidChangeNotification", referenced from:
      -[IntercomEventEmitter handleUpdateUnreadCount:] in libRNIntercom.a(IntercomEventEmitter.o)
      -[IntercomEventEmitter constantsToExport] in libRNIntercom.a(IntercomEventEmitter.o)
      -[IntercomEventEmitter supportedEvents] in libRNIntercom.a(IntercomEventEmitter.o)
      -[IntercomEventEmitter startObserving] in libRNIntercom.a(IntercomEventEmitter.o)
  "_OBJC_CLASS_$_Intercom", referenced from:
      objc-class-ref in AppDelegate.o
      objc-class-ref in libRNIntercom.a(IntercomWrapper.o)
      objc-class-ref in libRNIntercom.a(IntercomEventEmitter.o)
     (maybe you meant: _OBJC_CLASS_$_IntercomWrapper, _OBJC_CLASS_$_IntercomEventEmitter )
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Link the library

When I wanted to show a message composer, I just got this warning:
screen shot 2016-05-07 at 12 41 54 pm
and nothing happened! So I reviewed the README.md again and checked the linking process.

After using rnpm link command, the terminal output is like this:
screen shot 2016-05-07 at 12 20 01 pm
Three library are linked as you can see but there is no intercom library. So I tried to link the library manually. Base on the instructions(https://facebook.github.io/react-native/docs/linking-libraries-ios.html#content), first step is adding .xcodeproj file to the Xcode but there is no such a file in intercom library (under node_modules directory). On the other hand, the library is added to dependencies in package.json file. Do I need to link the library at all?

Is the linking process causes the error? or something else is going wrong?

Undefined symbols for architecture x86_64

Getting a build failed with error:

Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_RCTEventEmitter", referenced from: _OBJC_CLASS_$_IntercomEventEmitter in libreact-native-intercom.a(IntercomEventEmitter.o) _OBJC_CLASS_$_IntercomEventEmitter in libRNIntercom.a(IntercomEventEmitter.o) "_OBJC_METACLASS_$_RCTEventEmitter", referenced from: _OBJC_METACLASS_$_IntercomEventEmitter in libreact-native-intercom.a(IntercomEventEmitter.o) _OBJC_METACLASS_$_IntercomEventEmitter in libRNIntercom.a(IntercomEventEmitter.o) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Framework has been installed via pods and seems to be connected correctly. Any suggestions?

Intercom/Intercom.h file not found

I've tried linking it through the terminal, and manually several times and cannot get it functioning.
I add RNIntercom to the libraries folder and link libRNIntercom.a under Link Binary With Libraries.

Running RN 0.40.0.

screen shot 2017-02-08 at 2 10 10 pm

Share extension on release mode: UNREAD_CHANGE_NOTIFICATION

Anyone has a clue what is happening with my project? If a run on debugging mode, everything works fine but, when I run in release mode, the Extension raises this error.

Does this error really come from Intercom?

2017-01-19 11:44:59.896 MyShareEx[28356:4408998] Failed to inherit CoreMedia permissions from 28348: (null)
2017-01-19 11:45:00.108 [error][tid:com.facebook.react.JavaScript] undefined is not an object (evaluating 'u.UNREAD_CHANGE_NOTIFICATION')
2017-01-19 11:45:00.111 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: undefined is not an object (evaluating 'u.UNREAD_CHANGE_NOTIFICATION')
2017-01-19 11:45:00.112 [error][tid:com.facebook.react.JavaScript] Module AppRegistry is not a registered callable module (calling runApplication)
2017-01-19 11:45:00.122 MyShareEx[28356:4409019] *** Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: undefined is not an object (evaluating 'u.UNREAD_CHANGE_NOTIFICATION')', reason: 'Unhandled JS Exception: undefined is not an object (evaluating 'u.UNREAD_CH..., stack:
e@734:217
<unknown>@734:2802
n@2:545
<unknown>@726:162
n@2:545
<unknown>@718:284
n@2:545
<unknown>@376:243
n@2:545
<unknown>@12:185
n@2:545
i@2:266
global code@942:9
'
*** First throw call stack:
(
	0   CoreFoundation                      0x000000010eb21d4b __exceptionPreprocess + 171
	1   libobjc.A.dylib                     0x000000010dec021e objc_exception_throw + 48
	2   CoreFoundation                      0x000000010eb8b2b5 +[NSException raise:format:] + 197
	3   MyShareEx                           0x000000010d6920fd RCTFatal + 393
	4   MyShareEx                           0x000000010d68b4a2 -[RCTExceptionsManager reportFatalException:stack:exceptionId:] + 515
	5   CoreFoundation                      0x000000010eaa844c __invoking___ + 140
	6   CoreFoundation                      0x000000010eaa82d1 -[NSInvocation invoke] + 289
	7   CoreFoundation                      0x000000010eac0326 -[NSInvocation invokeWithTarget:] + 54
	8   MyShareEx                           0x000000010d68f0cc -[RCTModuleMethod invokeWithBridge:module:arguments:] + 585
	9   MyShareEx                           0x000000010d6b63ea -[RCTBatchedBridge callNativeModule:method:params:] + 220
	10  MyShareEx                           0x000000010d6b5c46 __33-[RCTBatchedBridge handleBuffer:]_block_invoke.357 + 503
	11  libdispatch.dylib                   0x0000000112a16808 _dispatch_call_block_and_release + 12
	12  libdispatch.dylib                   0x0000000112a3812e _dispatch_client_callout + 8
	13  libdispatch.dylib                   0x0000000112a1d4cf _dispatch_queue_serial_drain + 1018
	14  libdispatch.dylib                   0x0000000112a1dc9f _dispatch_queue_invoke + 1118
	15  libdispatch.dylib                   0x0000000112a1e047 _dispatch_queue_override_invoke + 376
	16  libdispatch.dylib                   0x0000000112a1f9dc _dispatch_root_queue_drain + 506
	17  libdispatch.dylib                   0x0000000112a1f782 _dispatch_worker_thread3 + 113
	18  libsystem_pthread.dylib             0x0000000112de4712 _pthread_wqthread + 1299
	19  libsystem_pthread.dylib             0x0000000112de41ed start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

Argument list too long: recursive header expansion failed at

I'm receiving the following message when try to build my project

Argument list too long: recursive header expansion failed at /Users/my-project/node_modules/react-native-intercom/iOS/../../../ios/Pods/React/node_modules/react-tools/src/renderers/dom/shared.

I'm trying to link the project manually

Any ideas?

Thank you in advanced

No podspec found

Instructions say that you support POD, but I get this error:

"No podscpec found"

How can this be solved please?

'RCTBridgeModule.h' file not found ([email protected])

The project is failing to compile for iOS with the following error:

[...]/node_modules/react-native-intercom/iOS/IntercomWrapper.h:13:9: fatal error: 'RCTBridgeModule.h' file not found
#import "RCTBridgeModule.h"
        ^

What fixed for us was this diff:
master...projetoeureka:master

I'm not sure if there's something special with our setup, but since no one else complained about this, I'm creating an issue first and I'll happily open up a PR.

Thanks

IntercomWrapper.displayConversationsList is not working on android

Using the method Intercom.displayConversationsList() works on iPhone but on Android throws the following error:

IntercomWrapper.displayConversationsList is not a function
TypeError: IntercomWrapper.displayConversationsList is not a function
    at http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:81707:17
    at tryCallTwo (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:6346:1)
    at doResolve (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:6501:9)
    at new Promise (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:6367:1)
    at IntercomClient.displayConversationsList (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:81706:8)
    at Object.onPress (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:82333:31)
    at Tab._handlePress (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:87715:12)
    at Constructor.touchableHandlePress (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:53264:32)
    at Constructor._performSideEffectsForTransition (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:34144:6)
    at Constructor._receiveSignal (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:34060:6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.