You can register for LivePerson events related to the conversation, determine the layout of messaging with the app, sends logs from LiveEngage to your app, and display consumer information to agents or vice versus.

The most suitable time to customize configuration is right after the SDK initialization and before calling showConversation().

  • Default configuration:

     let configuration = LPConfig.defaultConfiguration
    
  • Print all configurable attributes and their default values:

     LPConfig.printAllConfigurations()
    

App Extensions

To make sure the SDK uses the iOS keyboard only, and not third party ones, disable app extensions for keyboard as follows:

In your AppDelegate, add the method application(_:shouldAllowExtensionPointIdentifier:) with the implementation of:

func application(_ application: UIApplication, shouldAllowExtensionPointIdentifier extensionPointIdentifier: UIApplicationExtensionPointIdentifier) -> Bool {
    return extensionPointIdentifier != UIApplicationExtensionPointIdentifier.keyboard
 }

Branding

You can customize the look and feel of your app using the LPConfig object. Create your configuration instance and assign the attributes you want to customize. For the list of all the attributes to can configure, see Attributes.

Example configuration:

configuration.remoteUserBubbleBackgroundColor = UIColor.purpleColor()
configuration.brandName = "Brand Name"
configuration.remoteUserBubbleBorderWidth = 0.5

Conversations Lifecycle

During the course of the conversation, consumers can take several actions such as Mark as urgent to receive a faster service, or Resolve conversation to let your agents know they have received their answers.

Methods

For information about the methods, see to Messaging API.

  • Check for an active conversation:
    • True - Active conversation
    • False - No active conversation
     public func checkActiveConversation(conversationQuery: ConversationParamProtocol) -> Bool
    
  • Mark the current conversation as Urgent:

     public func markAsUrgent(conversationQuery: ConversationParamProtocol)
    
  • Check if the current conversation is marked as Urgent:

     public func isUrgent(conversationQuery: ConversationParamProtocol) -> Bool
    
  • Mark an urgent conversation as normal:

     public func dismissUrgent(conversationQuery: ConversationParamProtocol)
    
  • Resolve the current conversation:

     public class func resolveConversation(_ conversation: Conversation, completion: (() -> Void)? = {()})
    
     public class func resolveConversationForConversationQuery(_ conversationQuery: ConversationParamProtocol, completion: (() -> Void)? = {()})
    
  • Clear the conversation history:

     public func clearHistory(conversationQuery: ConversationParamProtocol) throws
    

    Note: Use clear history only if there is no open/active conversation.

  • Logout Current User from LPMessagingSDK:

     public func logout()
    
  • Stop and clear all the metadata of the SDK:

     public func destruct()
    

Delegates

  • Triggered when the the user submits the survey and dismisses the customer satisfaction survey:

     <LPMessagingSDKdelegate> optional func LPMessagingSDKConversationCSATDismissedOnSubmittion(conversationID: String?)
    
  • Triggered after the user submits the customer satisfaction with a score:

     <LPMessagingSDKdelegate> optional func LPMessagingSDKCSATScoreSubmissionDidFinish(brandID: String, rating: Int)
    
  • Triggered when a new conversation has started, from the agent or from the consumer side:

     <LPMessagingSDKdelegate> optional func LPMessagingSDKConversationStarted(conversationID: String?)
    
  • Triggered when a conversation has ended, from the agent or from the consumer side:

     <LPMessagingSDKdelegate> optional func LPMessagingSDKConversationEnded(_ conversationID: String?, closeReason: LPConversationCloseReason)
    
  • Triggered when the conversation view controller is removed from its container view controller or window:

     <LPMessagingSDKdelegate> optional func LPMessagingSDKConversationViewControllerDidDismiss()
    
  • Triggered each time the agent typing state changes:

     <LPMessagingSDKdelegate> optional func LPMessagingSDKAgentIsTypingStateChanged(isTyping: Bool)
    

Customer Experience Survey

The Customer Experience Survey contains the agent avatar, and by default, the agent's name is empty. If the conversation has an assigned agent and its image was downloaded previously using profileUrl, this image displays in the view. Also, if the conversation has an assigned agent, the agent's nickName is used. If no avatar image, then the default avatar image displays with the background and tint color configuration for the agent bubble.

