Supported versions: 5.18 and above

Sometimes it depends on the conversation or engagement details which welcome message should be represented to the user. Sometimes we need to show or hide a welcome message depending on recently closed conversation data.

Previously, to set a welcome message for a particular consumer you needed to set it to conversation parameters and initialize SDK using that parameters. Now there is no need to reinitialize the SDK to set a new welcome message structure for an active consumer. Here it is a situation where a Dynamic Welcome Message API could be used!

Code sample

LPWelcomeMessage lpWelcomeMessage = new LPWelcomeMessage("Welcome Message");
List<MessageOption> optionItems = new ArrayList<>();
optionItems.add(new MessageOption("bill", "bill"));
optionItems.add(new MessageOption("sales", "sales"));
optionItems.add(new MessageOption("support", "support"));
try {
       lpWelcomeMessage.setMessageOptions(optionItems);
} catch (Exception e) {
       e.printStackTrace();
}
lpWelcomeMessage.setNumberOfItemsPerRow(8);
lpWelcomeMessage.setMessageFrequency(LPWelcomeMessage.MessageFrequency.EVERY_CONVERSATION);
LivePerson.setWelcomeMessage(Activity|Context, brandId, lpWelcomeMessage);

The structure of welcome message remains the same as for Welcome Message With Quick Replies.

Presentation delay

Sometimes it is better to prevent showing a default welcome message provided in parameters when conversation was resolved. For that reason brands apps need to have a delay to set a new welcome message based on conversation data of the recently resolved dialog. SDK contains a runtime configuration named lp_welcome_message_delay_in_seconds that represents a timeout duration to set a welcome message.

How it works:

  • When sdk is initialized or any conversation started, the brand could handle this event and set a delay for the next welcome represented.
  • If active conversation is resolved SDK will wait until timeout reached and won’t show a welcome message for new conversation.
  • If brand’s set a new welcome message within timeout bounds - it will be represent on conversation immediately
  • If timeout was reached and the brand doesn’t provide a new welcome message the welcome message from conversation parameters will be represented. However, if the brand provides a new welcome message structure after a delay the represented welcome message will be changed according to the structure of the message recently set by brand.

Note: once a new welcome message is set it's better to set a delay to 0 to prevent consumers waiting for a new welcome message when the app moves to the background/foreground.

Limitations and rules.

Dynamic welcome message limitations stay the same as for Welcome Message With Quick Replies set in conversation params, but there are also some additional rules you need to know:

  • Last represented welcome message won’t be changed if a new welcome message was previously set for a started conversation.
  • Last set welcome message will be represented for an active consumer if conditions match and active consumer rotates a screen or any configuration changes performed.
  • In case when a welcome message is represented and the brand’s app sets a new welcome message and there is no active conversation, the welcome message will be updated with a new structure set by the brand's app.
  • The dynamic welcome message would be cleared if the user leaves the conversation screen. If the user opens the conversation screen once again, a welcome message from conversation params would be represented if conditions match.
  • If the last known welcome message frequency is set to first time conversation SDK would wait for a welcome message anyway, but once it is not updated and the previous welcome message has frequency that equals first_time conversation, the welcome message won’t be represented on the conversion screen.
  • If the previous welcome message’s frequency is set to first_time_conversation and new welcome message frequency is set to every_conversation SDK will represent a new welcome message for a user with an existing history.
  • If the previous welcome message’s frequency is set to every_conversation and new welcome message frequency is set to first_conversation SDK will remove a recent welcome message from the conversation screen.