App audiences
Create an audience with Channel Type set to is one of → App. Use it to provide app users with specific guidance, knowledge, and tool access. Combine the App condition with customer attributes, such as their subscription plan, to tailor support further. Your app can pass these attributes through the SDK’suser.data command.
Web SDK through a JavaScript bridge
Your native app can use the Web SDK through the WebView’s JavaScript bridge. When you load the App chat URL directly, callwindow.$botbrains inside the WebView to:
- Identify the logged-in customer and pass customer attributes for audience targeting.
- Prefill or send a message from an app action, such as a help button.
- Set the chat’s language or theme.
window.$botbrains is available and use .push() to queue them while the chat loads.
In React Native, use injectJavaScript to call SDK commands. To forward SDK events back to your app, use window.ReactNativeWebView.postMessage and handle them with onMessage. See the React Native WebView bridge guide and SDK events.
Voice and microphone permissions
For voice, request the app’s microphone permission when the user starts the feature. In React Native:- iOS: Add a localized
NSMicrophoneUsageDescriptiontoInfo.plist. SetmediaCapturePermissionGrantType="grantIfSameHostElseDeny"on the BotBrains WebView to avoid the additional website prompt after native permission is granted. Keep this WebView restricted tohttps://chat.botbrains.io; the setting trusts its current host. - Android: Declare
android.permission.RECORD_AUDIOand request it at runtime using your permission library orPermissionsAndroid. React Native WebView handles web audio permission requests; custom native handlers must check the requesting origin and grant only audio capture. SeePermissionRequest. Android controls the system prompt’s wording; put custom explanations in your app UI.