1.0.0 • Published 4 years ago

fetch-notion v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

Fetch Notion

Get data from notion

NPM Build Status npm bundle size (minified)

Installation

$ npm i -S fetch-notion

⚠️ Prerequisite

You need a token to use this package. You can get it from Notion.so cookie. the key of it is token_v2.

Development

$ export NOTION_TOKEN="<<YOUR_NOTION_TOKEN>>"
$ npm start

How to use

import Notion from 'fetch-notion';

// create instance of Notion.
const notion = new Notion('<<YOUR_NOTION_TOKEN>>');

(async () => {
  // get user information
  const user = await notion.getUser();
  console.log(user);

  // get ids of all pages
  const pageIds = await notion.getPageIds();
  console.log(pageIds);

  // get content of a page
  const page = await notion.getPageById(pageIds[0]);
  console.log(page);

  // get contents of all pages
  const pages = await notion.getPages();
  console.log(pages);
})();

1.0.0

4 years ago