# genesys-mobiledx-chat-rn-module

> Bridge module for Genesys messenger chat

Latest version **1.1.4** (published 2021-11-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install genesys-mobiledx-chat-rn-module
pnpm add genesys-mobiledx-chat-rn-module
yarn add genesys-mobiledx-chat-rn-module
bun add genesys-mobiledx-chat-rn-module
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.4 |
| Published | 2021-11-16 |
| First published | 2021-11-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 104.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Genesys |
| Maintainers | trozin |
| Keywords | react-native |

## Links

- npm: https://www.npmjs.com/package/genesys-mobiledx-chat-rn-module
- npm.io page: https://npm.io/package/genesys-mobiledx-chat-rn-module

## Recent versions

- 1.1.4 (latest) — 2021-11-16
- 1.1.3 — 2021-11-16
- 1.1.2 — 2021-11-16
- 1.1.1 — 2021-11-15
- 1.1.0 — 2021-11-15
- 1.0.9 — 2021-11-14
- 1.0.8 — 2021-11-14
- 1.0.7 — 2021-11-14
- 1.0.6 — 2021-11-14
- 1.0.5 — 2021-11-14
- 1.0.4 — 2021-11-11
- 1.0.3 — 2021-11-11
- 1.0.2 — 2021-11-07
- 1.0.1 — 2021-11-07
- 1.0.0 — 2021-11-07

## README

# <img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQPNpoTfN7s-CudM4rAFGbjNSbwARRjiOdu0otHMK9tiYL8__ZhreOhPyO5QHSuRIrSvDo&usqp=CAU" height="50" style="margin-right:20px"/> 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](#getting-started)
  - [Pre-Requisites](#pre-requisites)
  - [Install](#install)
  - [Update](#update)
- [Platform specific additional steps](#platform-specific-additional-steps)
  - [Android](#android)
  - [iOS](#ios)
- [Usage](#usage)
    - [Import](#import)
    - [Start Chat](#start-chat)
- [Sample Application](https://github.com/genesys/MobileDxRNSample)
- [License](#license)

## 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 install`**

   ```sh
   npm install genesys-mobiledx-chat-rn-module --save
   ```

- **Option 2 - `yarn add`**

   ```sh
   yarn add genesys-mobiledx-chat-rn-module
   ```

- **Install Genesys chat module native dependency**
   
   ```sh
   react-native link genesys-mobiledx-chat-rn-module
   ```

### Update

To update your project to the latest version of `genesys-mobiledx-chat-rn-module`

   ```sh
   npm update genesys-mobiledx-chat-rn-module
   ```

## Platform specific additional steps

### android

In order to be able to use the chat module on android please follow the next steps.

1. Go to `build.gradle` file, on the android project of your react native app.
    ```cmd
    YourAppFolder
    ├── android
    │   ├── app
    │   │   ├── build.gradle  
    │   │   ├── proguard-rules.pro
    │   │   └── src
    │   ├── build.gradle   <---
    │   ├── gradle
    │   │   └── wrapper
    │   ├── gradle.properties
    │   ├── gradlew
    │   ├── gradlew.bat
    │   └── settings.gradle
    |
    ```

-  Add the following repositories:
    ```gradle
    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:
    ```gradle
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.30"
    ```

2. Go to `build.gradle` file, on the Android project's internal module.
    ```cmd
    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.

1. Go to `Podfile` file, on the ios project of your react native app.
    ```cmd
    YourAppFolder
    ├── ios
    │   ├── Podfile   <---
    ```
    -  validate your platform is set to `iOS11` or above.
    ```ruby
    platform :ios, '11.0'
    ```
    -  Add Genesys Messeging SDK sources.
    ```ruby
    source 'https://github.com/genesys/dx-sdk-specs-dev'
    source 'https://github.com/CocoaPods/Specs'
    ```
    -  Add `use_frameworks!` inside `target` scope.
    -  Add below `post_install` inside `target` scope.
    ```ruby
        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
    ```
    >[Podfile Full Example](https://github.com/genesys/MobileDxRNSample/blob/master/ios/Podfile)

    - **Disable `Flipper` if activated.**
    ```ruby
         # use_flipper!()
    ```

## Usage

### import

Import `GenDXChatModule` module.

```javascript
import { NativeModules } from 'react-native';
const { GenDXChatModule } = NativeModules;
```

### start-chat

Call `startChat` to get the messenging view and start conversation with an agent.

```javascript
// Now the chat can be triggered using the following method activation:
GenDXChatModule.startChat(deploymentId, domain, tokenStoreKey, logging);
```

## License

MIT

---
_Source: https://npm.io/package/genesys-mobiledx-chat-rn-module · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
