0.0.20 • Published 5 years ago
react-native-intercom-rn-library v0.0.20
react-native-intercom-rn-library
Getting started
"dependencies": {
"react-native-intercom-rn-library": "0.0.16"
}Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries➜Add Files to [your project's name] - Go to
node_modules➜react-native-intercom-rn-libraryand addRNIntercomRnLibrary.xcodeproj - In XCode, in the project navigator, select your project. Add
libRNIntercomRnLibrary.ato your project'sBuild Phases➜Link Binary With Libraries - Run your project (
Cmd+R)<
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.reactlibrary.RNIntercomRnLibraryPackage;to the imports at the top of the file - Add
new RNIntercomRnLibraryPackage()to the list returned by thegetPackages()method
- Append the following lines to
android/settings.gradle:include ':react-native-intercom-rn-library' project(':react-native-intercom-rn-library').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-intercom-rn-library/android') - Insert the following lines inside the dependencies block in
android/app/build.gradle:compile project(':react-native-intercom-rn-library')
Usage
import RNIntercomRnLibrary from 'react-native-intercom-rn-library';
RNIntercomRnLibrary.intializeSDK(INTERCOM_API_KEY, INTERCOM_APP_ID)
//User authentification
RNIntercomRnLibrary.registerUserWithUserId(USER_ID)
//or
RNIntercomRnLibrary.registerUserWithEmail(USER_EMAIL)To use features a user
must be authentificatedby his email or user_id
for logout a user use
RNIntercomRnLibrary.logout()Features
Help Center
RNIntercomRnLibrary.presentHelpCenter()Chat
RNIntercomRnLibrary.presentMessenger()messenger with initial message
RNIntercomRnLibrary.presentMessengerWithMessage('my message')hide messenger
RNIntercomRnLibrary.hideMessenger()Log event
RNIntercomRnLibrary.logEventWithName('EVENT_NAME')Log event with datas
RNIntercomRnLibrary.logEventWithNameAndDatas('EVENT_NAME', ["key":"data"])Others
Intercom library version (iOS / Android)
RNIntercomRnLibrary.getVersion( (error: any, version: string)=>{})