This has been forked and modified to use more modern versions of the Android Support library in order to support FCM push.
React Native wrapper for Intercom.io. Based off of intercom-cordova
npm install react-native-intercom
Run rnpm link
Add the following to your podfile
pod 'react-native-intercom', :path => '../node_modules/react-native-intercom'
Follow how to manually link a library here https://facebook.github.io/react-native/docs/linking-libraries-ios.html#content
Run rnpm link
More instructions here: Intercom for iOS
Initialize Intercom in your AppDelegate.m
#import "Intercom/intercom.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Initialize Intercom
[Intercom setApiKey:@"<#ios_sdk-...#>" forAppId:@"<#your-app-id#>"];
}
- 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 setDeviceToken:deviceToken];
}
More instructions here: Intercom for Android
Intercom.initialize(getApplicationContext(), "your api key", "your app id");
var Intercom = require('react-native-intercom');Intercom.logEvent('viewed_screen', { extra: 'metadata' });Intercom.registerIdentifiedUser({ userId: 'bob' });Intercom.registerIdentifiedUser({ userId: 'bob' })
.then(() => {
console.log('registerIdentifiedUser done');
return Intercom.updateUser({
email: 'email',
name: 'name',
});
})
.catch((err) => {
console.log('registerIdentifiedUser ERROR', err);
});Intercom.reset()Intercom.displayMessageComposer();Intercom.displayMessageComposerWithInitialMessage('Initial Message');Intercom.setBottomPadding(64);componentDidMount() {
Intercom.addEventListener(Intercom.Notifications.UNREAD_COUNT, this._onUnreadChange)
}
componentWillUnmount() {
Intercom.removeEventListener(Intercom.Notifications.UNREAD_COUNT, this._onUnreadChange);
}
_onUnreadChange = ({ count }) => {
//...
}