{"id":20020122,"url":"https://github.com/wonism/get-notion-contents","last_synced_at":"2025-05-04T23:32:41.705Z","repository":{"id":39917432,"uuid":"228208578","full_name":"wonism/get-notion-contents","owner":"wonism","description":"Get contents from notion","archived":false,"fork":false,"pushed_at":"2022-06-25T09:42:15.000Z","size":511,"stargazers_count":10,"open_issues_count":7,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-14T06:52:18.338Z","etag":null,"topics":["notion","notion-contents"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wonism.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-15T15:42:14.000Z","updated_at":"2023-10-16T16:57:30.000Z","dependencies_parsed_at":"2022-09-26T16:21:05.818Z","dependency_job_id":null,"html_url":"https://github.com/wonism/get-notion-contents","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wonism%2Fget-notion-contents","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wonism%2Fget-notion-contents/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wonism%2Fget-notion-contents/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wonism%2Fget-notion-contents/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wonism","download_url":"https://codeload.github.com/wonism/get-notion-contents/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224417745,"owners_count":17307673,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["notion","notion-contents"],"created_at":"2024-11-13T08:29:57.715Z","updated_at":"2024-11-13T08:29:58.431Z","avatar_url":"https://github.com/wonism.png","language":"TypeScript","funding_links":["https://www.buymeacoffee.com/dQ3sAxl"],"categories":[],"sub_categories":[],"readme":"# get-notion-contents\n\u003e Get contents from notion\n\n[![NPM](https://img.shields.io/npm/v/get-notion-contents.svg?style=flat)](https://npmjs.org/package/get-notion-contents)\n[![Build Status](https://travis-ci.org/wonism/get-notion-contents.svg?branch=master)](https://travis-ci.org/wonism/get-notion-contents)\n![npm bundle size (minified)](https://img.shields.io/bundlephobia/min/get-notion-contents.svg)\n\n## Installation\n```sh\n$ npm i -S get-notion-contents\n```\n\n## ⚠️ Prerequisite\nYou need a token to use this package if you want to get private contents.\nYou can get it from [Notion.so](https://www.notion.so/) cookie. the key of it is `token_v2`.\n\n## Development\n```sh\n$ export NOTION_TOKEN=\"\u003c\u003cYOUR_NOTION_TOKEN\u003e\u003e\"\n$ npm start\n```\n\n## Return type of methods\n\n#### getUser()\n```ts\nPromise\u003c{\n  email: string;\n  family_name: string;\n  given_name: string;\n  id: string;\n  onboarding_completed: boolean;\n  profile_photo: string;\n  version: number;\n}\u003e\n```\n\n#### getPageIds(skipChildren: boolean = false)\n```ts\nPromise\u003cstring[]\u003e\n```\n\n#### getPageById(id: string)\n```ts\nPromise\u003c{\n  id: string;\n  title: string;\n  titleString: string;\n  content: string;\n  resource?: string;\n}\u003e\n```\n\n#### getPages()\n```ts\nPromise\u003cArray\u003c{\n  id: string;\n  title: string;\n  titleString: string;\n  content: string;\n  resource?: string;\n}\u003e\u003e\n```\n\n## How to use\n```ts\nimport Notion from 'get-notion-contents';\n\n// create instance of Notion.\nconst notion = new Notion('\u003c\u003cYOUR_NOTION_TOKEN\u003e\u003e', { prefix: '\u003c\u003cPREFIX_OF_LINK\u003e\u003e', removeStyle: false });\n\n(async () =\u003e {\n  // get user information\n  const user = await notion.getUser();\n  console.log(user);\n\n  // get ids of all pages\n  const pageIds = await notion.getPageIds();\n  console.log(pageIds);\n\n  // get content of a page\n  const page = await notion.getPageById(pageIds[0]);\n  console.log(page);\n\n  // get contents of all pages\n  const pages = await notion.getPages();\n  console.log(pages);\n})();\n```\n\n#### Option\n- prefix: add prefix into relative links\n- removeStyle: remove inline styles\n\n---\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.buymeacoffee.com/dQ3sAxl\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://cdn.buymeacoffee.com/buttons/default-orange.png\" alt=\"Buy Me A Coffee\" width=\"217\" height=\"51\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwonism%2Fget-notion-contents","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwonism%2Fget-notion-contents","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwonism%2Fget-notion-contents/lists"}