0.0.20 • Published 4 years ago

react-native-intercom-rn-library v0.0.20

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

react-native-intercom-rn-library

Getting started

 "dependencies": {
  "react-native-intercom-rn-library": "0.0.16"
 }

Manual installation

iOS

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modulesreact-native-intercom-rn-library and add RNIntercomRnLibrary.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNIntercomRnLibrary.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)<

Android

  1. 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 the getPackages() method
  1. 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')
  2. 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 authentificated by 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)=>{})