This guide will walk you through creating a bot in LivePerson Conversational Builder that automatically closes conversations outside of your designated business hours.
To build the bot:
Log in to your Conversational Cloud account and navigate to Automate > Conversation Builder.
The Conversation Builder appears.
Click New Bot. The Choose a Bot Template window appears.
Select Custom > Custom Bot. The Bot details page appears.
Provide the following information:
1. Name: Input the name for your bot into the field.
2. Description: Input information describing your bot.
3. Channel Type: Select the messaging option.
4. Small Talk: Select to turn on/off the small talk option.
Small Talk provides a human-like experience by providing chitchat, pleasantries, and other trivial conversation.
5. Bot Language: Select the language you require the bot to use from the dropdown menu.
6. Bot Group: Select a bot group if required, from the dropdown menu.
Bot Group is a collection of bots that can be grouped together for easier management and organization on the Bots dashboard.
Once done click Create Bot. The Bot Dialog page appears.
Click the custom code icon for the interaction. The Custom Code page appears.
Provide the following code:
Javascript:
var hoursSpec = [
"REG_HOURS~08:00~17:59",
"OFF_HOURS~18:00-07:59"
];
var type = botContext.getHoursType(hoursSpec, "America/New_York");
// TEST FOR type and set the transferMessage to result
switch (type) {
case "REG_HOURS":
msg = "Bot is on regular hours.";
botContext.sendMessage(msg);
break;
case "OFF_HOURS":
msg = "Bot is closed. Comeback tomorrow";
botContext.sendMessage(msg);
botContext.setTriggerNextMessage("closeConversation");
break;
}
Click Add Script. Once done, click Preview. The integration appears in the conversation window.
Ensure the bot responds correctly during and outside your defined business hours. Once satisfied, deploy your bot to your desired channels (e.g., website, messaging app).