Installation
Install the Userbubble React Native SDK
Choose Your Platform
Expo Projects
For Expo projects, install the SDK along with its peer dependencies:
npx expo install @userbubble/react-native expo-secure-store react-native-webviewThe SDK will automatically detect Expo and use expo-secure-store for secure data storage.
Bare React Native Projects
For bare React Native projects, install the SDK with AsyncStorage and WebView:
npm install @userbubble/react-native @react-native-async-storage/async-storage react-native-webviewOr with yarn:
yarn add @userbubble/react-native @react-native-async-storage/async-storage react-native-webviewThe SDK will automatically detect bare React Native and use AsyncStorage.
react-native-webview is required for embedding the feedback portal directly in your app. If you only plan to use openUserbubble() (opens in the device browser), you can skip it.
Get Your API Key
Before using the SDK, you'll need an API key:
- Go to your organization settings in Userbubble
- Navigate to "API Keys"
- Click "Generate New Key"
- Copy the API key (it starts with
ub_live_orub_test_)
Store your API key securely in environment variables. Never commit it to your repository.
Environment Variables
For Expo:
Add to your .env file:
EXPO_PUBLIC_USERBUBBLE_API_KEY=ub_live_xxxxxxxxxxxxx
# Optional: override the default base URL (https://app.userbubble.com)
# EXPO_PUBLIC_USERBUBBLE_BASE_URL=https://your-custom-domain.comFor bare React Native:
Add to your .env file and use a package like react-native-dotenv:
USERBUBBLE_API_KEY=ub_live_xxxxxxxxxxxxx
# Optional: override the default base URL
# USERBUBBLE_BASE_URL=https://your-custom-domain.comNext Steps
Now that you've installed the SDK, continue to the Quick Start guide to integrate it into your app.