SDK: Using React Native
Dropthought SDK helps you collect feedback or responses to your created programs. All you need to do is install the SDK using our APIs. The integration also enables you to collect metadata and feedback offline.
This article will help you understand:
How do you integrate Dropthought SDK into your application?
What are the prerequisites for integrating the application?
How to install SDK?
What steps are involved in installing and initializing SDK use?
What are the additional features?
We have got SDK APIs for iOS and Android separately. Refer to our help documentation to use them: iOS | Android
Scenario
While using Dropthought, you can create and manage programs via web or mobile apps.
You have an online shopping platform and would like to gather customers' online shopping experience upon placing an order via your app.
To improve user experience, you can have your widget and link it to a program (survey) created on Dropthought.
How do you do that?
Upon creating a program on Dropthought, you need to connect the program to the interactive element using SDK.
User Flow
To help you with a generic user flow:
Create a program on Dropthought.
Use the API key provided within your Account Profile.
Install SDK using the API key.
Navigate to the mobile app and go to Manage Native SDK.
Add or select the app from the following screen.
Create visibility. It helps identify the placement of the element or widget within the selected app.
Select the program you want to use for the program.
The program can now capture responses from the selected app.
Pre-requisites
Use react-native version above 0.64.1
API key from your Dropthought account:
If you can’t find an API key inside the Account screen of your Dropthought web application account, reach out to the 'Account Administrator.'
If your Account Administrator can’t find the API key on their Dropthought account, contact us at cs@drophought.com.Visibility ID from the Dropthought mobile app. Refer to the following sections to fetch the API key and Visibility ID.
Installing & Setting-up SDK
Installing and setting up SDK can be summarised as a three-step process:
Fetching API Key from your Dropthought Account
Installing SDK using NPM or Yarn methods
Initialize
Step 1: Fetching API Key from your Dropthought Account
Navigate to the Account tab.
Click on Account and then go to Account Profile.
You will find the API key.
Step 2: Installing the SDK
You can install SDK to your app and all dependencies using any of the below methods:
NPM: install @dropthought/react-native-dt-sdk
Yarn: add @dropthought/react-native-dt-sdk
While installing SDK, please ensure that the following dependencies are installed:
Step 3: Initialize
Upon installing SDK, you need to initialize to start using the SDK. For the same, you can add the following code to index.js.
Replace 'YOUR_API_KEY'
with the API key fetched from the Dropthought account.
import {
SurveyModalContainer,
initialize,
} from '@dropthought/react-native-dt-sdk';
initialize({
apiKey: 'YOUR_API_KEY',
storage: AsyncStorage,
});
// Add this container around your component
<SurveyModalContainer>{/* Your components */}</SurveyModalContainer>;
Dropthought’s SDK is now installed and initialized on your Dropthought mobile app.
Learn more: Adding new app | Associating a Program to an app
