Adding the SDK and initializing it

Nabla React Native SDK installation

⚠️

The Nabla Android SDK is compatible:

  • On Android with Android 6 (API Level 23) and higher: Make sure your android/build.gradle file is well configured:
    • minSdkVersion should be >= 23
    • compileSdkVersion should be >= 33 (this doesn't impact your app's minimum Android supported version)
    • You need to set up desugaring libraries in your build.gradle file as mentioned in the desugaring guide
    • You also need to add vectorDrawables.useSupportLibrary true in your build.gradle file for your app in the defaultConfig section if you target API 23, as mentioned in Vector Drawable compat guide.
  • On iOS with iOS 13 and higher: Make sure your ios/Podfile is well configured:
    • platform :ios, '13.0' (or higher)

Add the dependency

The Nabla React Native SDK is available on the npm Registery.

Install the SDK by running:

yarn add @nabla/react-native-core

or

npm install --save @nabla/react-native-core

You can also add the desired Nabla dependencies:

@nabla/react-native-messaging-ui
@nabla/react-native-messaging-core
@nabla/react-native-scheduling

As the Nabla SDK relies on Sentry to send anonymized events to Nabla servers to help us improve features like video calls,
you will need to add the depency in the iOS/Podfile with a custom configuration to be compatible with the React Native project.

target 'AppName' do
  ...
  pod 'Sentry', :modular_headers => true
  ...
end

And then run pod install in your ios directory, in order to install the native dependencies.

Initialize the SDK

Next, initialize the SDK and any module you want to add.

await NablaMessagingClient.initializeMessagingModule(); // If you want the messaging module
await NablaVideoCallClient.initializeVideoCallModule(); // If you want to add video call capabilities
await NablaSchedulingClient.initializeSchedulingModule(); // if you want the scheduling feature

await NablaClient.getInstance().initialize(new Configuration("YOUR_API_KEY"));

The NablaClient can then be accessed from anywhere with NablaClient.getInstance().

📘

To generate a mobile SDK API key, open your Nabla Console, go to the "Developers" tab, then to the "API keys" section, "Mobile SDK API keys" sub-tab, and click on "Add mobile SDK API key".