{{announcement.body}}
{{announcement.title}}

A Complete Guide to Managing Time and Date Periods With a Chatbot

DZone 's Guide to

A Complete Guide to Managing Time and Date Periods With a Chatbot

Check out a complete guide to managing time and date periods with a chatbot.

· AI Zone ·
Free Resource

Business Challenge

Dates are the key parameter that is mandatory in numerous business scenarios like Leave or Travel Request Creation, generating conversational reports for backend data for the date or period. However, it sometimes appears to be a challenge to record various date formats and combinations (one date, several dates, period).

Prerequisites

This tutorial is meant to be for advanced users, so if you haven’t built your first bot, follow this tutorial.
If you want to learn how to master memory management using the bot builder on SAP Conversational AI platform, please read this article first!

Solution

The best practices here from a re-usability and unified skills development perspective could be to use one skill only to address the tasks of getting a single date, several dates, or a period in different situations. In this case, we first capture any date input entity that we receive from the chat user (there can be two dates, a single date, or a period that is also a standard entity).

We try to capture at least one #datetime entity (Date From) (1) or an #interval entity (as Date From and Date To parameters) (2) in the Requirements tab:

datatime-entity-chatbot

Saving the Date From value from the #datetime entity, we capture the first element of an array of dates and record the ISO part of the standard entity. This is quite good practice to record standardized values, as it might be vital for integration:

nlp-entities-datetime-chatbot

In the #Interval entity processing, we record the beginning and end of the time period to distinguish between these memory parameters:

interval-entity-memory-management

Additionally, if the user provides two separate dates in one message (not as a time period), we record the Date To value as the second element of the #datetime array in the Actions tab of the skill:

nlp-entities-chatbot

If our scenario presupposes the availability of two dates, but the user initially provides only one date, then we have an additional check for the required memory parameter presence (Date To):

memory-date-chatbot

If such a memory parameter is missing (the second date, Date To in our example), we ask the user to input the appropriate date in the main skill (Leave Request Creation, for example) and we call an additional skill that records that second date in the Requirements tab:

requirements-chatbot-datetime

In this case, once we have already asked the user about the second date (Date To in our case), we record the first element of the #datetime array as the Date To memory parameter:

memory-field-nlp-entities

At this stage, we might ask ourselves the following question: “What if the user decides to provide the date at once, without waiting for the bot’s clarifying question?

We have a solution for this case too. In the main business skill, there are two types of action blocks:

1. If the entity is allocated and the target parameter is empty, the Get Date skill is called directly, and the date is recorded straightaway:

requirements-chatbot-memory-management

2. If the target entity is not recognized, then we ask the date to be provided, and redirect to the Get Date skill with the Wait for User Input option:

date-entity

Here, we have a unified mechanism that allows us to record any combination of dates and any kind of date input!

Use Cases

Case 1: Record One Date: Half-Day Leave Request Creation

This skill allows the user to create a leave request for up to one day. The period of leave is given in hours. In this scenario, we need to record one date from the user input.

https://www.skybuffer.com/leave-request-creation-half-day-leave/

Case 2: Record Period (Date From – Date To): Travel Request Creation

This AI skill enables SAP users to create a travel request for their coming trip. The chatbot will ask for necessary details such as dates, destination, expected travel expenses, etc. In this case, the bot requests the start and end dates of the trip.

https://www.skybuffer.com/travel-request-creation/

Case 3: Option to Decide – One or Two Dates: Educational Leave Creation

By educational leave, we mean time taken off for the purpose of self-studies and upgrading one’s qualification. The user can ask for a leave of one day or longer – our chatbot will always clarify this point.

https://www.skybuffer.com/leave-request-creation-educational-leave/

Case 4: Record Two (or More) Separate Dates: Supplier Invoice Creation

This functional skill allows the chat user to create a supplier’s invoice. Here, we need to record two independent dates: Date of the document and posting date.

https://www.skybuffer.com/create-supplier-invoice/

Topics:
chatbot ,artificial intelligence ,bot ,date and time tutorial ,conversational ai ,chatbot tutorial ,chatbot platform ,chatbot applications

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}