A simple integration that automatically enriches a Notion database of team members with their Val Town account information. When a new team member is added to your Notion database, this Val automatically fetches their Val Town profile data and populates the relevant fields.
├── main.tsx # Main Hono app with route mounting
├── routes/
│ ├── api.ts # API endpoints for manual user queries
│ └── tasks.ts # Webhook handler for Notion integration
├── controllers/
│ └── controllers.ts # Business logic for Notion and Val Town operations
└── README.md
/tasks - Notion webhook handler that enriches team member dataNote: these are not used in this demo but are included for demonstration purposes later.
/api/:username - Returns JSON data for a Val Town user/api/:username/html - Returns HTML-formatted user data/api - API information endpointSet the following environment variable in your Val Town settings:
NOTION_API_KEY=your_notion_integration_token
GLANCE_TEAM_DB_ID=your_database_id
Your Notion database should have the following properties:
| Property Name | Type | Description |
|---|---|---|
Username | Title | Val Town username (auto-populated) |
URL | URL | Val Town profile URL (can be input or auto-populated) |
Id | Rich Text | Val Town user ID (auto-populated) |
Bio | Rich Text | User bio from Val Town (auto-populated) |
https://your-val-url.web.val.run/tasks/tasksURL field (extracts from https://val.town/u/username)Username field directlyUsername field or paste their Val Town profile URL in the URL fieldThe integration fetches and stores the following data from Val Town:
The project uses:
When modifying the Notion database schema, ensure you update the setPage function in controllers/controllers.ts to match your new property structure.