Supported versions: 5.20.1 and above

When a consumer navigates to the conversation screen they cannot send a message right away, as they have to wait for connecting to the server and for the history to be retrieved first. With the release of the SDK version 5.20.1, we would like to introduce a new feature called Offline Messaging, which allows the consumer to start sending messages as soon as they open the conversation screen, without the need to wait until the connection is established.

Offline messages are messages that will be sent once connection with the server is established. To enable offline messages you need to set the lp_is_offline_messaging_enabled flag to true. All offline messages sent by consumers are initially added to the local storage and will be attached to the active conversation once retrieved from the server. If there is no active conversation, the SDK will create a new one to which all pending offline messages will be added.

Post-survey dialogs and offline messaging

As described previously, all pending messages would be attached to an active dialog, once a connection is established, but sometimes there is no need to do it if an active dialog is post-surveyed type. For that reason, SDK has a separate option for PCS dialogs.

In order to define this behavior the lp_offline_messages_for_pcs_behavior flag can be assigned to one of the following values:

  • 1 - remove offline messages from dialog and do not send them to UMS, continue with PCS dialog.
  • 2 - resolve active PCS dialog and send offline messages to a new conversation.
  • 0 / other values - do nothing, just send offline messages to the same dialog

Welcome message for offline mode.

If a consumer navigates to the conversation screen for the first time or after moving the application to foreground the actual conversation state is unknown unless authentication is completed and connection to the socket is established. Enabling lp_is_offline_messaging_enabled allows the user to type some messages, however no welcome message will appear at the beginning of the conversation. However, if a welcome message is obligatory you can set a lp_is_offline_welcome_message_enabled to show a welcome message at the bottom of the conversation.

Loading indicator while connecting to the server

With the introduction of the Offline Messaging feature we also had to re-think how to indicate to the user that a connection is being established without preventing them to start sending messages right away. For this reason we decided to show a less intrusive and more subtle loading indicator under the screen's top bar. The indicator will be displayed until the SDK connects to the server or until an error occurs. The view can be configured through the following attributes:

Limitations and rules.

  • If an unauthenticated consumer sends messages while the SDK is not connected and sends the app to background while still connecting to the server, all offline messages will be discarded and won’t be sent to the server.
  • Offline welcome message will not be shown on the agent side if it was added at the bottom of the conversation screen.