Skip to content

dixahq/dixa-messenger-react-native-demo

Repository files navigation

Dixa Messenger React Native Demo

Description

This is a simple React Native demo application that showcases how to use the Dixa Messenger SDK. For detailed documentation, visit Dixa Messenger Docs in Dixa Developer Hub.

preview

Before you start

To run this demo locally, you will need:

  1. Admin access to a Dixa organization. If you don't have access, contact Dixa to get it.

  2. A Dixa Messenger Token. Obtain it from your Dixa organization by navigating to Settings -> Messenger -> Edit the Appearance & Setup -> Setup -> Mobile -> Copy Messenger Token. For more details, see the documentation.

Screenshot 2022-12-12 at 21 02 43

Running the Demo Application on Android

💡Note: Java 17 is required to build and run on Android and Android API level 23 (Android 6.0 - Marshmallow)

  1. Ensure React Native is set up. Refer to the React Native documentation for environment setup for details.

  2. Clone this project and run npm install to install dependencies.

  3. Configure the Dixa SDK in the OnCreate method of your Application class. See MainApplication.kt for more details.

    DixaMessenger.Configuration config = new DixaMessenger.Configuration.Builder()
              .setApiKey("<YOUR_DIXA_MESSENGER_TOKEN>")
              .setLogLevel(LogLevel.ALL)
              .build();
  4. To build and launch the Android demo app, run npx react-native run-android.

Running the Demo Application on iOS

  1. Ensure React Native is set up. Refer to the React Native documentation for environment setup for details.

  2. Clone this project and run npm install to install dependencies.

  3. Run bundle install to install gems, including cocoapods.

  4. Navigate to the ios directory and run pod install to install the required CocoaPods for this SDK.

  5. Open the .xcworkspace file located in the dixa-messenger-react-native-demo/ios directory with Xcode.

  6. In Xcode, add a package dependency to your project using the URL https://github.com/dixahq/ios-messenger with the Swift Package Manager. For guidance, refer to Managing Package Dependencies with Swift Package Manager in Xcode.

  7. Configure the Dixa SDK in the didFinishLaunchingWithOptions method of your AppDelegate class. See AppDelegate.mm for more details.

    [Messenger
        configureWithMessengerToken: @"<YOUR_DIXA_MESSENGER_TOKEN>"
        logLevel:3
    ];
  8. To build and launch the iOS demo app, run npx react-native run-ios.