Learn how to install the Agentforce Mobile SDK for React Native in your project.
Prerequisites
Before installing, ensure you meet the system requirements.
Install the Package
Install the React Native Agentforce bridge using npm or yarn:
# Using npm
npm install @salesforce/react-native-agentforce
# Using yarn
yarn add @salesforce/react-native-agentforce
The package includes TypeScript types out of the box. All public exports are available from '@salesforce/react-native-agentforce'.
iOS Setup
Configure your iOS project to use the Agentforce SDK.
1. Configure the Podfile
In your ios/Podfile, add the bridge pod. The bridge depends on React-Core and AgentforceSDK (the native iOS SDK distributed via CocoaPods).
Service Agent only (default):
platform :ios, '17.0'
target 'YourApp' do
use_frameworks! :linkage => :static
# React Native pods (from your standard RN template)
# ...
# Agentforce React Native bridge
pod 'ReactNativeAgentforce', :path => '../node_modules/@salesforce/react-native-agentforce/ios'
end
Service Agent + Employee Agent (with Mobile SDK auth):
If you also need Employee Agent support with OAuth authentication via the Salesforce Mobile SDK, use the WithMobileSDK subspec:
platform :ios, '17.0'
target 'YourApp' do
use_frameworks! :linkage => :static
# React Native pods
# ...
# Agentforce bridge with Mobile SDK for Employee Agent auth
pod 'ReactNativeAgentforce/WithMobileSDK', :path => '../node_modules/@salesforce/react-native-agentforce/ios'
end
The WithMobileSDK subspec adds a dependency on SalesforceSDKCore, which provides OAuth login flows. See Employee Agent Authentication for details.
2. Install Pods
cd ios && pod install
3. Swift Compatibility
The bridge is written in Swift 5.0+. If your app is Objective-C only, Xcode prompts you to create a bridging header on first build.
4. Permissions (Optional)
If you enable voice features (enableVoice: true), add the microphone usage description to your Info.plist:
<key>NSMicrophoneUsageDescription</key>
<string>Used for voice input with Agentforce</string>
If you enable camera/photo features (enableMultiModalInput: true), add:
<key>NSCameraUsageDescription</key>
<string>Used to capture images for Agentforce</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Used to attach images to Agentforce conversations</string>
Android Setup
Configure your Android project to use the Agentforce SDK.
1. Configure build.gradle (App Level)
Add the Agentforce Maven repositories and configure your app's android/app/build.gradle:
android {
compileSdk 36
defaultConfig {
minSdkVersion 29
targetSdkVersion 36
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
coreLibraryDesugaringEnabled true
}
buildFeatures {
compose = true
}
}
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
maven { url 'https://opensource.salesforce.com/AgentforceMobileSDK-Android/agentforce-sdk-repository' }
maven { url 'https://s3.amazonaws.com/inapp.salesforce.com/public/android' }
maven { url 'https://s3.amazonaws.com/salesforce-async-messaging-experimental/public/android' }
}
dependencies {
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:2.1.5"
// For Employee Agent with Mobile SDK auth, add:
// implementation "com.salesforce.mobilesdk:SalesforceReact:13.1.1"
}
The bridge library module includes agentforce-sdk as an api dependency. Your host app must provide SalesforceReact at runtime if you use Employee Agent auth.
2. Register the Native Package
In your MainApplication.kt (or .java), register AgentforcePackage:
import com.salesforce.android.reactagentforce.AgentforcePackage
class MainApplication : Application(), ReactApplication {
override val reactNativeHost = object : DefaultReactNativeHost(this) {
override fun getPackages(): List<ReactPackage> = listOf(
MainReactPackage(),
AgentforcePackage(),
// ... other packages
)
}
}
AgentforcePackage automatically registers AgentforceModule. It also registers EmployeeAgentAuthBridge if the Salesforce Mobile SDK is detected on the runtime classpath (via reflection). If the Mobile SDK is not present, Employee Agent auth is gracefully disabled.
3. Configure AndroidManifest.xml
Register the conversation activity in your AndroidManifest.xml:
<activity
android:name="com.salesforce.android.reactagentforce.AgentforceConversationActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
android:windowSoftInputMode="adjustResize" />
4. Permissions (Optional)
For camera/multi-modal input support, add to AndroidManifest.xml:
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
Verify Installation
After installation, verify the native module is available:
import { AgentforceService } from "@salesforce/react-native-agentforce";
// Check if the SDK is configured (should return false initially)
const configured = await AgentforceService.isConfigured();
console.log("SDK configured:", configured);
If you see errors about the native module not being found, see Troubleshooting.