Automatically syncs events from a Notion database to Google Calendar, including details like course, title, status, task, weightage, scores, and notes.
- Syncs Notion database entries to Google Calendar events
- Automatically updates existing events when Notion entries change
- Preserves all metadata including scores, weightage, and notes
- Runs on a schedule or can be triggered manually
- Create a Notion integration at https://www.notion.so/my-integrations
- Copy your integration secret (this will be your
NOTION_KEY
) - Share your Notion database with the integration
- Copy your database ID from the URL (this will be your
DATABASE_ID
)- The ID is the part of the URL after the workspace name and before the query parameters
- Example:
https://notion.so/workspace/1234567890abcdef1234567890abcdef
- In this case,
1234567890abcdef1234567890abcdef
is your database ID
- Go to the Google Cloud Console: https://console.cloud.google.com
- Create a new project or select an existing one
- Enable the Google Calendar API
- Go to Credentials and create OAuth 2.0 Client credentials
- Set up the OAuth consent screen if needed
- Add the required scopes for Google Calendar
- Download the client credentials
OAUTH_CLIENTID
andOAUTH_SECRET
will be in this file
- Get your
REFRESH_TOKEN
using Google OAuth 2.0 Playground:- Go to https://developers.google.com/oauthplayground/
- Click ⚙️ (Settings) in the top right
- Check "Use your own OAuth credentials"
- Enter your OAuth Client ID and Secret
- Close settings
- On the left, find or search for:
https://www.googleapis.com/auth/calendar
https://www.googleapis.com/auth/calendar.events
- Select both scopes
- Click "Authorize APIs" and sign in
- Click "Exchange authorization code for tokens"
- Copy the "Refresh token" value
- Copy
.env.example
to.env
:cp .env.example .env
- Fill in your credentials in
.env
:OAUTH_CLIENTID
: Your Google OAuth Client IDOAUTH_SECRET
: Your Google OAuth Client SecretREFRESH_TOKEN
: Your Google OAuth Refresh Token (obtained from OAuth Playground)NOTION_KEY
: Your Notion Integration SecretDATABASE_ID
: Your Notion Database IDTZ
: Your timezone (default: Canada/Eastern)
Bun has built-in support for loading environment variables from your .env
file, so you do not need to use dotenv
when running with Bun.
# Install dependencies
bun install
# Start the sync process
bun run start
# Development mode with hot reload
bun run dev
After running bun install
, Bun will generate a bun.lockb
file for reproducible installs. You should commit this file to version control.
# Install dependencies
npm install
# Start the sync process
npm start
Your Notion database should have the following properties:
Name
(Title): Event titleCourse
(Select): Course nameDates
(Date): Event date/timeTask
(Multi-select): Task typeWeight
(Number): Score weightWeightage
(Number): Total possible weightScored
(Number): Actual scoreStatus
(Checkbox): Completion statusNotes
(Text): Additional notes (optional)
MIT