Create schema-aware sample pages, read them back, and try common database filters with the Notion API.
Caution
Every run creates 10 pages in the first database the integration can access. The script does not ask you to choose a database. Share the integration with only a test database that you are comfortable modifying.
-
Duplicate the example database into your workspace.
-
Create a Notion integration in the integrations dashboard, then connect it only to the duplicated test database.
-
From the repository root, install and configure the example:
cd examples/generate-random-data npm install cp example.env .envSet your integration secret in
.env:NOTION_KEY=<your-notion-api-key>
-
Run it:
npm run ts-run
The script creates 10 pages with values matched to the database schema. It then reads the new pages, prints their properties, and runs example select and rich-text filters. Use the provided database template if you want the complete flow; a custom database needs both select and rich-text properties for the filter examples.
Running the command again creates 10 more pages. The script does not remove the sample data.