Skip to content

Built for people who want to own their automations. Join the waitlist for an invite.

Package listing

@kentcdodds/notion

src/index.ts

41 lines · 2.3 KB · TypeScript
export default async function notionOverview() {
  return {
    defaultIntegration: 'notion',
    accountConvention:
      "Omit account for integration `notion`; account: '<purpose>' → integration `notion-<purpose>`; or pass integration explicitly.",
    example: { account: 'work', resolvesTo: 'notion-work' },
    apiBaseUrl: 'https://api.notion.com/v1',
    notionVersion: '2026-03-11',
    reconnectUrl: 'https://kody.codes/connect/oauth?provider=notion',
    exports: [
      'accounts',
      'smoke-test',
      'request',
      'search',
      'get-page',
      'get-block-children',
      'get-database',
      'get-data-source',
      'query-database',
      'create-page',
      'append-block-children',
    ],
    safety: {
      mutationsRequireConfirmation: true,
      dryRunAvailable: true,
    },
    notes: [
      'A Notion OAuth token is workspace-scoped: one connection reaches exactly one workspace. Connect additional workspaces as notion-<purpose> (e.g. notion-personal, notion-work).',
      "Pass account: '<purpose>' to select integration notion-<purpose>, or pass integration with the exact saved name. Omit both for the default notion integration.",
      'Use the accounts export to discover which notion / notion-* integrations are connected.',
      'Page access is chosen by the user during Notion authorization (not via OAuth scopes). Selecting a parent page or teamspace grants access to its children, including pages added later.',
      'Access is limited to pages and databases shared with the selected Notion integration connection.',
      'Use the search export first to discover page and data source ids (databases surface as data_source objects).',
      'Databases are containers: get-database lists data sources; get-data-source reads the schema; query-database queries rows (accepts databaseId with auto-resolve, or dataSourceId).',
      'Database-row pages need a data source parent; create-page auto-resolves parent.database_id to the single data source.',
      'append-block-children positions blocks via position { type: after_block | start | end }.',
      'Trash status is the in_trash field (the archived field no longer exists).',
      'To create an inline child database on a page, POST /databases via request with parent { type: "page_id" }, is_inline: true, and initial_data_source: { properties }.',
    ],
  }
}