notion-sdk-patterns

Featured

Apply production-ready @notionhq/client SDK patterns for TypeScript and Python. Use when implementing Notion integrations, building database queries with filters and sorts, handling pagination, constructing rich text blocks, or establishing team coding standards for Notion API usage. Trigger with "notion SDK patterns", "notion best practices", "notion code patterns", "idiomatic notion", "notion typescript", "notion python SDK".

AI & Automation 2,249 stars 312 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Notion SDK Patterns ## Overview Production-ready patterns for the official Notion SDK (`@notionhq/client` for TypeScript, `notion-client` for Python) covering client initialization, database queries with filters and sorts, cursor-based pagination, rich text construction, block manipulation, and type-safe error handling using SDK error codes. ## Prerequisites - **Node.js 18+** with `@notionhq/client` v2.x installed, or **Python 3.9+** with `notion-client` - A Notion integration token (`NOTION_TOKEN`) from [notion.so/my-integrations](https://www.notion.so/my-integrations) - Target databases/pages shared with the integration (Share > Invite > select your integration) - TypeScript 5+ with strict mode enabled (for TypeScript patterns) ## Instructions ### Step 1 — Initialize the Client and Query Databases Set up the SDK client and execute filtered, sorted database queries. **TypeScript — Client initialization:** ```typescript import { Client } from '@notionhq/client'; const notion = new Client({ auth: process.env.NOTION_TOKEN }); ``` **Database query with filter and sort:** ```typescript const response = await notion.databases.query({ database_id, filter: { property: 'Status', select: { equals: 'Active', }, }, sorts: [ { property: 'Created', direction: 'descending', }, ], }); ``` **Compound filters** combine conditions with `and`/`or`: ```typescript const response = await notion.databases.query({ database_id, filter: ...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
7 months ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Related Skills