Install the React Native SDK

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:

1# Using npm
2npm install @salesforce/react-native-agentforce
3
4# Using yarn
5yarn 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):

1platform :ios, '17.0'
2
3target 'YourApp' do
4  use_frameworks! :linkage => :static
5
6  # React Native pods (from your standard RN template)
7  # ...
8
9  # Agentforce React Native bridge
10  pod 'ReactNativeAgentforce', :path => '../node_modules/@salesforce/react-native-agentforce/ios'
11end

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:

1platform :ios, '17.0'
2
3target 'YourApp' do
4  use_frameworks! :linkage => :static
5
6  # React Native pods
7  # ...
8
9  # Agentforce bridge with Mobile SDK for Employee Agent auth
10  pod 'ReactNativeAgentforce/WithMobileSDK', :path => '../node_modules/@salesforce/react-native-agentforce/ios'
11end

The WithMobileSDK subspec adds a dependency on SalesforceSDKCore, which provides OAuth login flows. See Employee Agent Authentication for details.

2. Install Pods 

1cd 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:

1<key>NSMicrophoneUsageDescription</key>
2<string>Used for voice input with Agentforce</string>

If you enable camera/photo features (enableMultiModalInput: true), add:

1<key>NSCameraUsageDescription</key>
2<string>Used to capture images for Agentforce</string>
3<key>NSPhotoLibraryUsageDescription</key>
4<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:

1android {
2    compileSdk 36
3
4    defaultConfig {
5        minSdkVersion 29
6        targetSdkVersion 36
7    }
8
9    compileOptions {
10        sourceCompatibility JavaVersion.VERSION_17
11        targetCompatibility JavaVersion.VERSION_17
12        coreLibraryDesugaringEnabled true
13    }
14
15    buildFeatures {
16        compose = true
17    }
18}
19
20repositories {
21    google()
22    mavenCentral()
23    maven { url 'https://jitpack.io' }
24    maven { url 'https://opensource.salesforce.com/AgentforceMobileSDK-Android/agentforce-sdk-repository' }
25    maven { url 'https://s3.amazonaws.com/inapp.salesforce.com/public/android' }
26    maven { url 'https://s3.amazonaws.com/salesforce-async-messaging-experimental/public/android' }
27}
28
29dependencies {
30    coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:2.1.5"
31
32    // For Employee Agent with Mobile SDK auth, add:
33    // implementation "com.salesforce.mobilesdk:SalesforceReact:13.1.1"
34}

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:

1import com.salesforce.android.reactagentforce.AgentforcePackage
2
3class MainApplication : Application(), ReactApplication {
4    override val reactNativeHost = object : DefaultReactNativeHost(this) {
5        override fun getPackages(): List<ReactPackage> = listOf(
6            MainReactPackage(),
7            AgentforcePackage(),
8            // ... other packages
9        )
10    }
11}

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:

1<activity
2    android:name="com.salesforce.android.reactagentforce.AgentforceConversationActivity"
3    android:theme="@style/Theme.AppCompat.Light.NoActionBar"
4    android:windowSoftInputMode="adjustResize" />

4. Permissions (Optional) 

For camera/multi-modal input support, add to AndroidManifest.xml:

1<uses-permission android:name="android.permission.CAMERA" />
2<uses-permission android:name="android.permission.RECORD_AUDIO" />

Verify Installation 

After installation, verify the native module is available:

1import { AgentforceService } from "@salesforce/react-native-agentforce";
2
3// Check if the SDK is configured (should return false initially)
4const configured = await AgentforceService.isConfigured();
5console.log("SDK configured:", configured);

If you see errors about the native module not being found, see Troubleshooting.

See Also