To integrate Proactive or IVR Deflection to App messaging, brands must follow these configurations steps when implementing the SDK (minimum version iOS SDK 6.2 more below):
-
Text only content is not supported until 6.8.0. Rich formats are supported since 6.2.0.
-
Make sure the brand app already has push notification set up in order to enable their consumers to receive notifications. You can find detailed instructions on how to set up LivePerson's push notification service here.
Limitations
- Processing InApp Notifications for Proactive and IVR Deflection messages is only supported when using the default In App Notification provided by the LPMessagingSDK.
- When using Custom InApp Notifications, Host App has to call
handleTapForInAppNotification
to notify the SDK an InApp Notification was tapped.
Configurations
Send push notifications in logout state (new Logout API)
Consumers can now receive push notifications even in logged out state. SDK has introduced new enum configurations to let brands decide If they want consumers to receive notifications when logged out. Brands can choose either of the following configurations to unregister user from pusher:
func logout(unregisterType: LPPusherUnregisterType,
completion: @escaping ()->(),
failure: @escaping (_ errors: [Error])->())
LPPusherUnregisterType
All: unregister for all types of push notification messages
None: do not unregister from the pusher at all
Agent: Unregister only for agent push notification messages. Consumers can still receive outbound push notifications sent from the Proactive or Connect to Messaging (IVR) services.
Handling Proactive or IVR Deflection invite push notification
When a push notification is received and tapped by the consumer, simply pass it to the SDK's handlePush function. The SDK will then automatically handle and display a valid, non-expired proactive or IVR Deflection invitation message when the consumer launches the messaging window.
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {
//Available since SDK v6.23
if let notification = LPMessaging.instance.handlePush(userInfo) {
// Handle the notification object if it exists
print("Received LPNotification: \(notification)")
} else {
// No notification object was returned
print("No LPNotification object returned.")
}
}
Processing InApp notifications when the app is active
If a brand wishes to allow the SDK to automatically process Proactive and IVR Deflection invite push notification (without requiring the consumer to tap on the inApp push notification) while the application is active, the following configuration enableInAppProcessingForActiveState must be enabled:
enableInAppProcessingForActiveState = true
This flags enables SDK to process InApp Notifications for Proactive and IVR Deflection messages, is not related to Push Notifications received when the Application is not active.
Optional: Overriding InApp notifications
When using the LPMessagingSDKNotification(customLocalPushNotificationView notification: LPNotification)
protocol to override the InApp Notification, Host App has to call the following method to notify the SDK an InApp Notification was tapped:
public func handleTapForInAppNotifications(notifications: [LPNotification], clearOthers: Bool = false)
Fetching Pending Proactive Messages
Starting from v6.22.0, the SDK provides two additional options for displaying pending proactive or IVR deflection messages within the host app.
Option #1: Host App Fetches and handles Pending Proactive / IVR Deflection Messages manually.
The host app can call the getPendingProactiveMessages API to retrieve a list of pending proactive or IVR deflection messages for the consumer. This method should be called after the SDK has been initialized and before invoking the showConversation method. This approach allows the host app to notify consumers of any pending messages — for example, by displaying a badge count or red icon on the messaging icon. It also enables enhanced user experiences, such as showing a list of pending messages in a separate screen or view, allowing consumers to select a message before proceeding to the conversation screen.
To retrieve the list of pending Proactive or IVR Deflection messages:
public func getPendingProactiveMessages(_ conversationQuery: ConversationParamProtocol,
authenticationParams: LPAuthenticationParams,
alternateBundleID: String? = nil,
completion: @escaping (_ notifications: [LPNotification]) -> Void,
failure: @escaping (_ error: Error) -> Void)
When the consumer taps on a selected proactive or IVR deflection message, use the handleTapForInAppNotifications method to let the SDK process it. The SDK will then display the valid, non-expired Proactive or IVR Deflection invitation message when the consumer launches the messaging window.
func handleTapForInAppNotifications(notifications: [LPNotification], clearOthers: Bool = false)
Option #2: Mobile SDK Automatically Handles and Displays Pending Proactive or IVR Deflection Messages
The LivePerson Mobile SDK can internally fetch pending proactive or IVR deflection messages using fetchPendingProactiveMessagesImplicitly and display them directly on the conversation screen. To enable this behavior, the host app must configure the SDK as follows:
fetchPendingProactiveMessagesImplicitly = true