Public
Like
1
Notion_GCal_Sync
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in miliseconds.
This val:
- Checks my Google Calendar every morning for upcoming user meetings
- Identifies meetings with external users (non-@val.town email addresses)
- Creates a meeting prep page in Notion for each user meeting
- Gathers information about the meeting participant and populates the Notion page
- Create a Google Cloud project at https://console.cloud.google.com/
- Enable the Google Calendar API
- Create OAuth2 credentials (client ID and client secret)
- Set up OAuth consent screen
- Use the OAuth playground (https://developers.google.com/oauthplayground/) to:
- Authorize the Calendar API (https://www.googleapis.com/auth/calendar.readonly)
- Exchange authorization code for tokens
- Save the refresh token
- Create a Notion integration at https://www.notion.so/my-integrations
- Get your Notion API key
- Create a database in Notion for meeting pages with these properties:
- Title (title)
- Meeting Date (date)
- Attendee (rich text)
- Email (email)
- Share your database with the integration
- Get the database ID from the URL (the part after the workspace name and before the question mark)
- Sign up for a SERP API account at https://serpapi.com/
- Get your API key
- Add it as an environment variable
Set the following environment variables in Val Town:
GOOGLE_CLIENT_ID
: Your Google OAuth client IDGOOGLE_CLIENT_SECRET
: Your Google OAuth client secretGOOGLE_REFRESH_TOKEN
: Refresh token for your Google accountNOTION_API_KEY
: Your Notion API keyNOTION_DATABASE_ID
: ID of the Notion database where meeting pages will be createdTEAM_DOMAIN
: Your team's email domain (e.g., "val.town")SERP_API_KEY
: Your SERP API key for enhanced user information
After deploying, set the cron schedule in the Val Town web UI to run every morning (e.g., "0 7 * * *" for 7 AM daily).
index.ts
: Main cron job that runs dailygoogleCalendar.ts
: Functions for interacting with Google Calendar APInotion.ts
: Functions for creating and updating Notion pagesuserInfo.ts
: Functions for gathering information about meeting participants
- The cron job runs every morning
- It fetches your calendar events for the day
- It identifies meetings with exactly one external participant (not from your team domain)
- For each user meeting, it:
- Gathers information about the participant using their email and SERP API
- Creates a Notion page with meeting details and participant information
- Adds sections for meeting notes and action items