Notion API
- The Notion API is documented here: https://developers.notion.com/docs.
- I have mainly used the Javascript API: https://github.com/makenotion/notion-sdk-js
Terms
Databases are made up of pages and pages have properties.
Getting Started
Create a Table in Notion to hold your data. Add properties you will need.
Create an integration in notion and copy the secret token for your integration. You’ll need this later to access Notion with our script.
Share the table you created with your Integration. It should show up below the list of users when you select Share.
While you’re there, copy the database ID, we’ll need that later. It is the string following the last
/
character and before the?
characterTo use the Notion API in JS you will need to initialize it like so:
const { Client } = require("@notionhq/client");
// Initializing a client
const notion = new Client({
auth: process.env.NOTION_TOKEN,
});
Functions
notion.databases.query({database_id: DATABASE_ID, filter: {}})
notion.pages.create({parent: {database_id: DATABASE_ID}, properties: {}})