The Date and Time Bot
A simple bot app which enables users to ask about the current date and time, calculate between dates, determine how many days until another date, etc.
The app is built using Angular on the front end, Express on the back end, and API.AI's API to process and understand natural language.
You will need:
- Node.js, and npm or Yarn
- API.AI account
You will also need Google Maps API key, as we'll use some of their APIs to get data related to locations and timezones, specifically:
- The Google Maps Geocoding API โ to get location related data
- The Google Time Zone API โ to get location's timezone data.
Once you've created your API.AI account go ahead and create your Agent. Then, in your created Agent, import the intents and entities used in this example.
You can start by cloning this repo:
git clone https://github.com/Tommyldunn/william.git
Create your .env
file which will contain your development environment and your API.AI and Google Maps API keys.
vim .env
Install server dependencies at the root of the directory, and start the Express app:
npm install # or yarn install
npm start # or yarn start
Install front end dependencies in the ./client
directory, and start the Angular app:
cd client
npm install # or yarn install
npm start # or yarn start, or ng serve
Open http://localhost:4200/ in your browser, you should be able to see the app running.
Live demo is available at https://william-the-bot.herokuapp.com/
You can start "talking" to the bot by typing your date and time related questions.
For example, some like the following date related ones:
- how many days between today and New Year
- is it the 21st of July in Korea
- what day of the week is it today in Skopje
- is it Friday tomorrow in Sydney
- what date is tomorrow
- do you know if it's July now
- how many minutes passed since the the year 2013
- how many days till November 23
- now it's 2014 year right
- I wonder which year are we in
Or, these time related:
- it's 5 o'clock in Berlin
- convert Moscow time in Denver
- what time is it in Mountain View
- find time difference Paris Tokyo
The bot also replies to small talk (I'm using API.AI built-in small talk module):
- Hey, how are you
- Who are you
- Good evening
- You are bad
- etc...