Use the Core SDK for iOS

The Core SDK allows you to call all the necessary In-App Messaging APIs directly from your app. With the Core SDK, you’re in full control over the entire user experience—you tell the API when to send a message and the API tells you when a message is received. If you want to use our ready-made user interface and user experience, use the UI SDK instead.

Import the framework wherever you’re using the SDK.

Create a Configuration 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": ""

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.

The CoreFactory class lets you create a CoreClient object. To receive messages and events, call CoreClient.start().

The CoreClient object lets you create a ConversationClient object to start a conversation.

In order to get the pre-chat fields before a conversation, call the retrieveRemoteConfiguration method from your CoreClient object. This method passes back an SMIRemoteConfigurationCompletion completion block that contains the array of pre-chat fields.

Each pre-chat field has the properties necessary for you to build your pre-chat form. After you present a pre-chat form to the user, fill in the value field for each pre-chat object. Then submit the pre-chat fields using the submitPreChatFields method on the ConversationClient object.

Send a message with the ConversationClient instance.

To listen for events (such as new incoming messages), implement a delegate.

Implement the CoreDelegate protocol to listen for general messaging events or implement the ConversationClientDelegate protocol to listen for messaging events related to a particular conversation. The conversation delegate (ConversationClientDelegate) gets all events for a specific conversation. The core delegate (CoreDelegate) gets events for every conversation. The core delegate also returns network connectivity events (didChangeNetworkStatus) and general error messages (didError).

Use the addDelegate method on the CoreClient instance to add a core delegate. Use the addDelegate method on the ConversationClient instance to add a conversation client delegate.

To learn more, see Set Up Messaging Notifications for iOS.

For more detail about the Core SDK, see the iOS Reference Documentation.