The survey only shows if the CSAT configured to appear according to LPConfig.defaultConfiguration.csatShowSurveyView, the conversation has an assigned agent, or the CSAT wasn't previously submitted. The survey gets dismissed when the user completes the survey and then presses the submit button or if they chose to skip the CSAT. The CSAT gets automatically dismissed if the consumer filled it in on another device. If the CSAT is visible when an agent resumes the conversation, the CSAT gets dismissed automatically.

Notes: When using Custom View Controller Mode, the Conversation view must be removed when leaving the App. To avoid dismissing the View when CSAT/SecureForms/PhotoSharing View is presented, you should only dismiss the Conversation view if Moving From ParentView, as demonstrated below.

if (self.conversationQuery != nil && self.isMovingToParentViewController){
    LPMessagingSDK.instance.removeConversation(self.conversationQuery!)
}

When ViewController Mode is used, on the Navigation Bar Back Button, you can simply call LPMessagingSDK.instance.removeConversation(self.conversationQuery!).

You must customize your Customer Experience Survey before initializing a conversation (calling LPMessagingSDK.instance.showAgentConversation()).

  • Get the object containing the default configurations:

     let configuration = LPConfig.defaultConfiguration
    
  • Set Survey Button Background Color:

     configuration.csatSubmitButtonBackgroundColor = UIColor.lightGray
    
  • Set Survey Background Color of the Rating Buttons:

     configuration.csatRatingButtonSelectedColor = UIColor.lightGray
    
  • Set Survey Color for the FCR survey buttons (YES/NO) when selected:

     configuration.csatResolutionButtonSelectedColor = UIColor.lightGray
    
  • Set Survey Text Color for all Labels:

     configuration.csatAllTitlesTextColor = UIColor.lightGray
    
  • Set Survey Navigation Bar Background Color:

     configuration.csatNavigationBackgroundColor = UIColor.lightGray
    

Example configuration:

let configuration = LPConfig.defaultConfiguration
configuration.csatSubmitButtonBackgroundColor = UIColor.lightGray
configuration.csatRatingButtonSelectedColor = UIColor.lightGray
configuration.csatResolutionButtonSelectedColor = UIColor.lightGray
configuration.csatAllTitlesTextColor = UIColor.lightGray
configuration.csatNavigationBackgroundColor = UIColor.lightGray
  • Hide or don't use the agent avatar and agent name:

     LPConfig.defaultConfiguration.csatAgentViewHidden
    
  • Set agent avatar icon and background color:

     LPConfig.defaultConfiguration.csatAgentAvatarBackgroundColor
     LPConfig.defaultConfiguration.csatAgentAvatarIconColor
    
  • Define the color of the stars:

     LPConfig.defaultConfiguration.csatRatingButtonSelectedColor
    

    The rating question includes 'Agent' by default in the text. If the conversation has an assigned agent and the agent's nickName is not empty, this nickName is used instead.

    The visibility cannot be configured; therefore, it is always visible.

  • Hide or don't use the Resolution Confirmation View (yes/no):

     LPConfig.defaultConfiguration.csatResolutionHidden
    

    If agentView is shown ("csatAgentViewHidden"), this view will always be hidden, even if "csatResolutionHidden" is set to true.

  • Define the CSAT title text color:

     LPConfig.defaultConfiguration.csatAllTitlesTextColor
    

For more details on the different attributes you are able to customize, refer to Attributes.

Logs and Info

Send logs from LiveEngage to your app. Logs include different severity levels of errors and warnings.

  • Subscribe the host app to receive log events from a specific log level and above:

     public func subscribeLogEvents(logLevel: LogLevel)
    

    Note: Refer to Interface and class definitions to learn more about the LogLevel object.

  • Triggered when the SDK version you're using is obselete and needs an update:

     <LPMessagingSDKdelegate> func LPMessagingSDKObseleteVersion(error: NSError)
    
  • Return the SDK current version:

     public func getSDKVersion() -> String?
    
  • Print all the keys that can be localized on the SDK:

     public func printAllLocalizedKeys()
    
  • Print all supported languages on the SDK:

     public func printSupportedLanguages()
    
  • Return all supported languages on the SDK:

     public func getAllSupportedLanguages() -> [String : String]
    

LPMessagingSDK Delegates

The SDK uses 2 delegates:

  1. LPMessagingSDKDelegate - for lifecycle and connectivity events:

    LPMessagingSDK.instance.delegate = self
    
  2. LPMessagingSDKNotificationDelegate - for handling Push and In-App Notifications:

    LPMessagingSDK.instance.registerPushNotifications(token: deviceToken, notificationDelegate: self)
    

