Data is expensive

I write around 2-3 important notes a day. And don’t actually worry if my laptop will be stolen, but the data on it..

Since Im heavy notion user I was looking for automated backup solution. Not that I don’t trust notion, trust but verify, right?

Backup

  1. Create a private github repo

create private repo

  1. Go to actions tab and click on set up a workflow yourself ->

set up workflow

  1. Paste this yml file
name: "Notion backup"

on:
  push:
    branches:
      - main
  schedule:
    -   cron: "0 0 * * *"

jobs:
  backup:
    runs-on: ubuntu-latest
    name: Backup
    timeout-minutes: 15
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
        with:
          node-version: '12'
      - name: Setup dependencies
        run: npm install -g notion-backup

      - name: Run backup
        run: notion-backup
        env:
          NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }}
          NOTION_SPACE_ID: ${{ secrets.NOTION_SPACE_ID }}

      - name: Commit changes
        uses: elstudio/actions-js-build/commit@v3
        with:
          commitMessage: Automated snapshot
  1. Get your secrets

    1. Go to www.notion.so
    2. Go to Settings & Members
    3. Go to Workspace -> Settings
    4. Open inspector in your browser and navigate to network tab (set XHR filter)
    5. Click on Export all workspace content
    6. Open any getTasks request
    7. Extract spaceId from preview and token_v2 from headers

notion space id notion token v2

  1. Add secrete keys

where NOTION_SPACE_ID is your spaceId from step above

and NOTION_TOKEN is your token_v2 from step above

add secrete keys

Here we go

Now you have fully automated backup of your entire notion workspace in private github repo.