notion_weekly_report
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v12View latest version
This repo contains a Val Town-ready script that:
- queries a Notion database for the last 7 days of blood sugar entries
- computes simple stats (avg/min/max, count, missing entries)
- emails a weekly rollup
Create a new database in Notion (table view is easiest) with these properties:
- Entry (Title)
- Created Time (Text) (e.g.,
January 13, 2026 2:29 PM) - Measurement Date (Date) (e.g.,
January 13, 2026) - Blood Sugar Level (Number)
- Notes (Text) (optional)
You can name the database anything (e.g., "Blood Sugar Log").
- Go to https://www.notion.so/my-integrations and create a new integration.
- Copy the Internal Integration Token.
- Open your database in Notion, click Share, and invite the integration.
Open the database in the browser and copy the 32‑character ID in the URL.
Create a new Val in Val Town and paste notion_weekly_report.ts.
Add these secrets in Val Town (Settings → Secrets):
NOTION_TOKENNOTION_DATABASE_IDREPORT_FROM_EMAIL(optional, must beyour_username.valname@valtown.email)REPORT_FROM_NAME(optional)REPORT_REPLY_TO(optional)
Free tier note: REPORT_TO is optional. If omitted, Val Town emails the account owner.
In Val Town, schedule the Val to run weekly at 9:30am on Tuesdays (EST).
Suggested cron (set Val Town timezone to EST):
30 9 * * 2
- Adjust the stats, date range, or email formatting in
notion_weekly_report.ts. - If you prefer different property names, update them in the script.
