React Native wrapper for Intercom.io. Based off of intercom-cordova
npm install react-native-intercom- In XCode, in the project navigator right click
Libraries➜Add Files to [your project's name] - Go to
node_modules➜react-native-intercom➜ iOS and addIntercomWrapper.handIntercomWrapper.m - Add
pod 'Intercom'to your Podfile and runpod install. More instructions here: Intercom for iOS - Initialize Intercom in your
AppDelegate.m
- (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];
}
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();