Notion Sync Setup Guide
1. Create Integration (Get Token)
- Go to https://www.notion.so/my-integrations .
- Click New integration.
- Name it (e.g., “Homelab Sync”).
- Select the workspace.
- Click Submit.
- Copy the “Internal Integration Secret”. This is your
NOTION_TOKEN.
2. Prepare Database
- Create a new Page in Notion.
- Type
/tableand select Table view -> New database. - Add/Rename columns to match exactly:
- Name (Type: Title) -> Stores Hostname
- IP Address (Type: Text)
- VMID (Type: Number)
- Status (Type: Select)
- Last Updated (Type: Date)
- Connect Integration:
- Click the
...menu at the top-right of the page. - Scroll to Connections.
- Search for and select your integration (“Homelab Sync”).
- If you don’t do this, the script cannot access the database!
- Click the
3. Configure Script (Column Mapping)
The script scripts/sync-to-notion.py has a COLUMN_MAPPING section at the top.
You MUST match these values to your actual Notion Database column names.
Default configuration:
If your columns are named differently (e.g., “Host IP” instead of “IP Address”), edit the script to match.
4. Get Database ID
- Open the database page in browser (or “Copy link to view”).
- The URL looks like:
https://www.notion.so/myworkspace/a8aec43384f447ed84390e8e42c2e089?v=... - The ID is the 32-character part between
/and?.- Example ID:
a8aec43384f447ed84390e8e42c2e089 - This is your
NOTION_DATABASE_ID.
- Example ID:
4. Run Manually (Test)
5. Jenkins Integration
Add this to your Jenkinsfile in the post { success { ... } } block:
(Note: You need to add notion-token and notion-db-id to Jenkins Credentials first)