← Public packages
@kody/notion
Search, read, query, and safely write Notion pages and databases through the saved notion OAuth integration.
AGENTS.md
98 lines · 3.4 KB · Markdown@kody/notion — agent notes
Human setup and intent live in README.md. This file is for
agents: imports, smoke/dryRun execute snippets, and edge cases. Auth is the
saved OAuth integration named notion — never paste tokens. Do not disable
live webhooks or jobs. No user secrets for this package.
Import paths
| Export | Import |
|---|---|
| overview / safety metadata | kody:@kody/notion |
| smoke-test | kody:@kody/notion/smoke-test |
| request | kody:@kody/notion/request |
| search | kody:@kody/notion/search |
| get-page | kody:@kody/notion/get-page |
| get-block-children | kody:@kody/notion/get-block-children |
| get-database | kody:@kody/notion/get-database |
| get-data-source | kody:@kody/notion/get-data-source |
| query-database | kody:@kody/notion/query-database |
| create-page | kody:@kody/notion/create-page |
| append-block-children | kody:@kody/notion/append-block-children |
Prefer static kody:@kody/notion/... imports from execute. Do not lead with
packages.invoke.
Smoke test (read-only)
import smokeTest from 'kody:@kody/notion/smoke-test'
export default async function main() {
return await smokeTest()
// => { ok: true, tokenType, hasBotOwner } — no workspace/user PII
}Overview (no network beyond package metadata):
import notionOverview from 'kody:@kody/notion'
export default async function main() {
return await notionOverview()
}dryRun / confirm (writes)
Mutating helpers and mutating request methods require confirm: true after
explicit user approval of destination and content. Use dryRun: true to
preview without calling Notion.
import createPage from 'kody:@kody/notion/create-page'
export default async function main() {
return createPage({
// database_id auto-resolves to the database's single data source
parent: { database_id: '00000000-0000-0000-0000-000000000000' },
properties: {
Name: { title: [{ text: { content: 'New page' } }] },
},
dryRun: true,
})
}import search from 'kody:@kody/notion/search'
export default async function main() {
return await search({ query: 'meeting notes', objectType: 'page' })
}Edge cases / fork notes
- Notion-Version
2026-03-11: databases are containers; schema/rows live on data sources.get-database→data_sources;get-data-sourcefor properties; query via data source. Helpers that takedatabaseIdauto-resolve a single data source and error if there are several. - Database-row pages need
parent: { data_source_id }(ordatabase_idfor auto-resolve oncreate-page). - Search returns
data_sourceobjects where databases used to appear — filter withobjectType: 'page' | 'data_source'. - Block position:
position: { type: 'after_block' | 'start' | 'end', ... }— flatafteris gone. Trash field isin_trash(noarchived). - Inline child databases: use
requestPOST /databaseswithis_inline: trueandinitial_data_source.properties— not append-block-children. - Do not round-trip saved formula
expressionvalues; keep the human-readable form in your source of truth. - List helpers:
pageSize1–100,startCursor; responses includehasMore/nextCursor. - Fork/adapt: reconnect your own public Notion integration as
notion; keepdryRun/confirmguards; access stays whatever pages the consent screen shared.