Updated on February 19, 2023

Extract date and time from dialogflow

In this blog, we can see how to extract the date and time in a Dialogflow and personalize the responses.

Extracting the date, time, and personalize the responses are very much needed for the meeting booking bots to schedule events, restaurant bots, and reservation booking bots, etc. which would increase user engagement.

Entities

Dialogflow entities extract a keyword from a training phrase in the intent. The value is an action parameter. It is not necessary to create entities for every word in the sentence.

Dialogflow has pre-built entities called system entities. To know more about the entities, refer to this video.

Dialogflow provides many system entities to extract common keywords from user phrases. For example, the @sys.email type is used to extract values related to an email address like “kevin@gmail.com“. @sys.color type can be used to extract values like “red”, “blue”, “orange”, etc.

You can see the full list of system entities here.

System entities related to date & time

@sys.date – Matches a date

@sys.time – Matches a time

@sys.date-period – Matches a date interval

@sys.time-period – Matches a time interval

@sys.date-time – Matches date, time, intervals or date and time together

Add training phrases

We can see an example to extract data and time in a meeting booking bot and personalize the responses.

  • Create an Intent, for example – Meeting Booking Bot – Schedule Meeting
  • In the Training phrases section of the intent, add the training phrases as mentioned below
training phrases

You could see the date and time highlighted. This means that the entity is mapped correctly. If you don’t see them highlighted, simply drag and select the date, time with the cursor and a list of entities will pop. Select the corresponding entity like @sys.date, @sys.time.

Action and parameters

After the entities are mapped in the training phrase section. In the Action and parameters section of the intent, the system entities @sys.date, @sys.time, and @sys.date-time have appeared.

Action parameters

Slot filling

The intent should match with phrases like date and time to handle the task of scheduling an appointment. However, if these phrases lack the date information or both then it will be tough because the intent cannot schedule an appointment without the time and date information.

Dialogflow provides a slot-filling feature; In which intent is matched, then the chatbot collects information from the user until the user has provided data for each of the required parameters.

  • REQUIRED: If this box is ticked, The intent can’t complete without the corresponding parameter
  • PROMPTS: Type of questions that the chatbot will ask your users if a request doesn’t contain this parameter.

To make the parameters $time and $date required, provide prompt questions for the parameters. The placement in the table determines the order the prompt questions. In our example, the $date parameter is above the $time parameter. If you want to change the order, drag up the parameter.

For the date parameter, the prompt is as follows:

Prompts for date

For the time parameter, the prompt is as follows

Prompts for time

Personalize the response

Now the chatbot can show the user, the booked appointment on the date and time mentioned by the user. So we need to personalize the response by adding a $date and $time parameter to the response as mentioned in the below example.

Response messages

Try out

Make sure to obtain the date and time information once a user indicates the need for making an appointment. Now, the chatbot should be able to collect the required details for scheduling the meeting and inform the user about the scheduled date and time.

To integrate Dialogflow with Kommunicate, signup, and follow this doc.

Meeting Booking Bot

You can get the meeting booking bot from here. Thank you!

Suggested Read: How to Extract Names in Dialogflow Chatbots

Here’s a quick video:


At Kommunicate, we are envisioning a world-beating customer support solution to empower the new era of customer support. We would love to have you on board to have a first-hand experience of Kommunicate. You can signup here and start delighting your customers right away.

Write A Comment

Close

Devashish Mamgain

I hope you enjoyed reading this blog post.

If you want the Kommunicate team to help you automate your customer support, just book a demo.

Book a Demo

You’ve unlocked 30 days for $0
Kommunicate Offer

Upcoming Webinar: Conversational AI in Fintech with Srinivas Reddy, Co-founder & CTO of TaxBuddy.

X