SDK Requirements

  • Xcode 9.3 and up, (XCode version 10.2.1 and up is highly recommended)
  • Minimum deployment target iOS 11.3 (iOS 12.1 and up is highly recommended).
  • Swift 4.2 and up
  • An iMessage App / Extension target
  • App Groups configured and enabled in 'Capabilities'

    XCFramework version is named LPABCMessagingSDK from 1.3.9. Also the import is LPABCMessagingSDK within the code from 1.3.9 and beyond but the class is LPABCSDK.

Apple and LivePerson Configuration

  1. Make sure you have an Apple Messages for Business business ID.
  2. Contact your LivePerson account representative (other contact options: chat with us on this page, or message Support) to enable this SDK on the backend server.

SDK Installation in XCode

Manual installation

See the SDK code on GitHub.

Copy the LPABCSDK.framework or the LPABCMessagingSDK in XCFramework versions to your XCode project, make sure it is included in the Embedded Binaries section, under the project settings/General tab in the main app target, and in the Linked Frameworks and Libraries in the iMessageApp Target, as well as in Linked Binary With Libraries under Build Phases of each implementing target.

XCFramework version is named LPABCMessagingSDK from 1.3.9. Also the import is LPABCMessagingSDK within the code from 1.3.9 and beyond but the class is LPABCSDK.

  1. In v1.3.9 or beyond skip this step as it is unneeded for xcframework. In project settings of host app target, navigate to the Build Phases tab, and click the + button to paste the following:

    bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/LPABCSDK.framework/framework-strip.sh"

    This script removes unused architectures from the binary. This is pointing to the actual script available in the SDK framework.

CocoaPods installation

Install CocoaPods:

  sudo gem install cocoapods

Navigate to your project folder and create a Podfile for your project:

  pod init

Open the Podfile.

  open -a Xcode Podfile

Add the LPABCSDK pod to integrate it into your Xcode project. Make sure you change the target name to your target name:

  target '<Your Target Name>' do
      platform :ios, '11.3'
      use_frameworks!
      pod 'LPABCSDK'
  end

XCFramework version is named LPABCMessagingSDK from 1.3.9. The pod name is still LPABCSDK for all versions. Also the import is LPABCMessagingSDK within the code from 1.3.9 and beyond but the class is LPABCSDK.

SPM installation

Below are instructions to add the SPM XCFramework from git.

  1. Go to your project settings. Project Settings Screen

  2. Go to Package Dependencies Project Dependencies Screen

  3. Tap the plus under packages and enter the URL https://github.com/LP-Messaging/lp-mobile-abc-sdk-ios-spm.git into the search bar in the top right. Add Package Screen

  4. Specify the project you would like to add it to and the version you want. The current version is likely selected by default. Then click Add Package in the bottom right.

  5. The package will download and you may get another prompt with another add package button. Review the information is correct then click add package again.

  6. After completion you will see the package on the projects package page like below. Package Dependencies Screen Package Added

  7. You may now import into your code the ABC SDK. SPM only contains XCFramework versions of the ABC SDK so the import will be like below while the class functions are still LPABCSDK.

import LPABCMessagingSDK //import the sdk

LPABCSDK.initialize(minimumLogLevel: .trace) //example of calling to initialize the SDK installed from SPM

SDK Integration

  1. For each implementing target, make sure to enable App groups in the capabilities section in XCODE.

  2. In the info.plist file of each implementing target, create a dictionary with the key LPABC_PARAMS and add a key-value pair of lpabc_appgroup : <your_app_group_id>

    Your app group id should be the same across all implementing targets.

  3. Add import LPABCSDK to the relevant class files and initialize the SDK.

    XCFramework version is named LPABCMessagingSDK

  4. In the iMessage app/extension's MessagesViewController class, please make sure to override the following two methods:

    • override func didBecomeActive(with conversation: MSConversation)
    • override func didSelect(_ message: MSMessage, conversation: MSConversation)
    • override func didReceive(_ message: MSMessage, conversation: MSConversation)

For passing in references to the SDK (optional), please and use SDKParams to reference elements such as MSMessagesAppViewController, etc. See the override of viewDidLoad() in the example below.

In the implementation of these methods, add the appropriate update() methods for each, seen in the example below.

Example

import LPABCSDK //XCFramework is LPABCMessagingSDK for the import

class MessagesViewController : MSMessagesViewController {

    var lpabcsdk = LPABCSDK.initializeSDK()
    var sdkParams: SDKParams?

    override func viewDidLoad() {
        super.viewDidLoad()

        self.sdkParams =
        SDKParams(messagesViewController: self,
            secureFormReplyImagee: <Reference to a `UIimage` used for s secure form reply message MSMessageLayout image>,
            secureFormReplyText: `<Contextual text for you secure form reply message in Live Engage>`)
    }

    override func didBecomeActive(with conversation: MSConversation) {
        lpabcsdk.update(with: conversation, sdkParams: sdkParams)
    }

    override func didReceive(_ message: MSMessage, conversation: MSConversation) {
        lpabcsdk.update(with: conversation, message: message)
    }

    override func didSelect(_ message: MSMessage, conversation: MSConversation) {
        lpabcsdk.update(with: conversation, message: message, sdkParams: sdkParams)

    }

 }

In order to enable SDE reporting, The SDK will need to recieve an initial CIM, per each new conversation. You can use lpabcsdk.isCacheLoaded to get a reference to the SDK's cache state.

This will enable the SDK to send SDEs (Engagement Attributes) to Conversational Cloud, once a cache payload is available.