To integrate Proactive or IVR Deflection to App messaging, brands must follow these configurations steps when implementing the SDK (minimum version 4.7/5.5):
-
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.
-
handlePushMessage
Call SDK’s handlePushMessage API upon receiving push notifications which will return PushMessage object.
public static PushMessage handlePushMessage(Context context, Map<String, String> remoteMessage, String brandId, boolean showNotification)
-
PushMessage
Refer here for detail.
-
setPushNotificationTapped
When the consumer taps on the notification, before redirecting the consumer to the conversation screen by calling showConversation / getConversationFragment method, call setPushNotificationTapped method and pass in the pushMessageId obtained from PushMessage object.
public static void setPushNotificationTapped(String pushMessageId)
-
set notification expiry
If you want to make sure consumers do not tap on expired notifications, set notification expiry (look back period) while creating and displaying notification.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
builder.setTimeoutAfter(pushMessage.getLookBackPeriod());
}
You can find an example on how to build a push notification and set an expiry in our SampleApp
- Use show_outbound_inapp_message configuration if required, see details in the section below.
Pending proactive messages
Since v5.23.1, SDK provides two options for displaying pending proactive messages within the host app.
Option #1: Host App Fetches Pending Proactive Messages
The host app can call the new API getPendingProactiveMessages to retrieve the list of pending proactive messages for the consumer. This method should be called after initializing the LP Mobile SDK and before invoking the showConversation method of the SDK. This approach allows the host app to notify consumers that there are pending proactive messages, such as by displaying a red icon or badge count on the messaging icon. Additionally, the host app can enhance the user experience by showing the list of pending proactive messages in a separate screen or view, allowing the consumer to choose one message before proceeding to the conversation screen. This option provides greater flexibility for the host app.
There are 2 approaches to enable this option:
- The host app calls the API getPendingProactiveMessages to fetch pending proactive messages then use setPushNotificationTapped API to display a targeted proactive message on the conversation screen.
LivePerson.getPendingProactiveMessages("appId", lpAuthParams, object : ICallback<List<PushMessage?>?, Exception?> { override fun onSuccess(value: List<PushMessage?>?) { Log.d(TAG, "onSuccess Pending proactive msg: ${value?.size}") } override fun onError(exception: Exception?) { Log.d(TAG, "onError") } } ) // LivePerson.setPushNotificationTapped("pushMessage.pushMessageId", false)
- Or the host app calls the API getPendingProactiveMessages to fetch pending proactive messages and set show_outbound_inapp_message to
true
then proactive message will be displayed automatically on the conversation screen. If there is more than one pending proactive message, then the latest proactive message will be displayed first.LivePerson.getPendingProactiveMessages("appId", lpAuthParams, object : ICallback<List<PushMessage?>?, Exception?> { override fun onSuccess(value: List<PushMessage?>?) { Log.d(TAG, "onSuccess Pending proactive msg: ${value?.size}") } override fun onError(exception: Exception?) { Log.d(TAG, "onError") } } ) // <bool name="show_outbound_in_app_message">true</bool>
Option #2: LivePerson Mobile SDK Handles Pending Proactive Messages
The LivePerson Mobile SDK can internally fetch the pending proactive messages (lp_fetch_pending_proactive_messages) and display them directly on the conversation screen. To enable this behavior, the host app needs to configure the relevant branding settings within the SDK.
<bool name="show_outbound_in_app_message">true</bool>
<bool name="lp_fetch_pending_proactive_messages">true</bool>
Recommendation
Based on the provided information and LivePerson’s recommendation, Option #1 is preferable as it offers a better user experience without impacting the critical conversation flow performance. Although it requires some development effort on the host app’s side, the flexibility and improved performance outweigh the benefits of a more straightforward implementation in Option #2.
Opting for Option #1 will ensure a smoother, more responsive user experience, aligning with best practices for maintaining high performance in critical user interactions like messaging.
Configurations
show_outbound_in_app_message
- This configuration allows brands that want to display the outbound message in the in-app conversation interface to consumers even after they discard or ignore the message notification.
- In case the consumer did not tap on the push notification to navigate to the in-app conversation, this configuration can be set to true if the brand wants to display the outbound message to the consumer even in the case that the look back period has expired. If set to false, the outbound message will not be displayed to consumers once they navigate to the in-app conversation screen from the app.
- Type: bool
- Default value: false
lp_fetch_pending_proactive_messages
- When true the SDK will fetch the pending proactive messages implicitly alongside fetching the other history messages in loading conversation screen process.
- Type: bool
- Default value: false
- Available since: 5.23.1
LogOut
Consumers can now receive push notifications even in logged out state. SDK has introduced new enum configurations to let brand decide If they want consumers to receive notifications when logged out.
Brands can choose either of the following configurations to unregister user from pusher:
PushUnregisterType
enum class PushUnregisterType {
NONE,
ALL,
AGENT
}
NONE: Do not unregister from pusher at all. Consumer will receive push notifications from both agent as well as outbound notification.
ALL (Default): Unregister/remove consumer from pusher. No push notifications will be sent if the consumer is logged out.
AGENT: Unregister only for agent push notification messages. Consumers will still receive outbound push notifications sent from the Proactive or Connect to Messaging (IVR) services.
Updated Liveperson.LogOut api:
Liveperson.LogOut()
public static void logOut(Context context, String brandId, String appId, PushUnregisterType unregisterType, LogoutLivePersonCallback logoutCallback)