React Native
Monterosa / Interaction SDK allows you to embed an Experience in your React Native app.
Getting started
Prerequisites
First of all, you'll need a React Native application into which you'll install the SDK. This guide assumes you have created it using a command similar to the one recommended by React Native's documentation:
If that is the case, you'll need to generate the iOS and Android projects in order for the SDK to be installed. This can be done with the commands:
and
Once this is done, you should have a folder structure that includes an ios
and android
folders.
Installation
The first step is to install the React Native SDK NPM package. This can be done with the following snippet (making sure to replace the package token provided):
As a result of this command, your node_modules will include a package called @monterosa-sdk/react-native
, which includes:
The Android code necessary to interact with the native Android SDK from React Native
The iOS counterpart to that code
The JavaScript wrapper code
You'll need to update your Android and iOS projects to link to the Android and iOS native SDKs.
Android Setup
In order to setup the Android app, you'll need to install the native SDKs. To do so, enter the following snippet in the android/settings.gradle
file:
Once that is entered, the React Native SDK will be able to obtain the native SDK libraries required for it to operate.
Finally, you'll need to make sure that the minimum Android API level is set to 23, as opposed to the default 21 in the React Native setup. This can be achieved by updating the minSdkVersion
value in android/build.gradle
:
iOS Setup
Similarly to Android, we need to update the Podfile in ios/Podfile
in order to be able to locate the native SDK libraries. This can be achieved by adding the following lines to the target of your app:
Note that the pods of the SDK need to be declared BEFORE the calls to use_expo_modules
and use_native_modules
occur.
Embedding an Experience
Once the installation is resolved, you can embed an Experience by using the next snippet:
Events in the SDK
The SDK offers a onMessageReceived
prop where a function can be passed to receive the messages from the native implementations. These messages cover from Messages sent from the Experience, to debug messages.
You can read more on this topic here.
SSO Integration with your IAM provider
Through Identify, Monterosa supports SSO integrations with a suite of IAM providers and has the capacity to create bespoke integrations when needed.
Pre-requisite
Please contact our sales team if you're interested in setting up the integration between your IAM provider, and Identify.
SSO via React Native SDK
Using the React Native SDK, you can pass a token to the MonterosaSdkExperienceView
so that it is used to log-in the user within the Experience with a token
property in the configuration. This can be achieved with the following snippet:
The token provided will be later submitted to Identify when attempting to log-in the user.
Additionally, we support a range of Identify Events documented here.
Login prompted by Experience
In many cases, Monterosa / Interaction Cloud encourages the sign-up of users to your platform via gated content. This is achieved by sending an event to the application when the user taps on a "Sign up" button in the UI of the Experience.
The following snippet outlines how to intercept the event:
Sending messages to the Experience
In order to enable a seamless User Experience, it's often necessary to communicate with the Experience to share necessary information with the app. The SDK offers the capacity to send and receive messages following the next snippet:
Sending additional parameters to the Experience
Using the React Native SDK, you can pass additional parameters to the Experience when you create it. To do so, provide a dictionary in the parameter
key of the configuration
property in the MonterosaSdkExperienceView
. This can come in useful for the initial configuration of the Experience, for instance, setting up the language to use: