Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

get-notion-contents

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-notion-contents

Get contents from notion

  • 2.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-84.21%
Maintainers
1
Weekly downloads
 
Created
Source

get-notion-contents

Get contents from notion

NPM Build Status npm bundle size (minified)

Installation

$ npm i -S get-notion-contents

⚠️ 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

Return type of methods

getUser()
Promise<{
  email: string;
  family_name: string;
  given_name: string;
  id: string;
  onboarding_completed: boolean;
  profile_photo: string;
  version: number;
}>
getPageIds()
Promise<string[]>
getPageById(id: string)
Promise<{
  title: string;
  content: string;
  resource?: string;
}>
getPages()
Promise<Array<{
  title: string;
  content: string;
  resource?: string;
}>>

How to use

import Notion from 'get-notion-contents';

// 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);
})();

Buy Me A Coffee

Keywords

FAQs

Package last updated on 27 Dec 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc