This Val automatically enriches a dedicated Book Metadata database by fetching comprehensive data from Google Books API, which can then be linked to your main reading database.
This system uses two separate databases for clean organization:
- Your Books Database - For reading tracking (Rating, Progress, Start/Finish dates, etc.)
- Book Metadata Database - Automatically managed by this Val with rich book data
- Automatically fetches comprehensive book metadata:
- Core Data: ISBN, Year Published, Page Count, Publisher
- Rich Metadata: Subtitle, Description, Categories, Ratings
- Links: Preview links, info links, cover images
- Details: Language, exact publication date
- Uses Google Books API (no API key required)
- Smart matching algorithm for accurate results
- Only processes unprocessed records (won't duplicate work)
- Stores all metadata for future use
- Go to https://www.notion.so/my-integrations
- Click "New integration"
- Give it a name like "Book Metadata Fetcher"
- Select your workspace
- Copy the "Internal Integration Token"
Create a new database with these exact property names and types:
- Title (Title) - Book title
- Author (Rich text) - Book author
- Processed (Checkbox) - Tracking field (defaults to unchecked)
- ISBN (Rich text) - ISBN number
- Year Published (Number) - Publication year
- Page Count (Number) - Number of pages
- Publisher (Rich text) - Publisher name
- Subtitle (Rich text) - Book subtitle
- Description (Rich text) - Book description
- Categories (Multi-select) - Book categories/genres
- Average Rating (Number) - Google Books rating
- Ratings Count (Number) - Number of ratings
- Language (Rich text) - Book language
- Published Date (Rich text) - Full publication date
- Preview Link (URL) - Google Books preview
- Info Link (URL) - Google Books info page
- Image Links (Rich text) - Cover image URLs (JSON)
- Open your Book Metadata database
- Click "Share" → "Invite"
- Search for your integration name
- Give it "Edit" permissions
- Open your Book Metadata database
- Copy the URL:
https://notion.so/workspace/DATABASE_ID?v=... - Extract the DATABASE_ID (the long string between
/and?)
In Val Town, set:
NOTION_API_TOKEN: Your integration tokenNOTION_DATABASE_ID: Your Book Metadata database ID
To connect this to your main Books database:
-
Add Relation Property to your main Books database:
- Property name: "Metadata"
- Type: Relation
- Related database: Your Book Metadata database
-
Add Rollup Properties to show metadata in your main database:
- ISBN: Rollup → Metadata → ISBN
- Year: Rollup → Metadata → Year Published
- Pages: Rollup → Metadata → Page Count
- Publisher: Rollup → Metadata → Publisher
- Add book to Book Metadata database → Enter Title + Author only
- Run this Val to fetch metadata
- Optionally link to your main Books database
- Add book to your main Books database
- Create linked record in Book Metadata database
- Run this Val to populate metadata
- Metadata appears in main database via rollups
Set up Notion automation:
- Trigger: When Books database record is created
- Action: Create linked record in Book Metadata database
- Result: Val automatically processes new entries
GET /- Process all unprocessed recordsGET /status- Check system configurationGET /process/:recordId- Process specific recordGET /health- Health checkGET /help- Usage instructions
Visit the HTTP endpoint to process pending records:
https://your-val-url.web.val.run/
The cron job (/cron-processor.ts) can run on schedule:
- Set it to run daily/weekly in Val Town
- Emails you a summary of updates
- Only processes new/unprocessed records
/backend/index.ts- Main HTTP handler and API endpoints/backend/notion.ts- Notion API integration for Book Metadata database/backend/books.ts- Google Books API integration with comprehensive metadata/backend/processor.ts- Processing logic and orchestration/cron-processor.ts- Scheduled processing with email reports
✅ Clean Separation: Reading data vs. metadata
✅ Rich Data: Store comprehensive book information
✅ Flexible: Add more metadata fields without cluttering main database
✅ Scalable: Process hundreds of books efficiently
✅ Reusable: Same metadata can link to multiple reading entries
✅ Future-Proof: All Google Books data available for new features
- Check
/statusendpoint to verify configuration - Ensure database properties have exact names and types
- Verify integration has access to Book Metadata database
- Check Val Town logs for detailed error messages
- Make sure "Processed" checkbox exists and defaults to unchecked