Calendar Assistant is a Google Calendar management service with natural language processing capabilities. The service aims to help clients track, manage and optimize scheduling for both existing and upcoming events on their calendars. Enhanced with dialog ability, this service will not only support regular parameterized requests but also conversational prompts such as “Find an open slot on my calendar for a 30-min coffee chat with Ben this week.” The data store will be for user profiles, authentication tokens (required to access Google Calendar, OpenAI API, etc.), chat histories, and user feedback, all subject to user consent.
Check out our calendar assistant chatbot app, which uses this API under the hood, here
To use our service, please make sure that you have obtained the following credentials:
- Google Cloud Project’s client ID
- Google Cloud Project’s client secret
- OpenAI API key
To obtain the first two items, please visit this site. Make sure to choose a web app and note down your credentials.
Next, go to APIs & Services -> Credentials, find the app you just created, add http://localhost:8080/oauth2callback to its "Authorized redirect URIs." This would allow our /authenticate API endpoint to redirect you correctly.
To obtain the OpenAI key, please visit this site. Note that you need to have remaining credit on your account.
For more information on how to use our API, please see the following:
If you’re a developer who’s interested in running our code locally, feel free to download or clone our source code. Go to your terminal (and make sure that you're in the right directory) and enter the following commands:
cd calendar-assistant
npm install
To avoid exposing secrets, we recommend creating a .env file using our .env.example:
cp .env.example .env
Then, fill in the fields in your .env file.
Start Postgres service and run the following:
- Connect to the database:
psql -U your_username -d your_database - Run our schema file:
\i src/database/schema.sql - Check records in our two tables:
SELECT * FROM users;SELECT * FROM events; - To quit Postgres:
\q
Additional notes:
- You only need to run
\i src/database/schema.sqlonce unless there's an update in your schema. - If you make any changes to the schema, you may encounter a drop error when running this script. Please make sure to drop tables in the reverse order of key dependencies (i.e., If A depends on B, drop A first before dropping B). Do so by running:
DROP TABLE {TableA};. - Read more on PostgreSQL and SQL commands.
npm run server-dev
The server should be running on http://localhost:3000.
For our server, database, and testing setup, Calendar Assistant primarily uses:
- express
- express-validator
- eslint
- googleapis
- husky
- jest
- pg
- prettier
# To run all tests
npm test
# To run with coverage
npx jest --coverage
# To run individual test suites
npx jest [testName].test.js
Run npx jest --coverage or check out coverage results in the coverage folder. We aim to a high coverage for all our code, but the auth.js file is currently not covered due to the complexity of the testing Google OAuth2. We will work on this in the future.
After you have started the server, you can go to our Postman test link here to test our API endpoints.