Sync Obsidian notes to Notion via GitHub
Project description
A tool to sync Obsidian notes to Notion via GitHub ๐จโ๐ป...
Report a Bug/Issue | Request a Feature | View Project Status
Obsidian Notion Sync
๐ฉ Installation
pip install obsidian-notion-sync
๐ Usage
Basic sync:
obsidian-notion-sync
Enable debug logging:
obsidian-notion-sync --debug
View help:
obsidian-notion-sync --help
๐๏ธ How does it work ?
This is how the pipeline's overview looks like:
๐ฏ Detailed workflow
Step 1 : Takes up file all the files from your obsidian vault.
Uses the vault path given in the env variable
Step 2 : Upon the running of the command, it copies the value at the place of invocation
Choose a place of invocation and it creates a directory named 'ObsidianClonedVault'.
Step 3 : It then syncs this folder with a Github Repo
You can supply the name for an existing repo or it would create a new one with the given name in the env variable.
Step 4 : Once the syncing is completed, it triggers a Github action that uploads these files to notion via Notion APIs.
A Github workflow runs in the Github action space. You will get a mail if it fails for some reason. Check the logs for more debugging on that front.
Step 5 : Voila ! You can now access your notes on Notion too !
If everything goes well, it will update your notion page specified in the env variable.
๐ ๏ธ Configuration
Before using the tool, you need to set up the following environment variables:
Variable | Description | Example |
---|---|---|
GITHUB_TOKEN | Your GitHub personal access token | ghp_1234... |
NOTION_TOKEN | Your Notion integration token | secret_5678... |
OBSIDIAN_DIR | Path to your Obsidian vault | /Users/you/ObsidianVault |
REPO_NAME | Name for the GitHub repository | My-Second-Brain |
NOTION_PAGE_ID | ID of your Notion page | abc123... |
๐ช Setting up tokens
-
GitHub Token:
- Go to GitHub Settings โ Developer Settings โ Personal Access Tokens
- Create a new token with 'repo' permissions
-
Notion Token: (more details below on its access)
- Go to www.notion.so/my-integrations
- Create a new integration
- Copy the integration token
-
Notion page ID: (more details below on its access)
- Create a new page in Notion
- Copy the page ID from the URL (it's the part after the page name and after the last '-')
๐ Example Configuration Script
You can create a shell script to set up your environment:
#!/bin/bash
export GITHUB_TOKEN="your_github_token"
export NOTION_TOKEN="your_notion_token"
export OBSIDIAN_DIR="/path/to/your/obsidian/vault"
export REPO_NAME="your-repo-name"
export NOTION_PAGE_ID="your_page_id"
obsidian-notion-sync --debug
Save this as run-sync.sh
, make it executable (chmod +x run-sync.sh
), and run it with ./run-sync.sh
.
๐ Setting up your notion page
(Skip this section if you were able to set the notion api tokens and page access )
Step 1 : Create a notion page for storing your Obsidian Vault
The red box highlighted is the Page Id - it is a 32 sized alphanumeric unique ID for the page which starts after the name of your page.
Step 2 : Go to https://www.notion.so/profile/integrations
You can open it from the settings in your notion app as well.
Step 3 : Create an integration
You can use the API tokens of an existing integration as well. Make sure it has the permission to read + write content.
Step 4 : Copy this token
Set this token as your environment variable as mentioned above.
Step 5 : Allow your notion page to gain access
It will not have access to this connection by default.
๐ฅ๏ธ Troubleshooting
If you encounter errors:
-
Check that all environment variables are set correctly:
echo $GITHUB_TOKEN echo $NOTION_TOKEN echo $OBSIDIAN_DIR echo $REPO_NAME echo $NOTION_PAGE_ID
-
Ensure your Obsidian vault path exists and is accessible
-
Verify that your GitHub token has the necessary permissions
-
Check that your Notion integration is properly configured and has access to the page
๐งโ๐งโ๐งโ๐ง Support
If you encounter any issues, please file them on our GitHub repository's issue tracker.
๐งโ๐ป๐ฉโ๐ป Contribution
The agenda is to make this package as the easy and smooth package (with lesser bugs ;) for syncing a multitude for note taking applications but firstly achieve a robust two way sync between notion and obsidian.
Please refer to the for more details. (TBD with more implementation and design considerations)
๐ Directory structure of the project:
# obsidian_notion_sync/
# โโโ .github/
# โ โโโ workflows/
# โ โโโ sync.yml
# โโโ src/
# โ โโโ obsidian_notion_sync/
# โ โโโ __init__.py
# โ โโโ __about__.py
# โ โโโ _version.py
# โ โโโ cli.py
# โ โโโ config.py
# โ โโโ sync.py
# โ โโโ sync_to_notion.py
# โ โโโ exceptions.py
# โโโ tests/
# โ โโโ __init__.py
# โโโ .gitignore
# โโโ LICENSE
# โโโ README.md
# โโโ pyproject.toml
License
obisidian-notion-sync
is distributed under the terms of the MIT license.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file obsidian_notion_sync-0.3.tar.gz
.
File metadata
- Download URL: obsidian_notion_sync-0.3.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dcdc2f6457b8abbcb361a1f2c288e0c8f373d5c6b13617380e853c1636df19d2 |
|
MD5 | fbb32134a314cdd91e9de79da6d7f84c |
|
BLAKE2b-256 | 578f53da6b7a84ec0c26f95d6549a90e4ab172a3e48cffda90404a72221f8b4e |
File details
Details for the file obsidian_notion_sync-0.3-py3-none-any.whl
.
File metadata
- Download URL: obsidian_notion_sync-0.3-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b4ab43e2f00aae777b6f65f4b504bd638f128519bcc13c1b95ae613c8d7445c |
|
MD5 | 7977326ceb288cb944d277c8f212bc77 |
|
BLAKE2b-256 | 95ea10653f7835b173e58def10d1de5a72f7b01db92769381f90249643cacf00 |