genesys-mobiledx-chat-rn-module v1.1.4
mobile-genesys-chat-rn-module
Genesys Messaging SDK for React Native
The SDK provides a simple react native wrapper for the Genesys messaging SDK.
Author: Genesys
Platform Support: Android, iOS
Getting Started
Pre-requisites
In order to use this SDK you need a Genesys account with the Messaging feature enabled.
Install
Run the following on the application root directory.
Option 1 -
npm installnpm install genesys-mobiledx-chat-rn-module --saveOption 2 -
yarn addyarn add genesys-mobiledx-chat-rn-moduleInstall Genesys chat module native dependency
react-native link genesys-mobiledx-chat-rn-module
Update
To update your project to the latest version of genesys-mobiledx-chat-rn-module
npm update genesys-mobiledx-chat-rn-modulePlatform specific additional steps
android
In order to be able to use the chat module on android please follow the next steps.
- Go to
build.gradlefile, on the android project of your react native app.YourAppFolder ├── android │ ├── app │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ ├── build.gradle <--- │ ├── gradle │ │ └── wrapper │ ├── gradle.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle |
Add the following repositories:
maven {url "https://bold360ai-mobile-artifacts.s3.amazonaws.com/dx/android/dev/"} maven {url "https://bold360ai-mobile-artifacts.s3.amazonaws.com/dx/common/dev/"}Add the following dependency:
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.30"
- Go to
build.gradlefile, on the Android project's internal module.YourAppFolder ├── android │ ├── app │ │ ├── build.gradle <--- │ │ ├── proguard-rules.pro │ │ └── src │ ├── build.gradle │ ├── gradle │ │ └── wrapper │ ├── gradle.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle |
- Add kotlin plugin as follows:
apply plugin: "kotlin-android"
ios
In order to be able to use the chat module on iOS please follow the next steps.
Go to
Podfilefile, on the ios project of your react native app.YourAppFolder ├── ios │ ├── Podfile <---- validate your platform is set to
iOS11or above.
platform :ios, '11.0'- Add Genesys Messeging SDK sources.
source 'https://github.com/genesys/dx-sdk-specs-dev' source 'https://github.com/CocoaPods/Specs'- Add
use_frameworks!insidetargetscope. - Add below
post_installinsidetargetscope.
target 'YourAppTargetName' do config = use_native_modules! use_frameworks! use_react_native!( :path => config[:reactNativePath], # to enable hermes on iOS, change `false` to `true` and then install pods :hermes_enabled => false ) post_install do |installer| react_native_post_install(installer) installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES' end if (target.name&.eql?('FBReactNativeSpec')) target.build_phases.each do |build_phase| if (build_phase.respond_to?(:name) && build_phase.name.eql?('[CP-User] Generate Specs')) target.build_phases.move(build_phase, 0) end end end end end end- Disable
Flipperif activated.
# use_flipper!()- validate your platform is set to
Usage
import
Import GenDXChatModule module.
import { NativeModules } from 'react-native';
const { GenDXChatModule } = NativeModules;start-chat
Call startChat to get the messenging view and start conversation with an agent.
// Now the chat can be triggered using the following method activation:
GenDXChatModule.startChat(deploymentId, domain, tokenStoreKey, logging);License
MIT