You should implement and set the LPMessagingSDKNotificationDelegate, in order to receive Push Notifications from the SDK.

Conversation Functions

  • Get the conversation screen and determine which of the conversations to display in the Conversation Window.

     public func getConversationBrandQuery(_ brandID: String, campaignInfo: LPCampaignInfo? = nil) -> ConversationParamProtocol
    
  • Get the conversation screen and determine which of the conversations to display in the Conversation Window, using the Consumer ID:

     public func getConversationConsumerQuery(consumerID: String?, brandID: String, agentToken: String) -> ConversationParamProtocol
    
  • Return a boolean flag, with Ready when the Brand is connected and conversation can be processed:

     public func isBrandReady(brandID: String) -> Bool
    

Message screen

You can customize the messaging screen by adding more options to the LPMessagingSDK menu, such as Mark as urgent, Clear history, and Resolve the conversation.

  • Add options to the messaging menu:

     LPMessagingSDK.instance.toggleChatActions("Your Account Number")
    
  • Get the object containing the default configurations:

     let configuration = LPConfig.defaultConfiguration
    
  • Set Agent User Bubble Background Color:

     configuration.remoteUserBubbleBackgroundColor = UIColor.lightGray
    
  • Set Agent User Bubble Border Color:

     configuration.remoteUserBubbleBorderColor = UIColor.lightGray
    
  • Set Agent Avatar Silhouette Color:

     configuration.remoteUserAvatarIconColor = UIColor.white
    
  • Set Agent Avatar Background Color:

     configuration.remoteUserAvatarBackgroundColor = UIColor.lightGray
    
  • Set User Bubble Background Color:

     configuration.userBubbleBackgroundColor = UIColor.white
    
  • Set User Bubble Border Color:

     configuration.userBubbleBorderColor = UIColor.lightGray
    
  • Set User Bubble Border Width:

     configuration.userBubbleBorderWidth = 1.0
    
  • Set User Text Color:

     configuration.userBubbleTextColor = tangerine
    
  • Set Scroll to Bottom Button Background Color:

     configuration.scrollToBottomButtonBackgroundColor = tangerine
    

For more details on the different attributes you are able to customize, refer to Customizing and Branding.

Push Notifications

Currently, our default flow for the process of loading the Conversation View Controller (such as registering with several of our internal domains) also registers the consumer to our Push Notification service. If this is not desired, you can now opt out of this process by setting the following flag to "false". The default is set to "true", and in order for the changes to take effect the consumer must log out of the LPMessagingSDK:

configuration.enableLpPusherService: Bool = true

UI

To determine the layout of messaging within the app, you can utilize various actions to control the behavior and UI such as menus, custom buttons, typing indication, etc.

Note: The following methods (1,2 and 3) are only available when using the SDK ViewController (Window Mode).

  • Change the state of the action menu of the conversation for brandID:

     public func toggleChatActions(accountID: String, sender: UIBarButtonItem? = nil)
    

    Note: Refer to [Messaging API to learn more about toggleChatActions.

  • Triggered each time the SDK menu is opened/closed:

     <LPMessagingSDKdelegate> optional func LPMessagingSDKActionsMenuToggled(toggled: Bool)
    
  • If you set a custom button, the LPMessagingSDKCustomButtonTapped method gets called when clicking the custom button:

     <LPMessagingSDKdelegate> optional func LPMessagingSDKCustomButtonTapped()
    
  • Triggered if Off-Hours state changed:

     <LPMessagingSDKdelegate> optional func LPMessagingSDKOffHoursStateChanged(isOffHours: Bool, brandID: String)
    

User Data

Pass and display consumer information to agents, and agent information to consumers.

Note: Refer to Interface and class definitions to learn more about the LPUser object.

  • Set the user profile on LiveEngage:

     public func setUserProfile(lpuser: LPUser, brandID: String)
    
  • Return Previously Assigned Agent, if any:

     public func getAssignedAgent(conversationQuery: ConversationParamProtocol) -> LPUser?
    
  • Triggered each time the SDK receives info about the agent from the Server:

     <LPMessagingSDKdelegate> optional func LPMessagingSDKAgentDetails(agent: LPUser?)