DEV Community

Vidyasagar SC Machupalli
Vidyasagar SC Machupalli

Posted on • Edited on

Adding business hours to your chatbot

Stackoverflow is the best place to find use cases along with numerous questions. One such question that hit my radar was

How do I make my Chatbot to ONLY answer from 6 pm to 8 am - IBM Watson

or

Adding business hours to a chatbot

This is part of my shortposts (quick and short answers). For in-depth understanding, please check the Check section below.

The question was IBM Watson Assistant specific.

Challenge

I accepted the challenge and here's what I came up with

  1. Create a top node called input and under If assistant recognizes
  2. Add now().before('18:00:00') and now().after('8:00:00') as shown in the image below - Time is in 24 hour format
  3. Assistant responds --> Text --> We are open only between 6 PM and 8 AM every day
  4. Then assistant should --> Skip user input
    Alt Text

  5. Add another node called welcome and under welcome

  6. Assistant responds --> Text --> Welcome, how can I help?

Alt Text

Check the Expression language documentation to understand more about the use of now()

Once done, click Try it to see the chatbot to respond only between the times mentioned

Link to the Stackoverflow questions

Check

Top comments (0)