Install the package
Add the following line to your Podfile under your app target:
target 'YourAppTarget' do
use_frameworks!
pod 'bolddesk_chat_sdk', '~> {latest-version}'
end
Then install the SDK using the pod install or pod update command in the terminal. You can find the latest package version here iOS Package
Required Permissions
Add the below keys in Info.plist of your app
<key>NSCameraUsageDescription</key>
<key>NSMicrophoneUsageDescription</key>
<key>NSPhotoLibraryUsageDescription</key>
SDK Initialization
Configure SDK
Initialize once in your application class or before using SDK features.
BDChatSDK.configure(
appKey: "Your AppKey",
brandUrl: "yourdomain.bolddesk.com",
culture: "en-US"
)
Show Chat
Launches the BoldDesk chat interface inside your app, allowing users to start or continue conversations with support agents.
BDChatSDK.showChat()
Close Chat
Closes the active chat window and returns the user to the app interface.
BDChatSDK.closeChat()
Prefilling User Fields
You can pre-fill user details before initializing the chat. This improves the user experience by eliminating the need for manual entry.
| Property | Description |
|---|---|
| Pre-fills the user’s email. If provided, visitors don’t need to enter it manually. The conversation is created using this email once the visitor sends their first message. | |
| Name | Pre-fills the user’s name. Requires an email to be set. |
| Phone Number | Pre-fills the user’s phone number. Requires an email to be set. |
| Chat Fields | The fields configuration block allows you to prefill Custom Chat Fields using their Field API Names. |
BDChatSDK.setPrefillFields(
name = "John Do",
email = "user@example.com",
phoneNumber = "1234567890",
chatFields = [],
)
User Verification with JWT
Live Chat enables user verification using JSON Web Tokens (JWT). Through JWT-based verification, users are identified as either verified or not verified within the configured live chat. To learn more, see How to Verify Users Conversation In Live Chat.
BDChatSDK.setUserToken("your_token_here")
Clear Session
Resets the current chat session, removing user-specific data and cached information.
BDChatSDK.clearSession()
UI Customization
Apply Theme
You can dynamically apply themes for appbar and buttons
BDChatSDK.applyTheme(
appBarColor = "#1976D2",
accentColor = "#FFC107",
backgroundColor = "#1976D2",
stickyButtonColor = "#FFC107"
)
Theme Modes
| Mode | Description | Code snippet |
|---|---|---|
| Light | Forces light mode | BDChatSDK.setPreferredTheme(SDKTheme.light) |
| Dark | Forces dark mode | BDChatSDK.setPreferredTheme(SDKTheme.dark) |
| System Default | Follow system theme | BDChatSDK.setPreferredTheme(SDKTheme.system) |
Font Customization
The SDK supports custom fonts defined in your main application.
Include Font Files
- Add the .ttf font file to your project
- Add font name in Info.plist under UIAppFonts
Register Fonts in Code
BDChatSDK.customFontName = "Inter" or "Roboto" // font name
Push Notification Integration
The SDK supports push notifications using Firebase Cloud Messaging (FCM) to alert users about chat incoming messages.
Add Firebase to Your Project
• Go to Firebase Console Add Firebase to your iOS project
• Add a new iOS app and register it with your Bundle Identifier
• Download the generated GoogleService-Info.plist file
• Add the file to your project
• Add Firebase dependencies in your Podfile
pod 'FirebaseCore'
pod 'FirebaseMessaging'
Register notifications
To register push notifications, include the following code snippet in the didReceiveRegistrationToken of AppDelegate class.
func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) {
BDChatSDK.enablePushNotification(fcmToken: fcmToken)
}
Handling notifications
To handle push notifications, include the following code snippet in the didReceiveRemoteNotification of main class.
func userNotificationCenter(_ center: UNUserNotificationCenter,didReceive response: UNNotificationResponse,withCompletionHandler completionHandler: @escaping () -> Void) {
let userInfo = response.notification.request.content.userInfo
if BDChatSDK.isFromChatSDK(userInfo: userInfo) {
BDChatSDK.handlePushNotification(userInfo: userInfo)
}
completionHandler()
}
Error Logging
Enable debug logging during development to view detailed SDK logs in Logcat.
BDChatSDK.enableLogging()
API Reference
| API | Description |
|---|---|
| BDChatSDK.configure(“Your AppKey”, “Your brand URL”,“en-US”) | Initializes the SDK |
| BDChatSDK.showChat() | To open chat widget window |
| BDChatSDK.closeChat() | To close chat widget window |
| BDChatSDK.setPreferredTheme(mode) | Sets light/dark/system theme |
| BDChatSDK.customFontName = “Inter” or “Roboto” | Apply custom font to match your app |
| BDChatSDK.enablePushNotification(fcmToken: token) | To send registered device token to SDK app for receiving push notifications |
| BDChatSDK.disablePushNotification() | To stop receiving push notifications |
Sample App
A sample application is provided along with the SDK package to help you understand the integration flow and available features.
You can use this app to explore the SDK behavior before integrating it into your own project iOS Sample.