Public
Like
1
book-lookup-notion
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: v27View latest version
This Val automatically enriches your Notion book database by fetching comprehensive metadata from Google Books API.
- Monitors Notion database for new entries with title and author
- Automatically fetches and populates:
- ISBN (ISBN-13 preferred, ISBN-10 as fallback)
- Year Published
- Page Count
- Publisher
- Uses Google Books API (no API key required)
- Handles multiple book matches intelligently
- Smart matching algorithm for best results
- Only updates empty fields (won't overwrite existing data)
- Go to https://www.notion.so/my-integrations
- Click "New integration"
- Give it a name like "Book Auto-Populator"
- Select your workspace
- Copy the "Internal Integration Token"
Your Notion database should have these properties:
- Title (Title type) - Required
- Author (Rich text) - Required
- ISBN (Rich text) - Will be populated
- Year Published (Number) - Will be populated
- Page Count (Number) - Will be populated
- Publisher (Rich text) - Will be populated
Optional properties (won't be modified):
- Rating, Progress, Start Date, Finish Date, Notes
- Open your book database in Notion
- Click the "Share" button (top right)
- Click "Invite" and search for your integration name
- Give it "Edit" permissions
- Open your database in Notion
- Copy the URL - it looks like:
https://notion.so/workspace/DATABASE_ID?v=... - The DATABASE_ID is the long string of letters/numbers between the last
/and?
In Val Town, set these environment variables:
NOTION_API_TOKEN: Your integration token from Step 1NOTION_DATABASE_ID: Your database ID from Step 4
Visit the HTTP endpoint to manually trigger processing:
- Main endpoint: Process all incomplete records
/status: Check configuration/help: View all available endpoints
The cron job (/cron-processor.ts) can run automatically:
- Set it to run daily or weekly in Val Town
- It will email you a summary of updates
- Only processes records missing metadata
GET /- Process all incomplete recordsGET /status- Check system configuration and statusGET /process/:recordId- Process a specific record by IDGET /health- Health checkGET /help- Usage instructions and setup guide
- Detection: Finds records with Title and Author but missing ISBN, Year, Pages, or Publisher
- Search: Queries Google Books API with title and author
- Matching: Uses smart algorithm to find best match
- Update: Only populates empty fields in Notion
- Reporting: Logs results and sends email summaries (cron mode)
/backend/index.ts- Main HTTP handler and API endpoints/backend/notion.ts- Notion API integration and database operations/backend/books.ts- Google Books API integration and search logic/backend/processor.ts- Main processing logic and orchestration/cron-processor.ts- Scheduled automatic processing with email reports
- Check
/statusendpoint to verify configuration - Ensure database properties have exact names and types
- Verify integration has access to your database
- Check Val Town logs for detailed error messages