chatgpt-api/docs/tools/notion.mdx

41 wiersze
1000 B
Markdown

---
title: Notion
description: Notion API client.
---
The [Notion API](https://developers.notion.com/docs) provides a router for accessing pages, databases, and content.
- package: `@agentic/notion`
- exports: `class NotionClient`, `namespace notion`
- env vars: `NOTION_API_KEY`
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/notion/src/notion-client.ts)
- [notion api docs](https://developers.notion.com/docs)
## Install
<CodeGroup>
```bash npm
npm install @agentic/notion
```
```bash yarn
yarn add @agentic/notion
```
```bash pnpm
pnpm add @agentic/notion
```
</CodeGroup>
## Usage
```ts
import { NotionClient } from '@agentic/notion'
const notion = new NotionClient()
const authenticatedUser = await notion.getSelf()
```
You'll need to set up a [Notion Integration](https://developers.notion.com/docs/authorization), give it access to some pages in your Notion workspace, and then set the `NOTION_API_KEY` environment variable to the integration's token.