Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

11 Commits

Repository files navigation

react-native-intercom

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

Install

  1. npm install react-native-intercom
  2. In XCode, in the project navigator right click LibrariesAdd Files to [your project's name]
  3. Go to node_modulesreact-native-intercom➜ iOS and add IntercomWrapper.h and IntercomWrapper.m
  4. Add pod 'Intercom' to your Podfile and run pod install. More instructions here: Intercom for iOS
  5. Initialize Intercom in your AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Initialize Intercom
[Intercom setApiKey:@"<#ios_sdk-...#>" forAppId:@"<#your-app-id#>"];
}
  1. 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];
}

Usage

Require the module

varIntercom=require('react-native-intercom');

Log an event

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

Register a Logged In user

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

Register a Logged In user and post extra metadata

Intercom.registerIdentifiedUser({userId: 'bob'}).then(()=>{console.log('registerIdentifiedUser done');returnIntercom.updateUser({email: 'email',name: 'name',});}).catch((err)=>{console.log('registerIdentifiedUser ERROR',err);});

Sign Out

Intercom.reset()

Show Message Composer

Intercom.displayMessageComposer();

About

React Native wrapper for Intercom.io

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages