Set Up Agentforce Voice for React Native

Agentforce Voice lets you build voice-enabled agents that manage complex conversations in real time. Set up Agentforce Voice for your React Native mobile app with these steps.

In React Native, you enable and configure voice from JavaScript through a feature flag — you don't write native Swift or Kotlin. The voice native modules are already bundled with the @salesforce/react-native-agentforce bridge and registered for you, though you still need a few native setup steps (Android permission, iOS Podfile and Info.plist changes) covered below. The native SDK renders and drives the voice UI; the bridge exposes no separate JavaScript voice view or voice events.

Availability

Through the React Native bridge, Agentforce Voice is supported for both Employee Agents and Service Agents on iOS and Android. The voice native modules are bundled with the bridge and use the underlying native SDK capabilities for both agent types.

This page covers voice setup in React Native. For additional details on native voice implementation, see Set Up Agentforce Voice for iOS and Set Up Agentforce Voice for Android.

Prerequisites

Before you start, you need:

  • A voice-enabled agent configured in Agentforce Studio (Employee Agent or Service Agent).
  • A React Native app that already integrates the Agentforce React Native bridge, including authentication:

Install the Voice Module

The voice native modules ship with the bridge — you don't add a separate npm package. You only need to make sure the underlying native voice SDKs resolve correctly in your host app.

Android

The bridge pulls in the Android voice SDK automatically (com.salesforce.android.agentforcesdk:agentforce-sdk-voice). Add the RECORD_AUDIO permission to your host app's android/app/src/main/AndroidManifest.xml:

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

iOS

The bridge's podspec declares the AgentforceVoice pod, but your host app must add LiveKitClient and the Service Agent multimedia messaging pods yourself. In your host app's Podfile:

  1. Add the LiveKit spec source alongside your other sources.
source 'https://github.com/livekit/podspecs.git'
  1. Add the LiveKit pod, pinned to a version compatible with the voice SDK (this bridge is validated against 2.11.0).
pod 'LiveKitClient', '2.11.0'
  1. Add a pre_install hook to correct the framework module name. AgentforceVoice.xcframework links against @rpath/LiveKit.framework/LiveKit, but CocoaPods builds the pod as LiveKitClient.framework by default.
pre_install do |installer|
  installer.pod_targets.each do |pod|
    if pod.name == 'LiveKitClient'
      pod.root_spec.attributes_hash['module_name'] = 'LiveKit'
    end
  end
end
  1. Add the Service Agent multimedia messaging dependencies, needed for Service Agent voice. Messaging-InApp-Core and Messaging-Multimedia-Core both resolve from the Salesforce Async Messaging podspec source — add that source alongside your other source lines, then add the pods:
source 'https://github.com/Salesforce-Async-Messaging/podspecs.git'
pod 'Messaging-InApp-Core'
pod 'Messaging-Multimedia-Core'
  1. Add the microphone and speech usage descriptions to your app target's Info.plist.
<key>NSMicrophoneUsageDescription</key>
<string>Permission is required to access your microphone.</string>
<key>NSSpeechRecognitionUsageDescription</key>
<string>Permission is required to access your microphone for speech processing.</string>
  1. Run pod install from your project's ios directory.

If you encounter a "Voice module not available" error on iOS, confirm that the LiveKit spec source and the pre_install module-name override in steps 1 and 3 are present. Without them, the voice framework fails to link.

Enable Voice in Configuration

Set enableVoice: true in the feature flags you pass to AgentforceService.configure(). The flag defaults to false, so you must opt in explicitly for both Employee Agents and Service Agents.

import { AgentforceService } from '@salesforce/react-native-agentforce';

await AgentforceService.configure({
  type: 'employee',
  instanceUrl,
  organizationId,
  userId,
  accessToken,
  featureFlags: {
    enableVoice: true,
    enableMultiAgent: true,
    enableMultiModalInput: true,
    enablePDFUpload: true,
    enableCustomViewProvider: false,
  },
});

You can also persist feature flags independently of a configure call. setFeatureFlags() requires all five flags — read the current flags first and merge in your change, or you'll reset the others to false:

const flags = await AgentforceService.getFeatureFlags();
await AgentforceService.setFeatureFlags({ ...flags, enableVoice: true });

The backend agent must also have voice enabled in Agentforce Studio — setting enableVoice: true on the client has no effect if the agent doesn't advertise voice support.

Customize Voice Behavior

Pass voiceOptions to AgentforceService.configure() to adjust voice behavior. These options apply after configure() runs and don't affect an already-active voice session:

  • userSilenceTimeoutSeconds — how long to wait during user silence before ending the turn.
  • autoEndWhileMuted — whether to automatically end the voice session while the microphone is muted.
  • defaultClosedCaptionsEnabled — whether closed captions are on by default.

On iOS only, voiceCloseBehavior controls what happens when the user closes the voice UI: returnToChat (the default) returns to the chat conversation, and dismissContainer dismisses the whole container. Android ignores this option.

These options adjust built-in voice behavior — you still can't render a custom voice UI or subscribe to voice events directly in React Native.

Launch a Voice Conversation

launchConversation() opens the conversation in Chat mode by default, even when voice is enabled. To open directly in Voice, pass initialMode: 'voice':

await AgentforceService.launchConversation({ initialMode: 'voice' });

The native SDK presents the built-in voice UI within the conversation experience — no additional React Native view or event wiring is required. Build and run your app to start a voice-enabled conversation.

Closed Captions and Agent Responses

In voice mode, the agent responds audibly, and the written response is intentionally hidden when closed captions are off. Turning closed captions on displays the live transcript of the agent's response. Closed captions default to off, so users tap the closed-caption control to turn them on.

note: If the agent's written response appears to be missing during a voice conversation, that's expected behavior when closed captions are off—it's not a bug. The response is still delivered audibly, and enabling closed captions shows the transcript. (Agent responses always remain visible in the standard chat interface.)

The React Native bridge exposes no API to change the default closed-caption state, launch directly into voice mode, configure the close behavior, or theme the voice UI. The native SDK renders and drives the voice experience. For details, see Limitations.

See Also