Build a Bot with Working Hours

Learn how to add working hours to your Bot.

  • Messaging

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.

Screenshot 2024-02-15 at 2.57.08 PM.png

The Conversation Builder appears.

Screenshot 2024-02-15 at 3.05.13 PM.png

Click New Bot. The Choose a Bot Template window appears.

Screenshot 2024-02-15 at 3.10.42 PM.png

Select Custom > Custom Bot. The Bot details page appears.

Screenshot 2024-02-16 at 2.11.36 PM.png

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. For more information about Small Talk see, here.

    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. For more information on Bot Groups see, here.

Once done click Create Bot. The Bot Dialog page appears.

Screenshot 2024-02-16 at 2.14.09 PM.png

Click the custom code icon for the interaction. The Custom Code page appears.

Screenshot 2024-02-16 at 2.16.15 PM.png

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.

ScreenRecording2024-02-19at7.16.44PM-ezgif.com-video-to-gif-converter.gif

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).

For further information and advanced techniques on API integrations see, here.