Skip to content

Backs up Notion workspace to repo to be used for Obsidian KB/KMS. Also gets rid of page IDs and cleans up links.

License

Notifications You must be signed in to change notification settings

cybersader/notion-to-obsidian-github-sync

Repository files navigation

Notion-to-obsidian

  • This is a fork of the notion-guardian repo with some extended functionality for automating structuring for an obsidian vault. This can be used with obsidian-git and/or git + obsidian use to sync Notion to GitHub.

A tool that automatically backups your Notion workspace and commits changes to another repository private or public for the purpose of putting Notion into an Obsidian vault.

Notion Guardian offers a quick way to setup a secure backup of your data in a private repository — allowing you to track how your notes change over time and to know that your data is safe.

The tool separates the logic for running the export and the actual workspace data into two repositories. This way your backups are not cluttered with other scripts. If you prefer to have a one-repo solution or want to backup specific blocks of your workspace, checkout the notion-backup fork by upleveled.

How to setup

  • For the NOTION_TOKEN and NOTION_USER_ID, make sure to use the non-desktop version of Notion.so and use Ctrl-Shift-I to get to developer options
  1. Create a separate private repository for your backups to live in (e.g. "my-notion-backup"). Make sure you create a main branch — for example by clicking "Add a README file" when creating the repo.
  2. Use this repository ("notion-guardian") as a template in order to create a copy (Click the green "Use this template" button).
  3. Create a Personal Access Token (docs) with the "repo" scope and store it as REPO_PERSONAL_ACCESS_TOKEN in the secrets of the copied repo.
  4. Store your GitHub username in the REPO_USERNAME secret.
  5. Store the name of your newly created private repo in the REPO_NAME secret (in this case "my-notion-backup").
  6. Store the email that should be used to commit changes (usually your GitHub account email) in the REPO_EMAIL secret.
  7. Obtain your Notion space-id and token as described in this Medium post. Store it in the NOTION_SPACE_ID and NOTION_TOKEN secret.
  8. You will also need to obtain your notion_user_id the same way and store it in a NOTION_USER_ID secret.
  9. Wait until the action runs for the first time or push a commit to the repo to trigger the first backup.
  10. Check your private repo to see that an automatic commit with your Notion workspace data has been made. Done 🙌

How it works

This repo contains a GitHub workflow that runs every day and for every push to this repo. The workflow will execute the script which makes an export request to Notion, waits for it to finish and downloads the workspace content to a temporary directory. The workflow will then commit this directory to the repository configured in the repo secrets.

Contributions

Todos -- Contributors?? 😄

  • Fix issues with binary files
  • More options and easier configuration
    • Choose whether to do renaming or not
    • Other integration options
  • Taxonomy generation fixes (adjustNotionPages function)
  • Work with Notion HTML-based export rather than markdown and CSVs
  • Utilize importer plugin from Obsidian plugins somehow
  • Scripts for local Linux testing
  • GitHub action from Obsidian-to-notion side that runs Notion-API based workflow to sync in the other direction
    • Mapping file for Page ID to page to help with Obsidian-to-Notion pushes

How to locally test software (Windows)

TODO

About

Backs up Notion workspace to repo to be used for Obsidian KB/KMS. Also gets rid of page IDs and cleans up links.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published