# @ryanforever/notion

> notion API

Latest version **0.3.0** (published 2022-09-09) · ISC license · 0 weekly downloads

## Install

```sh
npm install @ryanforever/notion
pnpm add @ryanforever/notion
yarn add @ryanforever/notion
bun add @ryanforever/notion
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2022-09-09 |
| First published | 2022-05-07 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 26.6 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| Author | ryan forever |
| Maintainers | ryanforever |
| Keywords | notion |

## Links

- npm: https://www.npmjs.com/package/@ryanforever/notion
- Repository: https://github.com/ryanfarber/notion
- Homepage: https://github.com/ryanfarber/notion#readme
- Issues: https://github.com/ryanfarber/notion/issues
- npm.io page: https://npm.io/package/@ryanforever/notion

## Dependencies (3)

- [axios](https://npm.io/package/axios.md) ^0.27.2
- [@notionhq/client](https://npm.io/package/@notionhq/client.md) ^1.0.4
- [@ryanforever/logger](https://npm.io/package/@ryanforever/logger.md) ^5.0.2

## Recent versions

- 0.3.0 (latest) — 2022-09-09
- 0.2.2 — 2022-09-09
- 0.2.1 — 2022-09-09
- 0.2.0 — 2022-05-24
- 0.1.4 — 2022-05-07
- 0.1.3 — 2022-05-07
- 0.1.2 — 2022-05-07
- 0.1.0 — 2022-05-07

## README

# notion
This is a wrapper for the API for the [Notion](https://www.notion.so) app.  It creates simple ways to update and query databases

Uses [@notionhq/client](https://www.npmjs.com/package/@notionhq/client) under the hood to make requests.



```javascript
const Notion = require("@ryanforever/notion")
const notion = new Notion({
    token: process.env.TOKEN,
    databaseId: process.env.DATABASE_ID,
    // or use url
    databaseUrl: process.env.DATABASE_URL
    debug: false
})

notion.test()
```

`token` - to get your token, go to `Settings & Members` > `Integrations`.  Find your app/bot, then click the `•••` > `Copy internal intergration tok...`

`databaseId` - to get your database id, go to the database you want to use, select the `•••` > `Copy link to view`.  The token is the first string of characters after the url:


`https://www.notion.so/{username}/{token}`

## usage

### adding data
```javascript
notion.add({
    itemName: "ball",
    price: 10.00,
    category: "sports",
    tags: ["round", "fun"] 
})
```


### create a database
```javascript
notion.createDatabase("test database", {
    parentUrl: "https://www.notion.so/...", // url of page you want database to appear in
    icon: "🗄",  // emoji icon for the database
    cover: "https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__480.jpg",
    properties: [
        {name: "name", type: "title"},
        {name: "description", type: "text"},
        {name: "selection", type: "select"},
        {name: "tags",type: "multi_select"},
        {name: "valid", type: "checkbox"},
        {name: "date", type: "date"},
        {name: "email",type: "email"},
        {name: "quantity", type: "number"},
        {name: "phone", type: "phone_number"},
        {name: "images", type: "files"}
    ]
}).then(console.log)
```

---
_Source: https://npm.io/package/@ryanforever/notion · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
