Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rudifa/notion-api-example
Learning Notion API access
https://github.com/rudifa/notion-api-example
Last synced: 24 days ago
JSON representation
Learning Notion API access
- Host: GitHub
- URL: https://github.com/rudifa/notion-api-example
- Owner: rudifa
- Created: 2023-04-21T18:54:40.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-04-22T17:48:54.000Z (over 1 year ago)
- Last Synced: 2024-10-06T01:41:24.522Z (about 1 month ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Notion API access
Demo based on [Getting started with the Notion API JavaScript SDK](https://dev.to/craigaholliday/getting-started-with-the-notion-api-javascript-sdk-c50)
Uses `@notionhq/client`.
## Notion setup
In the target Notion workspace - Settings - Connections - Develop and manage integrations:
- create a new Integration, give it a name
- copy the `Internal Integration Token` to the local file .envIn the target Notion workspace - target page:
- ... menu - Connections: add a connection to the named Integration
- Share - Copy link: copy the url link and paste into a text editor
- extract the first 32-character `UUID` and pste it into the local .env file## Setup
Requires a file named `.env` in the project directory, containing the keys from Notion
```
NOTION_API_KEY=secret_n3w...iZWq # 56 chars `Internal Integration Token`
NOTION_API_DATABASE=ef7...b44 # 32 chars `UUID`
```## Run
```
npm start
```Prints the received json to the stdout console.
## Notes
This script uses `@notionhq/client`.
## Issues
The retrieved JSON data contains some `[Object]` items.
```
description: [
{
type: 'text',
text: [Object],
annotations: [Object],
```Open question: is this generated by the Notion API, or by processing in the `@notionhq/client`?
A similar go program retrieves valid JSON from the same API.