This directory contains the Agentforce bridge module: JavaScript API layer, sample app, and native iOS/Android code. It has no Mobile SDK dependency; a host app that adds the Mobile SDK can use the included auth bridge for Employee Agent.
In your app’s Podfile:
pod 'ReactNativeAgentforce', :path => '../node_modules/react-native-agentforce/ios'Your app must also include the Agentforce iOS SDK in the Podfile so the bridge can link. For Employee Agent, the host app must additionally include the Salesforce Mobile SDK and perform bootconfig + SDK initialization.
- Link the Android library and register
AgentforcePackagein your app. - For Employee Agent (see below), the host app must add the Salesforce React dependency and bootconfig + SDK init.
Import the API from this package when the native module is linked:
import { AgentforceService } from 'react-native-agentforce';Use the sample app in app/ as reference or replace with your own UI.
For Employee Agent (authenticated) mode, the host app must provide the Salesforce Mobile SDK and initialize it. This bridge does not bundle the SDK.
Add the Salesforce React dependency in your app’s build.gradle (e.g. app/build.gradle):
implementation "com.salesforce.mobilesdk:SalesforceReact:13.1.1"You must also configure bootconfig and perform SDK initialization (e.g. via react-native-force or your existing Salesforce Mobile SDK setup). Without these, Employee Agent auth will not work.
Include the Salesforce Mobile SDK pods in your Podfile and perform bootconfig and SDK initialization as required for your app. The bridge’s Employee Agent auth layer relies on the SDK being initialized at runtime.
Configure and launch:
import { AgentforceService } from ‘react-native-agentforce’;
await AgentforceService.configure(config);
await AgentforceService.launchConversation();Additional Context: Provide contextual data to personalize agent responses (must be called after launching conversation):
await AgentforceService.setAdditionalContext({
variables: [
{ name: ‘userId’, type: ‘Text’, value: ‘005xx0000001234’ },
{ name: ‘accountId’, type: ‘Text’, value: ‘001xx0000001234’ },
{ name: ‘priority’, type: ‘Text’, value: ‘high’ },
{ name: ‘score’, type: ‘Number’, value: 95.5 },
{ name: ‘isVIP’, type: ‘Boolean’, value: true },
{ name: ‘createdDate’, type: ‘DateTime’, value: ‘2026-03-06T10:00:00Z’ }
]
});Supported types:
Text- String valuesNumber- Numeric valuesBoolean- Boolean valuesDate,DateTime- ISO date stringsObject- Object/map valuesList- Array valuesJson,Money,Ref,Variable- Additional Android SDK types
Platform notes:
- Android: Uses
AgentforceContextVariablewith case-sensitive type names - iOS: Uses
AgentforceVariablewithJSEncodableValueenum; type is just a label - Context persists for the current conversation session