Use the UI SDK for iOS

The UI SDK allows you to add Messaging for In-App into your iOS app with a ready-to-go user experience. Just add the Interface view to your app. You can customize the colors and strings so that the Messaging user interface looks natural in your app.

Import the frameworks from wherever you’re using the SDK.

Create a UIConfiguration instance. To create a configuration instance, you can point to the config file you previously downloaded from your org, or you can manually add the values from within this config file.

OPTION 1: Configure Using the Config File

Once you've added the config.json file to your project, you can reference it from the code.

To learn how to download the config file from your org, see Configure a Messaging for In-App Deployment in Salesforce Help. This file contains the Service API URL, the org ID, and the API name for the deployment. For example:

{
  "OrganizationId": "00ZZZ0000000Zzz",
  "DeveloperName": "MyMessagingForInAppDeployment",
  "Url": "https://zzzz.my.api.url.salesforce-scrt.com"
}

OPTION 2: Configure Manually with Config Info

If you don't want to use the config.json file in your project, you can configure the SDK manually using the Service API URL, the org ID, and the API name for the deployment.

If you're using SwiftUI, add the Interface view to your view, using the UIConfiguration instance to initialize and display the chat feed.

If you're using Swift or Objective-C, add the InterfaceViewController view controller to your app, using the UIConfiguration instance to initialize the view controller.

Without any additional code, the UI SDK automatically provides your customers with Messaging features such as pre-chat forms, bot support, file attachments, and estimated wait time. To learn how to configure these features in your org, visit our Messaging for In-App and Web learning map.

This step is only required if you want to implement push notifications.

Before you add code in your app for notifications, set up Apple Push Notifications as described in the Apple documentation. Then follow Salesforce org setup instructions at Set Push Notifications for Messaging for In-App.

In your mobile app, make a call into the SDK with device token information during registration. To learn more, see Set Up Messaging Notifications for iOS.

This step is optional.

The UI SDK automatically brands the app with a default color scheme, provides icons for all UI elements, and uses default text for all UI labels.

  • To customize the color scheme in your app, create color sets in your Assets catalog using the SDK's token names. To learn more, see Customize Colors for iOS.
  • To customize any UI text, create a localizable resource file in your app and override the string values. To learn more, see Customize Strings for iOS.
  • To customize the icons and images used throughout the SDK, add an asset to your project's Assets catalog using the associated keyword. To learn more, see Customize Icons for iOS.